Fossil SCM

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 unmodified argv[0] - g.argv[0] and fossil_nameofexec() are in utf-8, so we cannot use fprintf directly. Exception: when printing malloc errors.

jan.nijtmans 2012-09-02 19:39 UTC trunk
Commit be06861f3cc1f16a3b15e2430cf2b3a0bfb7b42f
+1 -1
--- src/branch.c
+++ src/branch.c
@@ -165,11 +165,11 @@
165165
"\n"
166166
"Note: the local check-out has not been updated to the new\n"
167167
" branch. To begin working on the new branch, do this:\n"
168168
"\n"
169169
" %s update %s\n",
170
- fossil_nameofexe(), zBranch
170
+ g.argv[0], zBranch
171171
);
172172
}
173173
174174
175175
/* Commit */
176176
--- src/branch.c
+++ src/branch.c
@@ -165,11 +165,11 @@
165 "\n"
166 "Note: the local check-out has not been updated to the new\n"
167 " branch. To begin working on the new branch, do this:\n"
168 "\n"
169 " %s update %s\n",
170 fossil_nameofexe(), zBranch
171 );
172 }
173
174
175 /* Commit */
176
--- src/branch.c
+++ src/branch.c
@@ -165,11 +165,11 @@
165 "\n"
166 "Note: the local check-out has not been updated to the new\n"
167 " branch. To begin working on the new branch, do this:\n"
168 "\n"
169 " %s update %s\n",
170 g.argv[0], zBranch
171 );
172 }
173
174
175 /* Commit */
176
+1 -1
--- src/cgi.c
+++ src/cgi.c
@@ -1298,11 +1298,11 @@
12981298
fossil_print("Listening for HTTP requests on TCP port %d\n", iPort);
12991299
fflush(stdout);
13001300
}
13011301
if( zBrowser ){
13021302
zBrowser = mprintf(zBrowser, iPort);
1303
- if( system(zBrowser)<0 ){
1303
+ if( fossil_system(zBrowser)<0 ){
13041304
fossil_warning("cannot start browser: %s\n", zBrowser);
13051305
}
13061306
}
13071307
while( 1 ){
13081308
if( nchildren>MAX_PARALLEL ){
13091309
--- src/cgi.c
+++ src/cgi.c
@@ -1298,11 +1298,11 @@
1298 fossil_print("Listening for HTTP requests on TCP port %d\n", iPort);
1299 fflush(stdout);
1300 }
1301 if( zBrowser ){
1302 zBrowser = mprintf(zBrowser, iPort);
1303 if( system(zBrowser)<0 ){
1304 fossil_warning("cannot start browser: %s\n", zBrowser);
1305 }
1306 }
1307 while( 1 ){
1308 if( nchildren>MAX_PARALLEL ){
1309
--- src/cgi.c
+++ src/cgi.c
@@ -1298,11 +1298,11 @@
1298 fossil_print("Listening for HTTP requests on TCP port %d\n", iPort);
1299 fflush(stdout);
1300 }
1301 if( zBrowser ){
1302 zBrowser = mprintf(zBrowser, iPort);
1303 if( fossil_system(zBrowser)<0 ){
1304 fossil_warning("cannot start browser: %s\n", zBrowser);
1305 }
1306 }
1307 while( 1 ){
1308 if( nchildren>MAX_PARALLEL ){
1309
+1 -1
--- src/configure.c
+++ src/configure.c
@@ -913,11 +913,11 @@
913913
}
914914
}
915915
db_end_transaction(0);
916916
fossil_print("Configuration reset to factory defaults.\n");
917917
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);
919919
}else
920920
{
921921
fossil_fatal("METHOD should be one of:"
922922
" export import merge pull push reset");
923923
}
924924
--- src/configure.c
+++ src/configure.c
@@ -913,11 +913,11 @@
913 }
914 }
915 db_end_transaction(0);
916 fossil_print("Configuration reset to factory defaults.\n");
917 fossil_print("To recover, use: %s %s import %s\n",
918 fossil_nameofexe(), g.argv[1], zBackup);
919 }else
920 {
921 fossil_fatal("METHOD should be one of:"
922 " export import merge pull push reset");
923 }
924
--- src/configure.c
+++ src/configure.c
@@ -913,11 +913,11 @@
913 }
914 }
915 db_end_transaction(0);
916 fossil_print("Configuration reset to factory defaults.\n");
917 fossil_print("To recover, use: %s %s import %s\n",
918 g.argv[0], g.argv[1], zBackup);
919 }else
920 {
921 fossil_fatal("METHOD should be one of:"
922 " export import merge pull push reset");
923 }
924
+3 -1
--- src/db.c
+++ src/db.c
@@ -92,11 +92,13 @@
9292
g.cgiOutput = 0;
9393
cgi_printf("<h1>Database Error</h1>\n"
9494
"<pre>%h</pre><p>%s</p>", z, zRebuildMsg);
9595
cgi_reply();
9696
}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);
98100
}
99101
free(z);
100102
db_force_rollback();
101103
fossil_exit(rc);
102104
}
103105
--- src/db.c
+++ src/db.c
@@ -92,11 +92,13 @@
92 g.cgiOutput = 0;
93 cgi_printf("<h1>Database Error</h1>\n"
94 "<pre>%h</pre><p>%s</p>", z, zRebuildMsg);
95 cgi_reply();
96 }else{
97 fprintf(stderr, "%s: %s\n\n%s", fossil_nameofexe(), z, zRebuildMsg);
 
 
98 }
99 free(z);
100 db_force_rollback();
101 fossil_exit(rc);
102 }
103
--- src/db.c
+++ src/db.c
@@ -92,11 +92,13 @@
92 g.cgiOutput = 0;
93 cgi_printf("<h1>Database Error</h1>\n"
94 "<pre>%h</pre><p>%s</p>", z, zRebuildMsg);
95 cgi_reply();
96 }else{
97 char *zOut = mprintf("%s: %s\n\n%s", g.argv[0], z, zRebuildMsg);
98 fossil_puts(zOut, 1);
99 free(zOut);
100 }
101 free(z);
102 db_force_rollback();
103 fossil_exit(rc);
104 }
105
+2 -2
--- src/json.c
+++ src/json.c
@@ -348,11 +348,11 @@
348348
if( 0 != rc ){
349349
cson_value_free( v );
350350
}
351351
assert( (0==rc) && "Adding item to GC failed." );
352352
if(0!=rc){
353
- fprintf(stderr,"%s: FATAL: alloc error.\n", fossil_nameofexe())
353
+ fprintf(stderr,"%s: FATAL: alloc error.\n", g.argv[0])
354354
/* reminder: allocation error is the only reasonable cause of
355355
error here, provided g.json.gc.a and v are not NULL.
356356
*/
357357
;
358358
fossil_exit(1)/*not fossil_panic() b/c it might land us somewhere
@@ -1628,11 +1628,11 @@
16281628
if(!resp){
16291629
/* about the only error case here is out-of-memory. DO NOT
16301630
call fossil_panic() here because that calls this function.
16311631
*/
16321632
fprintf(stderr, "%s: Fatal error: could not allocate "
1633
- "response object.\n", fossil_nameofexe());
1633
+ "response object.\n", g.argv[0]);
16341634
fossil_exit(1);
16351635
}
16361636
if( g.isHTTP ){
16371637
if(alsoOutput){
16381638
json_send_response(resp);
16391639
--- src/json.c
+++ src/json.c
@@ -348,11 +348,11 @@
348 if( 0 != rc ){
349 cson_value_free( v );
350 }
351 assert( (0==rc) && "Adding item to GC failed." );
352 if(0!=rc){
353 fprintf(stderr,"%s: FATAL: alloc error.\n", fossil_nameofexe())
354 /* reminder: allocation error is the only reasonable cause of
355 error here, provided g.json.gc.a and v are not NULL.
356 */
357 ;
358 fossil_exit(1)/*not fossil_panic() b/c it might land us somewhere
@@ -1628,11 +1628,11 @@
1628 if(!resp){
1629 /* about the only error case here is out-of-memory. DO NOT
1630 call fossil_panic() here because that calls this function.
1631 */
1632 fprintf(stderr, "%s: Fatal error: could not allocate "
1633 "response object.\n", fossil_nameofexe());
1634 fossil_exit(1);
1635 }
1636 if( g.isHTTP ){
1637 if(alsoOutput){
1638 json_send_response(resp);
1639
--- src/json.c
+++ src/json.c
@@ -348,11 +348,11 @@
348 if( 0 != rc ){
349 cson_value_free( v );
350 }
351 assert( (0==rc) && "Adding item to GC failed." );
352 if(0!=rc){
353 fprintf(stderr,"%s: FATAL: alloc error.\n", g.argv[0])
354 /* reminder: allocation error is the only reasonable cause of
355 error here, provided g.json.gc.a and v are not NULL.
356 */
357 ;
358 fossil_exit(1)/*not fossil_panic() b/c it might land us somewhere
@@ -1628,11 +1628,11 @@
1628 if(!resp){
1629 /* about the only error case here is out-of-memory. DO NOT
1630 call fossil_panic() here because that calls this function.
1631 */
1632 fprintf(stderr, "%s: Fatal error: could not allocate "
1633 "response object.\n", g.argv[0]);
1634 fossil_exit(1);
1635 }
1636 if( g.isHTTP ){
1637 if(alsoOutput){
1638 json_send_response(resp);
1639
+28 -19
--- src/main.c
+++ src/main.c
@@ -352,21 +352,14 @@
352352
char *z; /* General use string pointer */
353353
char **newArgv; /* New expanded g.argv under construction */
354354
char const * zFileName; /* input file name */
355355
FILE * zInFile; /* input FILE */
356356
int foundBom = -1; /* -1= not searched yet, 0 = no; 1=yes */
357
-#ifdef _WIN32
358
- wchar_t buf[MAX_PATH];
359
-#endif
360357
361358
g.argc = argc;
362359
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]);
368361
for(i=1; i<g.argc-1; i++){
369362
z = g.argv[i];
370363
if( z[0]!='-' ) continue;
371364
z++;
372365
if( z[0]=='-' ) z++;
@@ -535,11 +528,21 @@
535528
536529
/*
537530
** Return the name of the current executable.
538531
*/
539532
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
540542
return g.argv[0];
543
+#endif
541544
}
542545
543546
/*
544547
** Exit. Take care to close the database first.
545548
*/
@@ -574,12 +577,13 @@
574577
if( g.cgiOutput && once ){
575578
once = 0;
576579
cgi_printf("<p class=\"generalError\">%h</p>", z);
577580
cgi_reply();
578581
}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);
580583
fossil_puts(zOut, 1);
584
+ free(zOut);
581585
}
582586
}
583587
free(z);
584588
db_force_rollback();
585589
fossil_exit(rc);
@@ -606,12 +610,13 @@
606610
if( g.cgiOutput ){
607611
g.cgiOutput = 0;
608612
cgi_printf("<p class=\"generalError\">%h</p>", z);
609613
cgi_reply();
610614
}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);
612616
fossil_puts(zOut, 1);
617
+ free(zOut);
613618
}
614619
}
615620
free(z);
616621
db_force_rollback();
617622
fossil_exit(rc);
@@ -647,11 +652,11 @@
647652
if( g.cgiOutput ){
648653
g.cgiOutput = 0;
649654
cgi_printf("<p class=\"generalError\">%h</p>", z);
650655
cgi_reply();
651656
}else{
652
- char *zOut = mprintf("\r%s: %s\n", fossil_nameofexe(), z);
657
+ char *zOut = mprintf("\r%s: %s\n", g.argv[0], z);
653658
fossil_puts(zOut, 1);
654659
free(zOut);
655660
}
656661
}
657662
db_force_rollback();
@@ -673,11 +678,11 @@
673678
#endif
674679
{
675680
if( g.cgiOutput ){
676681
cgi_printf("<p class=\"generalError\">%h</p>", z);
677682
}else{
678
- char *zOut = mprintf("\r%s: %s\n", fossil_nameofexe(), z);
683
+ char *zOut = mprintf("\r%s: %s\n", g.argv[0], z);
679684
fossil_puts(zOut, 1);
680685
free(zOut);
681686
}
682687
}
683688
free(z);
@@ -708,14 +713,18 @@
708713
#if defined(_WIN32)
709714
/* On windows, we have to put double-quotes around the entire command.
710715
** Who knows why - this is just the way windows works.
711716
*/
712717
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);
717726
free(zNewCmd);
718727
#else
719728
/* On unix, evaluate the command directly.
720729
*/
721730
if( g.fSystemTrace ) fprintf(stderr, "SYSTEM: %s\n", zOrigCmd);
@@ -781,11 +790,11 @@
781790
782791
/*
783792
** Print a usage comment and quit
784793
*/
785794
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);
787796
}
788797
789798
/*
790799
** Remove n elements from g.argv beginning with the i-th element.
791800
*/
@@ -942,11 +951,11 @@
942951
*/
943952
void help_cmd(void){
944953
int rc, idx;
945954
const char *z;
946955
if( g.argc<3 ){
947
- z = fossil_nameofexe();
956
+ z = g.argv[0];
948957
fossil_print(
949958
"Usage: %s help COMMAND\n"
950959
"Common COMMANDs: (use \"%s help --all\" for a complete list)\n",
951960
z, z);
952961
command_list(0, CMDFLAG_1ST_TIER);
@@ -981,11 +990,11 @@
981990
fossil_fatal("no help available for the %s command",
982991
aCommand[idx].zName);
983992
}
984993
while( *z ){
985994
if( *z=='%' && strncmp(z, "%fossil", 7)==0 ){
986
- fossil_print("%s", fossil_nameofexe());
995
+ fossil_print("%s", g.argv[0]);
987996
z += 7;
988997
}else{
989998
putchar(*z);
990999
z++;
9911000
}
9921001
--- src/main.c
+++ src/main.c
@@ -352,21 +352,14 @@
352 char *z; /* General use string pointer */
353 char **newArgv; /* New expanded g.argv under construction */
354 char const * zFileName; /* input file name */
355 FILE * zInFile; /* input FILE */
356 int foundBom = -1; /* -1= not searched yet, 0 = no; 1=yes */
357 #ifdef _WIN32
358 wchar_t buf[MAX_PATH];
359 #endif
360
361 g.argc = argc;
362 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
368 for(i=1; i<g.argc-1; i++){
369 z = g.argv[i];
370 if( z[0]!='-' ) continue;
371 z++;
372 if( z[0]=='-' ) z++;
@@ -535,11 +528,21 @@
535
536 /*
537 ** Return the name of the current executable.
538 */
539 const char *fossil_nameofexe(void){
 
 
 
 
 
 
 
 
 
540 return g.argv[0];
 
541 }
542
543 /*
544 ** Exit. Take care to close the database first.
545 */
@@ -574,12 +577,13 @@
574 if( g.cgiOutput && once ){
575 once = 0;
576 cgi_printf("<p class=\"generalError\">%h</p>", z);
577 cgi_reply();
578 }else if( !g.fQuiet ){
579 char *zOut = mprintf("%s: %s\n", fossil_nameofexe(), z);
580 fossil_puts(zOut, 1);
 
581 }
582 }
583 free(z);
584 db_force_rollback();
585 fossil_exit(rc);
@@ -606,12 +610,13 @@
606 if( g.cgiOutput ){
607 g.cgiOutput = 0;
608 cgi_printf("<p class=\"generalError\">%h</p>", z);
609 cgi_reply();
610 }else if( !g.fQuiet ){
611 char *zOut = mprintf("\r%s: %s\n", fossil_nameofexe(), z);
612 fossil_puts(zOut, 1);
 
613 }
614 }
615 free(z);
616 db_force_rollback();
617 fossil_exit(rc);
@@ -647,11 +652,11 @@
647 if( g.cgiOutput ){
648 g.cgiOutput = 0;
649 cgi_printf("<p class=\"generalError\">%h</p>", z);
650 cgi_reply();
651 }else{
652 char *zOut = mprintf("\r%s: %s\n", fossil_nameofexe(), z);
653 fossil_puts(zOut, 1);
654 free(zOut);
655 }
656 }
657 db_force_rollback();
@@ -673,11 +678,11 @@
673 #endif
674 {
675 if( g.cgiOutput ){
676 cgi_printf("<p class=\"generalError\">%h</p>", z);
677 }else{
678 char *zOut = mprintf("\r%s: %s\n", fossil_nameofexe(), z);
679 fossil_puts(zOut, 1);
680 free(zOut);
681 }
682 }
683 free(z);
@@ -708,14 +713,18 @@
708 #if defined(_WIN32)
709 /* On windows, we have to put double-quotes around the entire command.
710 ** Who knows why - this is just the way windows works.
711 */
712 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);
 
 
 
 
717 free(zNewCmd);
718 #else
719 /* On unix, evaluate the command directly.
720 */
721 if( g.fSystemTrace ) fprintf(stderr, "SYSTEM: %s\n", zOrigCmd);
@@ -781,11 +790,11 @@
781
782 /*
783 ** Print a usage comment and quit
784 */
785 void usage(const char *zFormat){
786 fossil_fatal("Usage: %s %s %s\n", fossil_nameofexe(), g.argv[1], zFormat);
787 }
788
789 /*
790 ** Remove n elements from g.argv beginning with the i-th element.
791 */
@@ -942,11 +951,11 @@
942 */
943 void help_cmd(void){
944 int rc, idx;
945 const char *z;
946 if( g.argc<3 ){
947 z = fossil_nameofexe();
948 fossil_print(
949 "Usage: %s help COMMAND\n"
950 "Common COMMANDs: (use \"%s help --all\" for a complete list)\n",
951 z, z);
952 command_list(0, CMDFLAG_1ST_TIER);
@@ -981,11 +990,11 @@
981 fossil_fatal("no help available for the %s command",
982 aCommand[idx].zName);
983 }
984 while( *z ){
985 if( *z=='%' && strncmp(z, "%fossil", 7)==0 ){
986 fossil_print("%s", fossil_nameofexe());
987 z += 7;
988 }else{
989 putchar(*z);
990 z++;
991 }
992
--- src/main.c
+++ src/main.c
@@ -352,21 +352,14 @@
352 char *z; /* General use string pointer */
353 char **newArgv; /* New expanded g.argv under construction */
354 char const * zFileName; /* input file name */
355 FILE * zInFile; /* input FILE */
356 int foundBom = -1; /* -1= not searched yet, 0 = no; 1=yes */
 
 
 
357
358 g.argc = argc;
359 g.argv = argv;
360 for(i=0; i<g.argc; i++) g.argv[i] = fossil_mbcs_to_utf8(g.argv[i]);
 
 
 
 
361 for(i=1; i<g.argc-1; i++){
362 z = g.argv[i];
363 if( z[0]!='-' ) continue;
364 z++;
365 if( z[0]=='-' ) z++;
@@ -535,11 +528,21 @@
528
529 /*
530 ** Return the name of the current executable.
531 */
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
542 return g.argv[0];
543 #endif
544 }
545
546 /*
547 ** Exit. Take care to close the database first.
548 */
@@ -574,12 +577,13 @@
577 if( g.cgiOutput && once ){
578 once = 0;
579 cgi_printf("<p class=\"generalError\">%h</p>", z);
580 cgi_reply();
581 }else if( !g.fQuiet ){
582 char *zOut = mprintf("%s: %s\n", g.argv[0], z);
583 fossil_puts(zOut, 1);
584 free(zOut);
585 }
586 }
587 free(z);
588 db_force_rollback();
589 fossil_exit(rc);
@@ -606,12 +610,13 @@
610 if( g.cgiOutput ){
611 g.cgiOutput = 0;
612 cgi_printf("<p class=\"generalError\">%h</p>", z);
613 cgi_reply();
614 }else if( !g.fQuiet ){
615 char *zOut = mprintf("\r%s: %s\n", g.argv[0], z);
616 fossil_puts(zOut, 1);
617 free(zOut);
618 }
619 }
620 free(z);
621 db_force_rollback();
622 fossil_exit(rc);
@@ -647,11 +652,11 @@
652 if( g.cgiOutput ){
653 g.cgiOutput = 0;
654 cgi_printf("<p class=\"generalError\">%h</p>", z);
655 cgi_reply();
656 }else{
657 char *zOut = mprintf("\r%s: %s\n", g.argv[0], z);
658 fossil_puts(zOut, 1);
659 free(zOut);
660 }
661 }
662 db_force_rollback();
@@ -673,11 +678,11 @@
678 #endif
679 {
680 if( g.cgiOutput ){
681 cgi_printf("<p class=\"generalError\">%h</p>", z);
682 }else{
683 char *zOut = mprintf("\r%s: %s\n", g.argv[0], z);
684 fossil_puts(zOut, 1);
685 free(zOut);
686 }
687 }
688 free(z);
@@ -708,14 +713,18 @@
713 #if defined(_WIN32)
714 /* On windows, we have to put double-quotes around the entire command.
715 ** Who knows why - this is just the way windows works.
716 */
717 char *zNewCmd = mprintf("\"%s\"", zOrigCmd);
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);
726 free(zNewCmd);
727 #else
728 /* On unix, evaluate the command directly.
729 */
730 if( g.fSystemTrace ) fprintf(stderr, "SYSTEM: %s\n", zOrigCmd);
@@ -781,11 +790,11 @@
790
791 /*
792 ** Print a usage comment and quit
793 */
794 void usage(const char *zFormat){
795 fossil_fatal("Usage: %s %s %s\n", g.argv[0], g.argv[1], zFormat);
796 }
797
798 /*
799 ** Remove n elements from g.argv beginning with the i-th element.
800 */
@@ -942,11 +951,11 @@
951 */
952 void help_cmd(void){
953 int rc, idx;
954 const char *z;
955 if( g.argc<3 ){
956 z = g.argv[0];
957 fossil_print(
958 "Usage: %s help COMMAND\n"
959 "Common COMMANDs: (use \"%s help --all\" for a complete list)\n",
960 z, z);
961 command_list(0, CMDFLAG_1ST_TIER);
@@ -981,11 +990,11 @@
990 fossil_fatal("no help available for the %s command",
991 aCommand[idx].zName);
992 }
993 while( *z ){
994 if( *z=='%' && strncmp(z, "%fossil", 7)==0 ){
995 fossil_print("%s", g.argv[0]);
996 z += 7;
997 }else{
998 putchar(*z);
999 z++;
1000 }
1001

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button