Fossil SCM
Cleanup trailing whitespace in 'th_main.c'.
Commit
b000db4752f9145cb34c2d19921e3083426586b6
Parent
378dad36ba266ca…
1 file changed
+63
-63
+63
-63
| --- src/th_main.c | ||
| +++ src/th_main.c | ||
| @@ -145,14 +145,14 @@ | ||
| 145 | 145 | ** |
| 146 | 146 | ** Escape all characters of STRING which have special meaning in URI |
| 147 | 147 | ** components. Return a new string result. |
| 148 | 148 | */ |
| 149 | 149 | static int httpizeCmd( |
| 150 | - Th_Interp *interp, | |
| 151 | - void *p, | |
| 152 | - int argc, | |
| 153 | - const char **argv, | |
| 150 | + Th_Interp *interp, | |
| 151 | + void *p, | |
| 152 | + int argc, | |
| 153 | + const char **argv, | |
| 154 | 154 | int *argl |
| 155 | 155 | ){ |
| 156 | 156 | char *zOut; |
| 157 | 157 | if( argc!=2 ){ |
| 158 | 158 | return Th_WrongNumArgs(interp, "httpize STRING"); |
| @@ -172,14 +172,14 @@ | ||
| 172 | 172 | ** TH1 command: enable_output BOOLEAN |
| 173 | 173 | ** |
| 174 | 174 | ** Enable or disable the puts and hputs commands. |
| 175 | 175 | */ |
| 176 | 176 | static int enableOutputCmd( |
| 177 | - Th_Interp *interp, | |
| 178 | - void *p, | |
| 179 | - int argc, | |
| 180 | - const char **argv, | |
| 177 | + Th_Interp *interp, | |
| 178 | + void *p, | |
| 179 | + int argc, | |
| 180 | + const char **argv, | |
| 181 | 181 | int *argl |
| 182 | 182 | ){ |
| 183 | 183 | int rc; |
| 184 | 184 | if( argc<2 || argc>3 ){ |
| 185 | 185 | return Th_WrongNumArgs(interp, "enable_output [LABEL] BOOLEAN"); |
| @@ -245,17 +245,17 @@ | ||
| 245 | 245 | |
| 246 | 246 | /* |
| 247 | 247 | ** TH1 command: puts STRING |
| 248 | 248 | ** TH1 command: html STRING |
| 249 | 249 | ** |
| 250 | -** Output STRING escaped for HTML (html) or unchanged (puts). | |
| 250 | +** Output STRING escaped for HTML (html) or unchanged (puts). | |
| 251 | 251 | */ |
| 252 | 252 | static int putsCmd( |
| 253 | - Th_Interp *interp, | |
| 254 | - void *pConvert, | |
| 255 | - int argc, | |
| 256 | - const char **argv, | |
| 253 | + Th_Interp *interp, | |
| 254 | + void *pConvert, | |
| 255 | + int argc, | |
| 256 | + const char **argv, | |
| 257 | 257 | int *argl |
| 258 | 258 | ){ |
| 259 | 259 | if( argc!=2 ){ |
| 260 | 260 | return Th_WrongNumArgs(interp, "puts STRING"); |
| 261 | 261 | } |
| @@ -267,14 +267,14 @@ | ||
| 267 | 267 | ** TH1 command: wiki STRING |
| 268 | 268 | ** |
| 269 | 269 | ** Render the input string as wiki. |
| 270 | 270 | */ |
| 271 | 271 | static int wikiCmd( |
| 272 | - Th_Interp *interp, | |
| 273 | - void *p, | |
| 274 | - int argc, | |
| 275 | - const char **argv, | |
| 272 | + Th_Interp *interp, | |
| 273 | + void *p, | |
| 274 | + int argc, | |
| 275 | + const char **argv, | |
| 276 | 276 | int *argl |
| 277 | 277 | ){ |
| 278 | 278 | int flags = WIKI_INLINE | WIKI_NOBADLINKS | *(unsigned int*)p; |
| 279 | 279 | if( argc!=2 ){ |
| 280 | 280 | return Th_WrongNumArgs(interp, "wiki STRING"); |
| @@ -293,14 +293,14 @@ | ||
| 293 | 293 | ** |
| 294 | 294 | ** Escape all characters of STRING which have special meaning in HTML. |
| 295 | 295 | ** Return a new string result. |
| 296 | 296 | */ |
| 297 | 297 | static int htmlizeCmd( |
| 298 | - Th_Interp *interp, | |
| 299 | - void *p, | |
| 300 | - int argc, | |
| 301 | - const char **argv, | |
| 298 | + Th_Interp *interp, | |
| 299 | + void *p, | |
| 300 | + int argc, | |
| 301 | + const char **argv, | |
| 302 | 302 | int *argl |
| 303 | 303 | ){ |
| 304 | 304 | char *zOut; |
| 305 | 305 | if( argc!=2 ){ |
| 306 | 306 | return Th_WrongNumArgs(interp, "htmlize STRING"); |
| @@ -317,14 +317,14 @@ | ||
| 317 | 317 | ** Return a string which is the current time and date. If the |
| 318 | 318 | ** -local option is used, the date appears using localtime instead |
| 319 | 319 | ** of UTC. |
| 320 | 320 | */ |
| 321 | 321 | static int dateCmd( |
| 322 | - Th_Interp *interp, | |
| 323 | - void *p, | |
| 324 | - int argc, | |
| 325 | - const char **argv, | |
| 322 | + Th_Interp *interp, | |
| 323 | + void *p, | |
| 324 | + int argc, | |
| 325 | + const char **argv, | |
| 326 | 326 | int *argl |
| 327 | 327 | ){ |
| 328 | 328 | char *zOut; |
| 329 | 329 | if( argc>=2 && argl[1]==6 && memcmp(argv[1],"-local",6)==0 ){ |
| 330 | 330 | zOut = db_text("??", "SELECT datetime('now'%s)", timeline_utc()); |
| @@ -340,14 +340,14 @@ | ||
| 340 | 340 | ** TH1 command: hascap STRING... |
| 341 | 341 | ** |
| 342 | 342 | ** Return true if the user has all of the capabilities listed in STRING. |
| 343 | 343 | */ |
| 344 | 344 | static int hascapCmd( |
| 345 | - Th_Interp *interp, | |
| 346 | - void *p, | |
| 347 | - int argc, | |
| 348 | - const char **argv, | |
| 345 | + Th_Interp *interp, | |
| 346 | + void *p, | |
| 347 | + int argc, | |
| 348 | + const char **argv, | |
| 349 | 349 | int *argl |
| 350 | 350 | ){ |
| 351 | 351 | int rc = 0, i; |
| 352 | 352 | if( argc<2 ){ |
| 353 | 353 | return Th_WrongNumArgs(interp, "hascap STRING ..."); |
| @@ -377,14 +377,14 @@ | ||
| 377 | 377 | ** "json" = FOSSIL_ENABLE_JSON |
| 378 | 378 | ** "markdown" = FOSSIL_ENABLE_MARKDOWN |
| 379 | 379 | ** |
| 380 | 380 | */ |
| 381 | 381 | static int hasfeatureCmd( |
| 382 | - Th_Interp *interp, | |
| 383 | - void *p, | |
| 384 | - int argc, | |
| 385 | - const char **argv, | |
| 382 | + Th_Interp *interp, | |
| 383 | + void *p, | |
| 384 | + int argc, | |
| 385 | + const char **argv, | |
| 386 | 386 | int *argl |
| 387 | 387 | ){ |
| 388 | 388 | int rc = 0; |
| 389 | 389 | char const * zArg; |
| 390 | 390 | if( argc!=2 ){ |
| @@ -475,14 +475,14 @@ | ||
| 475 | 475 | ** TH1 command: anycap STRING |
| 476 | 476 | ** |
| 477 | 477 | ** Return true if the user has any one of the capabilities listed in STRING. |
| 478 | 478 | */ |
| 479 | 479 | static int anycapCmd( |
| 480 | - Th_Interp *interp, | |
| 481 | - void *p, | |
| 482 | - int argc, | |
| 483 | - const char **argv, | |
| 480 | + Th_Interp *interp, | |
| 481 | + void *p, | |
| 482 | + int argc, | |
| 483 | + const char **argv, | |
| 484 | 484 | int *argl |
| 485 | 485 | ){ |
| 486 | 486 | int rc = 0; |
| 487 | 487 | int i; |
| 488 | 488 | if( argc!=2 ){ |
| @@ -508,13 +508,13 @@ | ||
| 508 | 508 | ** If NUMLINES is greater than one then the display is a listbox |
| 509 | 509 | ** with the number of lines given. |
| 510 | 510 | */ |
| 511 | 511 | static int comboboxCmd( |
| 512 | 512 | Th_Interp *interp, |
| 513 | - void *p, | |
| 514 | - int argc, | |
| 515 | - const char **argv, | |
| 513 | + void *p, | |
| 514 | + int argc, | |
| 515 | + const char **argv, | |
| 516 | 516 | int *argl |
| 517 | 517 | ){ |
| 518 | 518 | if( argc!=4 ){ |
| 519 | 519 | return Th_WrongNumArgs(interp, "combobox NAME TEXT-LIST NUMLINES"); |
| 520 | 520 | } |
| @@ -539,11 +539,11 @@ | ||
| 539 | 539 | sendText(z, -1, 0); |
| 540 | 540 | free(z); |
| 541 | 541 | blob_reset(&name); |
| 542 | 542 | for(i=0; i<nElem; i++){ |
| 543 | 543 | zH = htmlize((char*)azElem[i], aszElem[i]); |
| 544 | - if( zValue && aszElem[i]==nValue | |
| 544 | + if( zValue && aszElem[i]==nValue | |
| 545 | 545 | && memcmp(zValue, azElem[i], nValue)==0 ){ |
| 546 | 546 | z = mprintf("<option value=\"%s\" selected=\"selected\">%s</option>", |
| 547 | 547 | zH, zH); |
| 548 | 548 | }else{ |
| 549 | 549 | z = mprintf("<option value=\"%s\">%s</option>", zH, zH); |
| @@ -564,13 +564,13 @@ | ||
| 564 | 564 | ** Return one more than the number of \n characters in STRING. But |
| 565 | 565 | ** never return less than MIN or more than MAX. |
| 566 | 566 | */ |
| 567 | 567 | static int linecntCmd( |
| 568 | 568 | Th_Interp *interp, |
| 569 | - void *p, | |
| 570 | - int argc, | |
| 571 | - const char **argv, | |
| 569 | + void *p, | |
| 570 | + int argc, | |
| 571 | + const char **argv, | |
| 572 | 572 | int *argl |
| 573 | 573 | ){ |
| 574 | 574 | const char *z; |
| 575 | 575 | int size, n, i; |
| 576 | 576 | int iMin, iMax; |
| @@ -600,13 +600,13 @@ | ||
| 600 | 600 | ** string if one is not currently open. Optionally, it will attempt to open |
| 601 | 601 | ** the repository if the boolean argument is non-zero. |
| 602 | 602 | */ |
| 603 | 603 | static int repositoryCmd( |
| 604 | 604 | Th_Interp *interp, |
| 605 | - void *p, | |
| 606 | - int argc, | |
| 607 | - const char **argv, | |
| 605 | + void *p, | |
| 606 | + int argc, | |
| 607 | + const char **argv, | |
| 608 | 608 | int *argl |
| 609 | 609 | ){ |
| 610 | 610 | if( argc!=1 && argc!=2 ){ |
| 611 | 611 | return Th_WrongNumArgs(interp, "repository ?BOOLEAN?"); |
| 612 | 612 | } |
| @@ -855,11 +855,11 @@ | ||
| 855 | 855 | getrusage(RUSAGE_SELF, &s); |
| 856 | 856 | if( piUser ){ |
| 857 | 857 | *piUser = ((sqlite3_uint64)s.ru_utime.tv_sec)*1000000 + s.ru_utime.tv_usec; |
| 858 | 858 | } |
| 859 | 859 | if( piKernel ){ |
| 860 | - *piKernel = | |
| 860 | + *piKernel = | |
| 861 | 861 | ((sqlite3_uint64)s.ru_stime.tv_sec)*1000000 + s.ru_stime.tv_usec; |
| 862 | 862 | } |
| 863 | 863 | #endif |
| 864 | 864 | } |
| 865 | 865 | |
| @@ -869,13 +869,13 @@ | ||
| 869 | 869 | ** Return the number of microseconds of CPU time consumed by the current |
| 870 | 870 | ** process in user space. |
| 871 | 871 | */ |
| 872 | 872 | static int utimeCmd( |
| 873 | 873 | Th_Interp *interp, |
| 874 | - void *p, | |
| 875 | - int argc, | |
| 876 | - const char **argv, | |
| 874 | + void *p, | |
| 875 | + int argc, | |
| 876 | + const char **argv, | |
| 877 | 877 | int *argl |
| 878 | 878 | ){ |
| 879 | 879 | sqlite3_uint64 x; |
| 880 | 880 | char zUTime[50]; |
| 881 | 881 | getCpuTimes(&x, 0); |
| @@ -890,13 +890,13 @@ | ||
| 890 | 890 | ** Return the number of microseconds of CPU time consumed by the current |
| 891 | 891 | ** process in system space. |
| 892 | 892 | */ |
| 893 | 893 | static int stimeCmd( |
| 894 | 894 | Th_Interp *interp, |
| 895 | - void *p, | |
| 896 | - int argc, | |
| 897 | - const char **argv, | |
| 895 | + void *p, | |
| 896 | + int argc, | |
| 897 | + const char **argv, | |
| 898 | 898 | int *argl |
| 899 | 899 | ){ |
| 900 | 900 | sqlite3_uint64 x; |
| 901 | 901 | char zUTime[50]; |
| 902 | 902 | getCpuTimes(0, &x); |
| @@ -907,18 +907,18 @@ | ||
| 907 | 907 | |
| 908 | 908 | |
| 909 | 909 | /* |
| 910 | 910 | ** TH1 command: randhex N |
| 911 | 911 | ** |
| 912 | -** Return N*2 random hexadecimal digits with N<50. If N is omitted, | |
| 912 | +** Return N*2 random hexadecimal digits with N<50. If N is omitted, | |
| 913 | 913 | ** use a value of 10. |
| 914 | 914 | */ |
| 915 | 915 | static int randhexCmd( |
| 916 | 916 | Th_Interp *interp, |
| 917 | - void *p, | |
| 918 | - int argc, | |
| 919 | - const char **argv, | |
| 917 | + void *p, | |
| 918 | + int argc, | |
| 919 | + const char **argv, | |
| 920 | 920 | int *argl |
| 921 | 921 | ){ |
| 922 | 922 | int n; |
| 923 | 923 | unsigned char aRand[50]; |
| 924 | 924 | unsigned char zOut[100]; |
| @@ -950,13 +950,13 @@ | ||
| 950 | 950 | ** "var". Result values are stored in variables with the column name prior |
| 951 | 951 | ** to each invocation of CODE. |
| 952 | 952 | */ |
| 953 | 953 | static int queryCmd( |
| 954 | 954 | Th_Interp *interp, |
| 955 | - void *p, | |
| 956 | - int argc, | |
| 957 | - const char **argv, | |
| 955 | + void *p, | |
| 956 | + int argc, | |
| 957 | + const char **argv, | |
| 958 | 958 | int *argl |
| 959 | 959 | ){ |
| 960 | 960 | sqlite3_stmt *pStmt; |
| 961 | 961 | int rc; |
| 962 | 962 | const char *zSql; |
| @@ -1016,11 +1016,11 @@ | ||
| 1016 | 1016 | rc = sqlite3_finalize(pStmt); |
| 1017 | 1017 | if( rc!=SQLITE_OK ){ |
| 1018 | 1018 | Th_ErrorMessage(interp, "SQL error: ", sqlite3_errmsg(g.db), -1); |
| 1019 | 1019 | return TH_ERROR; |
| 1020 | 1020 | } |
| 1021 | - } | |
| 1021 | + } | |
| 1022 | 1022 | return res; |
| 1023 | 1023 | } |
| 1024 | 1024 | |
| 1025 | 1025 | /* |
| 1026 | 1026 | ** TH1 command: setting name |
| @@ -1691,11 +1691,11 @@ | ||
| 1691 | 1691 | } |
| 1692 | 1692 | #endif |
| 1693 | 1693 | |
| 1694 | 1694 | /* |
| 1695 | 1695 | ** The z[] input contains text mixed with TH1 scripts. |
| 1696 | -** The TH1 scripts are contained within <th1>...</th1>. | |
| 1696 | +** The TH1 scripts are contained within <th1>...</th1>. | |
| 1697 | 1697 | ** TH1 variables are $aaa or $<aaa>. The first form of |
| 1698 | 1698 | ** variable is literal. The second is run through htmlize |
| 1699 | 1699 | ** before being inserted. |
| 1700 | 1700 | ** |
| 1701 | 1701 | ** This routine processes the template and writes the results |
| 1702 | 1702 |
| --- src/th_main.c | |
| +++ src/th_main.c | |
| @@ -145,14 +145,14 @@ | |
| 145 | ** |
| 146 | ** Escape all characters of STRING which have special meaning in URI |
| 147 | ** components. Return a new string result. |
| 148 | */ |
| 149 | static int httpizeCmd( |
| 150 | Th_Interp *interp, |
| 151 | void *p, |
| 152 | int argc, |
| 153 | const char **argv, |
| 154 | int *argl |
| 155 | ){ |
| 156 | char *zOut; |
| 157 | if( argc!=2 ){ |
| 158 | return Th_WrongNumArgs(interp, "httpize STRING"); |
| @@ -172,14 +172,14 @@ | |
| 172 | ** TH1 command: enable_output BOOLEAN |
| 173 | ** |
| 174 | ** Enable or disable the puts and hputs commands. |
| 175 | */ |
| 176 | static int enableOutputCmd( |
| 177 | Th_Interp *interp, |
| 178 | void *p, |
| 179 | int argc, |
| 180 | const char **argv, |
| 181 | int *argl |
| 182 | ){ |
| 183 | int rc; |
| 184 | if( argc<2 || argc>3 ){ |
| 185 | return Th_WrongNumArgs(interp, "enable_output [LABEL] BOOLEAN"); |
| @@ -245,17 +245,17 @@ | |
| 245 | |
| 246 | /* |
| 247 | ** TH1 command: puts STRING |
| 248 | ** TH1 command: html STRING |
| 249 | ** |
| 250 | ** Output STRING escaped for HTML (html) or unchanged (puts). |
| 251 | */ |
| 252 | static int putsCmd( |
| 253 | Th_Interp *interp, |
| 254 | void *pConvert, |
| 255 | int argc, |
| 256 | const char **argv, |
| 257 | int *argl |
| 258 | ){ |
| 259 | if( argc!=2 ){ |
| 260 | return Th_WrongNumArgs(interp, "puts STRING"); |
| 261 | } |
| @@ -267,14 +267,14 @@ | |
| 267 | ** TH1 command: wiki STRING |
| 268 | ** |
| 269 | ** Render the input string as wiki. |
| 270 | */ |
| 271 | static int wikiCmd( |
| 272 | Th_Interp *interp, |
| 273 | void *p, |
| 274 | int argc, |
| 275 | const char **argv, |
| 276 | int *argl |
| 277 | ){ |
| 278 | int flags = WIKI_INLINE | WIKI_NOBADLINKS | *(unsigned int*)p; |
| 279 | if( argc!=2 ){ |
| 280 | return Th_WrongNumArgs(interp, "wiki STRING"); |
| @@ -293,14 +293,14 @@ | |
| 293 | ** |
| 294 | ** Escape all characters of STRING which have special meaning in HTML. |
| 295 | ** Return a new string result. |
| 296 | */ |
| 297 | static int htmlizeCmd( |
| 298 | Th_Interp *interp, |
| 299 | void *p, |
| 300 | int argc, |
| 301 | const char **argv, |
| 302 | int *argl |
| 303 | ){ |
| 304 | char *zOut; |
| 305 | if( argc!=2 ){ |
| 306 | return Th_WrongNumArgs(interp, "htmlize STRING"); |
| @@ -317,14 +317,14 @@ | |
| 317 | ** Return a string which is the current time and date. If the |
| 318 | ** -local option is used, the date appears using localtime instead |
| 319 | ** of UTC. |
| 320 | */ |
| 321 | static int dateCmd( |
| 322 | Th_Interp *interp, |
| 323 | void *p, |
| 324 | int argc, |
| 325 | const char **argv, |
| 326 | int *argl |
| 327 | ){ |
| 328 | char *zOut; |
| 329 | if( argc>=2 && argl[1]==6 && memcmp(argv[1],"-local",6)==0 ){ |
| 330 | zOut = db_text("??", "SELECT datetime('now'%s)", timeline_utc()); |
| @@ -340,14 +340,14 @@ | |
| 340 | ** TH1 command: hascap STRING... |
| 341 | ** |
| 342 | ** Return true if the user has all of the capabilities listed in STRING. |
| 343 | */ |
| 344 | static int hascapCmd( |
| 345 | Th_Interp *interp, |
| 346 | void *p, |
| 347 | int argc, |
| 348 | const char **argv, |
| 349 | int *argl |
| 350 | ){ |
| 351 | int rc = 0, i; |
| 352 | if( argc<2 ){ |
| 353 | return Th_WrongNumArgs(interp, "hascap STRING ..."); |
| @@ -377,14 +377,14 @@ | |
| 377 | ** "json" = FOSSIL_ENABLE_JSON |
| 378 | ** "markdown" = FOSSIL_ENABLE_MARKDOWN |
| 379 | ** |
| 380 | */ |
| 381 | static int hasfeatureCmd( |
| 382 | Th_Interp *interp, |
| 383 | void *p, |
| 384 | int argc, |
| 385 | const char **argv, |
| 386 | int *argl |
| 387 | ){ |
| 388 | int rc = 0; |
| 389 | char const * zArg; |
| 390 | if( argc!=2 ){ |
| @@ -475,14 +475,14 @@ | |
| 475 | ** TH1 command: anycap STRING |
| 476 | ** |
| 477 | ** Return true if the user has any one of the capabilities listed in STRING. |
| 478 | */ |
| 479 | static int anycapCmd( |
| 480 | Th_Interp *interp, |
| 481 | void *p, |
| 482 | int argc, |
| 483 | const char **argv, |
| 484 | int *argl |
| 485 | ){ |
| 486 | int rc = 0; |
| 487 | int i; |
| 488 | if( argc!=2 ){ |
| @@ -508,13 +508,13 @@ | |
| 508 | ** If NUMLINES is greater than one then the display is a listbox |
| 509 | ** with the number of lines given. |
| 510 | */ |
| 511 | static int comboboxCmd( |
| 512 | Th_Interp *interp, |
| 513 | void *p, |
| 514 | int argc, |
| 515 | const char **argv, |
| 516 | int *argl |
| 517 | ){ |
| 518 | if( argc!=4 ){ |
| 519 | return Th_WrongNumArgs(interp, "combobox NAME TEXT-LIST NUMLINES"); |
| 520 | } |
| @@ -539,11 +539,11 @@ | |
| 539 | sendText(z, -1, 0); |
| 540 | free(z); |
| 541 | blob_reset(&name); |
| 542 | for(i=0; i<nElem; i++){ |
| 543 | zH = htmlize((char*)azElem[i], aszElem[i]); |
| 544 | if( zValue && aszElem[i]==nValue |
| 545 | && memcmp(zValue, azElem[i], nValue)==0 ){ |
| 546 | z = mprintf("<option value=\"%s\" selected=\"selected\">%s</option>", |
| 547 | zH, zH); |
| 548 | }else{ |
| 549 | z = mprintf("<option value=\"%s\">%s</option>", zH, zH); |
| @@ -564,13 +564,13 @@ | |
| 564 | ** Return one more than the number of \n characters in STRING. But |
| 565 | ** never return less than MIN or more than MAX. |
| 566 | */ |
| 567 | static int linecntCmd( |
| 568 | Th_Interp *interp, |
| 569 | void *p, |
| 570 | int argc, |
| 571 | const char **argv, |
| 572 | int *argl |
| 573 | ){ |
| 574 | const char *z; |
| 575 | int size, n, i; |
| 576 | int iMin, iMax; |
| @@ -600,13 +600,13 @@ | |
| 600 | ** string if one is not currently open. Optionally, it will attempt to open |
| 601 | ** the repository if the boolean argument is non-zero. |
| 602 | */ |
| 603 | static int repositoryCmd( |
| 604 | Th_Interp *interp, |
| 605 | void *p, |
| 606 | int argc, |
| 607 | const char **argv, |
| 608 | int *argl |
| 609 | ){ |
| 610 | if( argc!=1 && argc!=2 ){ |
| 611 | return Th_WrongNumArgs(interp, "repository ?BOOLEAN?"); |
| 612 | } |
| @@ -855,11 +855,11 @@ | |
| 855 | getrusage(RUSAGE_SELF, &s); |
| 856 | if( piUser ){ |
| 857 | *piUser = ((sqlite3_uint64)s.ru_utime.tv_sec)*1000000 + s.ru_utime.tv_usec; |
| 858 | } |
| 859 | if( piKernel ){ |
| 860 | *piKernel = |
| 861 | ((sqlite3_uint64)s.ru_stime.tv_sec)*1000000 + s.ru_stime.tv_usec; |
| 862 | } |
| 863 | #endif |
| 864 | } |
| 865 | |
| @@ -869,13 +869,13 @@ | |
| 869 | ** Return the number of microseconds of CPU time consumed by the current |
| 870 | ** process in user space. |
| 871 | */ |
| 872 | static int utimeCmd( |
| 873 | Th_Interp *interp, |
| 874 | void *p, |
| 875 | int argc, |
| 876 | const char **argv, |
| 877 | int *argl |
| 878 | ){ |
| 879 | sqlite3_uint64 x; |
| 880 | char zUTime[50]; |
| 881 | getCpuTimes(&x, 0); |
| @@ -890,13 +890,13 @@ | |
| 890 | ** Return the number of microseconds of CPU time consumed by the current |
| 891 | ** process in system space. |
| 892 | */ |
| 893 | static int stimeCmd( |
| 894 | Th_Interp *interp, |
| 895 | void *p, |
| 896 | int argc, |
| 897 | const char **argv, |
| 898 | int *argl |
| 899 | ){ |
| 900 | sqlite3_uint64 x; |
| 901 | char zUTime[50]; |
| 902 | getCpuTimes(0, &x); |
| @@ -907,18 +907,18 @@ | |
| 907 | |
| 908 | |
| 909 | /* |
| 910 | ** TH1 command: randhex N |
| 911 | ** |
| 912 | ** Return N*2 random hexadecimal digits with N<50. If N is omitted, |
| 913 | ** use a value of 10. |
| 914 | */ |
| 915 | static int randhexCmd( |
| 916 | Th_Interp *interp, |
| 917 | void *p, |
| 918 | int argc, |
| 919 | const char **argv, |
| 920 | int *argl |
| 921 | ){ |
| 922 | int n; |
| 923 | unsigned char aRand[50]; |
| 924 | unsigned char zOut[100]; |
| @@ -950,13 +950,13 @@ | |
| 950 | ** "var". Result values are stored in variables with the column name prior |
| 951 | ** to each invocation of CODE. |
| 952 | */ |
| 953 | static int queryCmd( |
| 954 | Th_Interp *interp, |
| 955 | void *p, |
| 956 | int argc, |
| 957 | const char **argv, |
| 958 | int *argl |
| 959 | ){ |
| 960 | sqlite3_stmt *pStmt; |
| 961 | int rc; |
| 962 | const char *zSql; |
| @@ -1016,11 +1016,11 @@ | |
| 1016 | rc = sqlite3_finalize(pStmt); |
| 1017 | if( rc!=SQLITE_OK ){ |
| 1018 | Th_ErrorMessage(interp, "SQL error: ", sqlite3_errmsg(g.db), -1); |
| 1019 | return TH_ERROR; |
| 1020 | } |
| 1021 | } |
| 1022 | return res; |
| 1023 | } |
| 1024 | |
| 1025 | /* |
| 1026 | ** TH1 command: setting name |
| @@ -1691,11 +1691,11 @@ | |
| 1691 | } |
| 1692 | #endif |
| 1693 | |
| 1694 | /* |
| 1695 | ** The z[] input contains text mixed with TH1 scripts. |
| 1696 | ** The TH1 scripts are contained within <th1>...</th1>. |
| 1697 | ** TH1 variables are $aaa or $<aaa>. The first form of |
| 1698 | ** variable is literal. The second is run through htmlize |
| 1699 | ** before being inserted. |
| 1700 | ** |
| 1701 | ** This routine processes the template and writes the results |
| 1702 |
| --- src/th_main.c | |
| +++ src/th_main.c | |
| @@ -145,14 +145,14 @@ | |
| 145 | ** |
| 146 | ** Escape all characters of STRING which have special meaning in URI |
| 147 | ** components. Return a new string result. |
| 148 | */ |
| 149 | static int httpizeCmd( |
| 150 | Th_Interp *interp, |
| 151 | void *p, |
| 152 | int argc, |
| 153 | const char **argv, |
| 154 | int *argl |
| 155 | ){ |
| 156 | char *zOut; |
| 157 | if( argc!=2 ){ |
| 158 | return Th_WrongNumArgs(interp, "httpize STRING"); |
| @@ -172,14 +172,14 @@ | |
| 172 | ** TH1 command: enable_output BOOLEAN |
| 173 | ** |
| 174 | ** Enable or disable the puts and hputs commands. |
| 175 | */ |
| 176 | static int enableOutputCmd( |
| 177 | Th_Interp *interp, |
| 178 | void *p, |
| 179 | int argc, |
| 180 | const char **argv, |
| 181 | int *argl |
| 182 | ){ |
| 183 | int rc; |
| 184 | if( argc<2 || argc>3 ){ |
| 185 | return Th_WrongNumArgs(interp, "enable_output [LABEL] BOOLEAN"); |
| @@ -245,17 +245,17 @@ | |
| 245 | |
| 246 | /* |
| 247 | ** TH1 command: puts STRING |
| 248 | ** TH1 command: html STRING |
| 249 | ** |
| 250 | ** Output STRING escaped for HTML (html) or unchanged (puts). |
| 251 | */ |
| 252 | static int putsCmd( |
| 253 | Th_Interp *interp, |
| 254 | void *pConvert, |
| 255 | int argc, |
| 256 | const char **argv, |
| 257 | int *argl |
| 258 | ){ |
| 259 | if( argc!=2 ){ |
| 260 | return Th_WrongNumArgs(interp, "puts STRING"); |
| 261 | } |
| @@ -267,14 +267,14 @@ | |
| 267 | ** TH1 command: wiki STRING |
| 268 | ** |
| 269 | ** Render the input string as wiki. |
| 270 | */ |
| 271 | static int wikiCmd( |
| 272 | Th_Interp *interp, |
| 273 | void *p, |
| 274 | int argc, |
| 275 | const char **argv, |
| 276 | int *argl |
| 277 | ){ |
| 278 | int flags = WIKI_INLINE | WIKI_NOBADLINKS | *(unsigned int*)p; |
| 279 | if( argc!=2 ){ |
| 280 | return Th_WrongNumArgs(interp, "wiki STRING"); |
| @@ -293,14 +293,14 @@ | |
| 293 | ** |
| 294 | ** Escape all characters of STRING which have special meaning in HTML. |
| 295 | ** Return a new string result. |
| 296 | */ |
| 297 | static int htmlizeCmd( |
| 298 | Th_Interp *interp, |
| 299 | void *p, |
| 300 | int argc, |
| 301 | const char **argv, |
| 302 | int *argl |
| 303 | ){ |
| 304 | char *zOut; |
| 305 | if( argc!=2 ){ |
| 306 | return Th_WrongNumArgs(interp, "htmlize STRING"); |
| @@ -317,14 +317,14 @@ | |
| 317 | ** Return a string which is the current time and date. If the |
| 318 | ** -local option is used, the date appears using localtime instead |
| 319 | ** of UTC. |
| 320 | */ |
| 321 | static int dateCmd( |
| 322 | Th_Interp *interp, |
| 323 | void *p, |
| 324 | int argc, |
| 325 | const char **argv, |
| 326 | int *argl |
| 327 | ){ |
| 328 | char *zOut; |
| 329 | if( argc>=2 && argl[1]==6 && memcmp(argv[1],"-local",6)==0 ){ |
| 330 | zOut = db_text("??", "SELECT datetime('now'%s)", timeline_utc()); |
| @@ -340,14 +340,14 @@ | |
| 340 | ** TH1 command: hascap STRING... |
| 341 | ** |
| 342 | ** Return true if the user has all of the capabilities listed in STRING. |
| 343 | */ |
| 344 | static int hascapCmd( |
| 345 | Th_Interp *interp, |
| 346 | void *p, |
| 347 | int argc, |
| 348 | const char **argv, |
| 349 | int *argl |
| 350 | ){ |
| 351 | int rc = 0, i; |
| 352 | if( argc<2 ){ |
| 353 | return Th_WrongNumArgs(interp, "hascap STRING ..."); |
| @@ -377,14 +377,14 @@ | |
| 377 | ** "json" = FOSSIL_ENABLE_JSON |
| 378 | ** "markdown" = FOSSIL_ENABLE_MARKDOWN |
| 379 | ** |
| 380 | */ |
| 381 | static int hasfeatureCmd( |
| 382 | Th_Interp *interp, |
| 383 | void *p, |
| 384 | int argc, |
| 385 | const char **argv, |
| 386 | int *argl |
| 387 | ){ |
| 388 | int rc = 0; |
| 389 | char const * zArg; |
| 390 | if( argc!=2 ){ |
| @@ -475,14 +475,14 @@ | |
| 475 | ** TH1 command: anycap STRING |
| 476 | ** |
| 477 | ** Return true if the user has any one of the capabilities listed in STRING. |
| 478 | */ |
| 479 | static int anycapCmd( |
| 480 | Th_Interp *interp, |
| 481 | void *p, |
| 482 | int argc, |
| 483 | const char **argv, |
| 484 | int *argl |
| 485 | ){ |
| 486 | int rc = 0; |
| 487 | int i; |
| 488 | if( argc!=2 ){ |
| @@ -508,13 +508,13 @@ | |
| 508 | ** If NUMLINES is greater than one then the display is a listbox |
| 509 | ** with the number of lines given. |
| 510 | */ |
| 511 | static int comboboxCmd( |
| 512 | Th_Interp *interp, |
| 513 | void *p, |
| 514 | int argc, |
| 515 | const char **argv, |
| 516 | int *argl |
| 517 | ){ |
| 518 | if( argc!=4 ){ |
| 519 | return Th_WrongNumArgs(interp, "combobox NAME TEXT-LIST NUMLINES"); |
| 520 | } |
| @@ -539,11 +539,11 @@ | |
| 539 | sendText(z, -1, 0); |
| 540 | free(z); |
| 541 | blob_reset(&name); |
| 542 | for(i=0; i<nElem; i++){ |
| 543 | zH = htmlize((char*)azElem[i], aszElem[i]); |
| 544 | if( zValue && aszElem[i]==nValue |
| 545 | && memcmp(zValue, azElem[i], nValue)==0 ){ |
| 546 | z = mprintf("<option value=\"%s\" selected=\"selected\">%s</option>", |
| 547 | zH, zH); |
| 548 | }else{ |
| 549 | z = mprintf("<option value=\"%s\">%s</option>", zH, zH); |
| @@ -564,13 +564,13 @@ | |
| 564 | ** Return one more than the number of \n characters in STRING. But |
| 565 | ** never return less than MIN or more than MAX. |
| 566 | */ |
| 567 | static int linecntCmd( |
| 568 | Th_Interp *interp, |
| 569 | void *p, |
| 570 | int argc, |
| 571 | const char **argv, |
| 572 | int *argl |
| 573 | ){ |
| 574 | const char *z; |
| 575 | int size, n, i; |
| 576 | int iMin, iMax; |
| @@ -600,13 +600,13 @@ | |
| 600 | ** string if one is not currently open. Optionally, it will attempt to open |
| 601 | ** the repository if the boolean argument is non-zero. |
| 602 | */ |
| 603 | static int repositoryCmd( |
| 604 | Th_Interp *interp, |
| 605 | void *p, |
| 606 | int argc, |
| 607 | const char **argv, |
| 608 | int *argl |
| 609 | ){ |
| 610 | if( argc!=1 && argc!=2 ){ |
| 611 | return Th_WrongNumArgs(interp, "repository ?BOOLEAN?"); |
| 612 | } |
| @@ -855,11 +855,11 @@ | |
| 855 | getrusage(RUSAGE_SELF, &s); |
| 856 | if( piUser ){ |
| 857 | *piUser = ((sqlite3_uint64)s.ru_utime.tv_sec)*1000000 + s.ru_utime.tv_usec; |
| 858 | } |
| 859 | if( piKernel ){ |
| 860 | *piKernel = |
| 861 | ((sqlite3_uint64)s.ru_stime.tv_sec)*1000000 + s.ru_stime.tv_usec; |
| 862 | } |
| 863 | #endif |
| 864 | } |
| 865 | |
| @@ -869,13 +869,13 @@ | |
| 869 | ** Return the number of microseconds of CPU time consumed by the current |
| 870 | ** process in user space. |
| 871 | */ |
| 872 | static int utimeCmd( |
| 873 | Th_Interp *interp, |
| 874 | void *p, |
| 875 | int argc, |
| 876 | const char **argv, |
| 877 | int *argl |
| 878 | ){ |
| 879 | sqlite3_uint64 x; |
| 880 | char zUTime[50]; |
| 881 | getCpuTimes(&x, 0); |
| @@ -890,13 +890,13 @@ | |
| 890 | ** Return the number of microseconds of CPU time consumed by the current |
| 891 | ** process in system space. |
| 892 | */ |
| 893 | static int stimeCmd( |
| 894 | Th_Interp *interp, |
| 895 | void *p, |
| 896 | int argc, |
| 897 | const char **argv, |
| 898 | int *argl |
| 899 | ){ |
| 900 | sqlite3_uint64 x; |
| 901 | char zUTime[50]; |
| 902 | getCpuTimes(0, &x); |
| @@ -907,18 +907,18 @@ | |
| 907 | |
| 908 | |
| 909 | /* |
| 910 | ** TH1 command: randhex N |
| 911 | ** |
| 912 | ** Return N*2 random hexadecimal digits with N<50. If N is omitted, |
| 913 | ** use a value of 10. |
| 914 | */ |
| 915 | static int randhexCmd( |
| 916 | Th_Interp *interp, |
| 917 | void *p, |
| 918 | int argc, |
| 919 | const char **argv, |
| 920 | int *argl |
| 921 | ){ |
| 922 | int n; |
| 923 | unsigned char aRand[50]; |
| 924 | unsigned char zOut[100]; |
| @@ -950,13 +950,13 @@ | |
| 950 | ** "var". Result values are stored in variables with the column name prior |
| 951 | ** to each invocation of CODE. |
| 952 | */ |
| 953 | static int queryCmd( |
| 954 | Th_Interp *interp, |
| 955 | void *p, |
| 956 | int argc, |
| 957 | const char **argv, |
| 958 | int *argl |
| 959 | ){ |
| 960 | sqlite3_stmt *pStmt; |
| 961 | int rc; |
| 962 | const char *zSql; |
| @@ -1016,11 +1016,11 @@ | |
| 1016 | rc = sqlite3_finalize(pStmt); |
| 1017 | if( rc!=SQLITE_OK ){ |
| 1018 | Th_ErrorMessage(interp, "SQL error: ", sqlite3_errmsg(g.db), -1); |
| 1019 | return TH_ERROR; |
| 1020 | } |
| 1021 | } |
| 1022 | return res; |
| 1023 | } |
| 1024 | |
| 1025 | /* |
| 1026 | ** TH1 command: setting name |
| @@ -1691,11 +1691,11 @@ | |
| 1691 | } |
| 1692 | #endif |
| 1693 | |
| 1694 | /* |
| 1695 | ** The z[] input contains text mixed with TH1 scripts. |
| 1696 | ** The TH1 scripts are contained within <th1>...</th1>. |
| 1697 | ** TH1 variables are $aaa or $<aaa>. The first form of |
| 1698 | ** variable is literal. The second is run through htmlize |
| 1699 | ** before being inserted. |
| 1700 | ** |
| 1701 | ** This routine processes the template and writes the results |
| 1702 |