Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch ticket-c8c0b78c84 Excluding Merge-Ins
This is equivalent to a diff from 9c0e1caec5 to be06861f3c
2012-09-03
| ||
00:24 | Fix dependencies on generated headers in the MinGW makefile. Also, remove superfluous EXE extension on executables used during the build process. check-in: 4e8d2f2991 user: mistachkin tags: trunk | |
2012-09-02
| ||
19:39 | Minor additional fixes related to [c8c0b78c84]: - Use _wsystem() in stead of system() on Windows - Use g.argv[0] in stead of fossil_nameofexe() where only printing is involved - Use fossil_nameofexe() where fossil_system() is involved - Move the determination of the full windows path to fossil_nameofexec, so g.argv[0] can always be the ... Closed-Leaf check-in: be06861f3c user: jan.nijtmans tags: ticket-c8c0b78c84 | |
12:50 | fix cross-compilation of mingw target on Linux/Darwin check-in: 9c0e1caec5 user: jan.nijtmans tags: trunk | |
2012-09-01
| ||
04:45 | Remove leftover instances of non-ASCII characters from several files. check-in: f15ce59b00 user: mistachkin tags: trunk | |
Changes to src/branch.c.
163 163 if( g.argc==3 ){ 164 164 fossil_print( 165 165 "\n" 166 166 "Note: the local check-out has not been updated to the new\n" 167 167 " branch. To begin working on the new branch, do this:\n" 168 168 "\n" 169 169 " %s update %s\n", 170 - fossil_nameofexe(), zBranch 170 + g.argv[0], zBranch 171 171 ); 172 172 } 173 173 174 174 175 175 /* Commit */ 176 176 db_end_transaction(0); 177 177
Changes to src/cgi.c.
1296 1296 listen(listener,10); 1297 1297 if( iPort>mnPort ){ 1298 1298 fossil_print("Listening for HTTP requests on TCP port %d\n", iPort); 1299 1299 fflush(stdout); 1300 1300 } 1301 1301 if( zBrowser ){ 1302 1302 zBrowser = mprintf(zBrowser, iPort); 1303 - if( system(zBrowser)<0 ){ 1303 + if( fossil_system(zBrowser)<0 ){ 1304 1304 fossil_warning("cannot start browser: %s\n", zBrowser); 1305 1305 } 1306 1306 } 1307 1307 while( 1 ){ 1308 1308 if( nchildren>MAX_PARALLEL ){ 1309 1309 /* Slow down if connections are arriving too fast */ 1310 1310 sleep( nchildren-MAX_PARALLEL );
Changes to src/configure.c.
911 911 }else if( fossil_strcmp(zName,"@reportfmt")==0 ){ 912 912 db_multi_exec("DELETE FROM reportfmt"); 913 913 } 914 914 } 915 915 db_end_transaction(0); 916 916 fossil_print("Configuration reset to factory defaults.\n"); 917 917 fossil_print("To recover, use: %s %s import %s\n", 918 - fossil_nameofexe(), g.argv[1], zBackup); 918 + g.argv[0], g.argv[1], zBackup); 919 919 }else 920 920 { 921 921 fossil_fatal("METHOD should be one of:" 922 922 " export import merge pull push reset"); 923 923 } 924 924 }
Changes to src/db.c.
90 90 } 91 91 else if( g.cgiOutput ){ 92 92 g.cgiOutput = 0; 93 93 cgi_printf("<h1>Database Error</h1>\n" 94 94 "<pre>%h</pre><p>%s</p>", z, zRebuildMsg); 95 95 cgi_reply(); 96 96 }else{ 97 - fprintf(stderr, "%s: %s\n\n%s", fossil_nameofexe(), z, zRebuildMsg); 97 + char *zOut = mprintf("%s: %s\n\n%s", g.argv[0], z, zRebuildMsg); 98 + fossil_puts(zOut, 1); 99 + free(zOut); 98 100 } 99 101 free(z); 100 102 db_force_rollback(); 101 103 fossil_exit(rc); 102 104 } 103 105 104 106 /*
Changes to src/json.c.
346 346 int const rc = cson_array_append( g.json.gc.a, v ); 347 347 assert( NULL != g.json.gc.a ); 348 348 if( 0 != rc ){ 349 349 cson_value_free( v ); 350 350 } 351 351 assert( (0==rc) && "Adding item to GC failed." ); 352 352 if(0!=rc){ 353 - fprintf(stderr,"%s: FATAL: alloc error.\n", fossil_nameofexe()) 353 + fprintf(stderr,"%s: FATAL: alloc error.\n", g.argv[0]) 354 354 /* reminder: allocation error is the only reasonable cause of 355 355 error here, provided g.json.gc.a and v are not NULL. 356 356 */ 357 357 ; 358 358 fossil_exit(1)/*not fossil_panic() b/c it might land us somewhere 359 359 where this function is called again. 360 360 */; ................................................................................ 1626 1626 } 1627 1627 resp = json_create_response(rc, msg, NULL); 1628 1628 if(!resp){ 1629 1629 /* about the only error case here is out-of-memory. DO NOT 1630 1630 call fossil_panic() here because that calls this function. 1631 1631 */ 1632 1632 fprintf(stderr, "%s: Fatal error: could not allocate " 1633 - "response object.\n", fossil_nameofexe()); 1633 + "response object.\n", g.argv[0]); 1634 1634 fossil_exit(1); 1635 1635 } 1636 1636 if( g.isHTTP ){ 1637 1637 if(alsoOutput){ 1638 1638 json_send_response(resp); 1639 1639 }else{ 1640 1640 /* almost a duplicate of json_send_response() :( */
Changes to src/main.c.
350 350 unsigned int i, j, k; /* Loop counters */ 351 351 int n; /* Number of bytes in one line */ 352 352 char *z; /* General use string pointer */ 353 353 char **newArgv; /* New expanded g.argv under construction */ 354 354 char const * zFileName; /* input file name */ 355 355 FILE * zInFile; /* input FILE */ 356 356 int foundBom = -1; /* -1= not searched yet, 0 = no; 1=yes */ 357 -#ifdef _WIN32 358 - wchar_t buf[MAX_PATH]; 359 -#endif 360 357 361 358 g.argc = argc; 362 359 g.argv = argv; 363 -#ifdef _WIN32 364 - GetModuleFileNameW(NULL, buf, MAX_PATH); 365 - g.argv[0] = fossil_unicode_to_utf8(buf); 366 - for(i=1; i<g.argc; i++) g.argv[i] = fossil_mbcs_to_utf8(g.argv[i]); 367 -#endif 360 + for(i=0; i<g.argc; i++) g.argv[i] = fossil_mbcs_to_utf8(g.argv[i]); 368 361 for(i=1; i<g.argc-1; i++){ 369 362 z = g.argv[i]; 370 363 if( z[0]!='-' ) continue; 371 364 z++; 372 365 if( z[0]=='-' ) z++; 373 366 if( z[0]==0 ) return; /* Stop searching at "--" */ 374 367 if( fossil_strcmp(z, "args")==0 ) break; ................................................................................ 533 526 */ 534 527 static int mainInFatalError = 0; 535 528 536 529 /* 537 530 ** Return the name of the current executable. 538 531 */ 539 532 const char *fossil_nameofexe(void){ 533 +#ifdef _WIN32 534 + static const char *z = 0; 535 + if (!z) { 536 + wchar_t buf[MAX_PATH]; 537 + GetModuleFileNameW(NULL, buf, MAX_PATH); 538 + z = fossil_unicode_to_utf8(buf); 539 + } 540 + return z; 541 +#else 540 542 return g.argv[0]; 543 +#endif 541 544 } 542 545 543 546 /* 544 547 ** Exit. Take care to close the database first. 545 548 */ 546 549 NORETURN void fossil_exit(int rc){ 547 550 db_close(1); ................................................................................ 572 575 #endif 573 576 { 574 577 if( g.cgiOutput && once ){ 575 578 once = 0; 576 579 cgi_printf("<p class=\"generalError\">%h</p>", z); 577 580 cgi_reply(); 578 581 }else if( !g.fQuiet ){ 579 - char *zOut = mprintf("%s: %s\n", fossil_nameofexe(), z); 582 + char *zOut = mprintf("%s: %s\n", g.argv[0], z); 580 583 fossil_puts(zOut, 1); 584 + free(zOut); 581 585 } 582 586 } 583 587 free(z); 584 588 db_force_rollback(); 585 589 fossil_exit(rc); 586 590 } 587 591 ................................................................................ 604 608 #endif 605 609 { 606 610 if( g.cgiOutput ){ 607 611 g.cgiOutput = 0; 608 612 cgi_printf("<p class=\"generalError\">%h</p>", z); 609 613 cgi_reply(); 610 614 }else if( !g.fQuiet ){ 611 - char *zOut = mprintf("\r%s: %s\n", fossil_nameofexe(), z); 615 + char *zOut = mprintf("\r%s: %s\n", g.argv[0], z); 612 616 fossil_puts(zOut, 1); 617 + free(zOut); 613 618 } 614 619 } 615 620 free(z); 616 621 db_force_rollback(); 617 622 fossil_exit(rc); 618 623 } 619 624 ................................................................................ 645 650 #endif 646 651 { 647 652 if( g.cgiOutput ){ 648 653 g.cgiOutput = 0; 649 654 cgi_printf("<p class=\"generalError\">%h</p>", z); 650 655 cgi_reply(); 651 656 }else{ 652 - char *zOut = mprintf("\r%s: %s\n", fossil_nameofexe(), z); 657 + char *zOut = mprintf("\r%s: %s\n", g.argv[0], z); 653 658 fossil_puts(zOut, 1); 654 659 free(zOut); 655 660 } 656 661 } 657 662 db_force_rollback(); 658 663 fossil_exit(rc); 659 664 } ................................................................................ 671 676 json_warn( FSL_JSON_W_UNKNOWN, z ); 672 677 }else 673 678 #endif 674 679 { 675 680 if( g.cgiOutput ){ 676 681 cgi_printf("<p class=\"generalError\">%h</p>", z); 677 682 }else{ 678 - char *zOut = mprintf("\r%s: %s\n", fossil_nameofexe(), z); 683 + char *zOut = mprintf("\r%s: %s\n", g.argv[0], z); 679 684 fossil_puts(zOut, 1); 680 685 free(zOut); 681 686 } 682 687 } 683 688 free(z); 684 689 } 685 690 ................................................................................ 706 711 int fossil_system(const char *zOrigCmd){ 707 712 int rc; 708 713 #if defined(_WIN32) 709 714 /* On windows, we have to put double-quotes around the entire command. 710 715 ** Who knows why - this is just the way windows works. 711 716 */ 712 717 char *zNewCmd = mprintf("\"%s\"", zOrigCmd); 713 - char *zMbcs = fossil_utf8_to_mbcs(zNewCmd); 714 - if( g.fSystemTrace ) fprintf(stderr, "SYSTEM: %s\n", zMbcs); 715 - rc = system(zMbcs); 716 - fossil_mbcs_free(zMbcs); 718 + wchar_t *zUnicode = fossil_utf8_to_unicode(zNewCmd); 719 + if( g.fSystemTrace ) { 720 + char *zOut = mprintf("SYSTEM: %s\n", zNewCmd); 721 + fossil_puts(zOut, 1); 722 + free(zOut); 723 + } 724 + rc = _wsystem(zUnicode); 725 + fossil_mbcs_free(zUnicode); 717 726 free(zNewCmd); 718 727 #else 719 728 /* On unix, evaluate the command directly. 720 729 */ 721 730 if( g.fSystemTrace ) fprintf(stderr, "SYSTEM: %s\n", zOrigCmd); 722 731 rc = system(zOrigCmd); 723 732 #endif ................................................................................ 779 788 fossil_warning("%s: %s", sqlite_error_code_name(iCode), zErrmsg); 780 789 } 781 790 782 791 /* 783 792 ** Print a usage comment and quit 784 793 */ 785 794 void usage(const char *zFormat){ 786 - fossil_fatal("Usage: %s %s %s\n", fossil_nameofexe(), g.argv[1], zFormat); 795 + fossil_fatal("Usage: %s %s %s\n", g.argv[0], g.argv[1], zFormat); 787 796 } 788 797 789 798 /* 790 799 ** Remove n elements from g.argv beginning with the i-th element. 791 800 */ 792 801 void remove_from_argv(int i, int n){ 793 802 int j; ................................................................................ 940 949 ** %fossil help --test Show test commands only 941 950 ** %fossil help --aux Show auxiliary commands only 942 951 */ 943 952 void help_cmd(void){ 944 953 int rc, idx; 945 954 const char *z; 946 955 if( g.argc<3 ){ 947 - z = fossil_nameofexe(); 956 + z = g.argv[0]; 948 957 fossil_print( 949 958 "Usage: %s help COMMAND\n" 950 959 "Common COMMANDs: (use \"%s help --all\" for a complete list)\n", 951 960 z, z); 952 961 command_list(0, CMDFLAG_1ST_TIER); 953 962 version_cmd(); 954 963 return; ................................................................................ 979 988 z = aCmdHelp[idx]; 980 989 if( z==0 ){ 981 990 fossil_fatal("no help available for the %s command", 982 991 aCommand[idx].zName); 983 992 } 984 993 while( *z ){ 985 994 if( *z=='%' && strncmp(z, "%fossil", 7)==0 ){ 986 - fossil_print("%s", fossil_nameofexe()); 995 + fossil_print("%s", g.argv[0]); 987 996 z += 7; 988 997 }else{ 989 998 putchar(*z); 990 999 z++; 991 1000 } 992 1001 } 993 1002 putchar('\n');