Fossil SCM

merged in trunk [1e3cae806885d] and set up the json command/page to be elided when FOSSIL_DISABLE_JSON is defined at build time.

json-demo 2011-11-04 19:39 json-multitag-test merge
Commit 44bba06ce64e8b4958727d23d0cc05344ea1d950
+4
--- src/json.c
+++ src/json.c
@@ -2267,10 +2267,11 @@
22672267
/* Last entry MUST have a NULL name. */
22682268
{NULL,NULL,0}
22692269
};
22702270
22712271
2272
+#if !defined(FOSSIL_DISABLE_JSON)
22722273
/*
22732274
** WEBPAGE: json
22742275
**
22752276
** Pages under /json/... must be entered into JsonPageDefs.
22762277
** This function dispatches them, and is the HTTP equivalent of
@@ -2320,11 +2321,13 @@
23202321
blob_str(&cmdNames), 0);
23212322
blob_reset(&cmdNames);
23222323
}
23232324
23242325
}
2326
+#endif /* FOSSIL_DISABLE_JSON */
23252327
2328
+#if !defined(FOSSIL_DISABLE_JSON)
23262329
/*
23272330
** This function dispatches json commands and is the CLI equivalent of
23282331
** json_page_top().
23292332
**
23302333
** COMMAND: json
@@ -2414,11 +2417,12 @@
24142417
blob_str(&cmdNames), 1);
24152418
blob_reset(&cmdNames);
24162419
fossil_exit(1);
24172420
}
24182421
}
2422
+#endif /* FOSSIL_DISABLE_JSON */
24192423
24202424
#undef BITSET_BYTEFOR
24212425
#undef BITSET_SET
24222426
#undef BITSET_UNSET
24232427
#undef BITSET_GET
24242428
#undef BITSET_TOGGLE
24252429
--- src/json.c
+++ src/json.c
@@ -2267,10 +2267,11 @@
2267 /* Last entry MUST have a NULL name. */
2268 {NULL,NULL,0}
2269 };
2270
2271
 
2272 /*
2273 ** WEBPAGE: json
2274 **
2275 ** Pages under /json/... must be entered into JsonPageDefs.
2276 ** This function dispatches them, and is the HTTP equivalent of
@@ -2320,11 +2321,13 @@
2320 blob_str(&cmdNames), 0);
2321 blob_reset(&cmdNames);
2322 }
2323
2324 }
 
2325
 
2326 /*
2327 ** This function dispatches json commands and is the CLI equivalent of
2328 ** json_page_top().
2329 **
2330 ** COMMAND: json
@@ -2414,11 +2417,12 @@
2414 blob_str(&cmdNames), 1);
2415 blob_reset(&cmdNames);
2416 fossil_exit(1);
2417 }
2418 }
 
2419
2420 #undef BITSET_BYTEFOR
2421 #undef BITSET_SET
2422 #undef BITSET_UNSET
2423 #undef BITSET_GET
2424 #undef BITSET_TOGGLE
2425
--- src/json.c
+++ src/json.c
@@ -2267,10 +2267,11 @@
2267 /* Last entry MUST have a NULL name. */
2268 {NULL,NULL,0}
2269 };
2270
2271
2272 #if !defined(FOSSIL_DISABLE_JSON)
2273 /*
2274 ** WEBPAGE: json
2275 **
2276 ** Pages under /json/... must be entered into JsonPageDefs.
2277 ** This function dispatches them, and is the HTTP equivalent of
@@ -2320,11 +2321,13 @@
2321 blob_str(&cmdNames), 0);
2322 blob_reset(&cmdNames);
2323 }
2324
2325 }
2326 #endif /* FOSSIL_DISABLE_JSON */
2327
2328 #if !defined(FOSSIL_DISABLE_JSON)
2329 /*
2330 ** This function dispatches json commands and is the CLI equivalent of
2331 ** json_page_top().
2332 **
2333 ** COMMAND: json
@@ -2414,11 +2417,12 @@
2417 blob_str(&cmdNames), 1);
2418 blob_reset(&cmdNames);
2419 fossil_exit(1);
2420 }
2421 }
2422 #endif /* FOSSIL_DISABLE_JSON */
2423
2424 #undef BITSET_BYTEFOR
2425 #undef BITSET_SET
2426 #undef BITSET_UNSET
2427 #undef BITSET_GET
2428 #undef BITSET_TOGGLE
2429
+4
--- src/json.c
+++ src/json.c
@@ -2267,10 +2267,11 @@
22672267
/* Last entry MUST have a NULL name. */
22682268
{NULL,NULL,0}
22692269
};
22702270
22712271
2272
+#if !defined(FOSSIL_DISABLE_JSON)
22722273
/*
22732274
** WEBPAGE: json
22742275
**
22752276
** Pages under /json/... must be entered into JsonPageDefs.
22762277
** This function dispatches them, and is the HTTP equivalent of
@@ -2320,11 +2321,13 @@
23202321
blob_str(&cmdNames), 0);
23212322
blob_reset(&cmdNames);
23222323
}
23232324
23242325
}
2326
+#endif /* FOSSIL_DISABLE_JSON */
23252327
2328
+#if !defined(FOSSIL_DISABLE_JSON)
23262329
/*
23272330
** This function dispatches json commands and is the CLI equivalent of
23282331
** json_page_top().
23292332
**
23302333
** COMMAND: json
@@ -2414,11 +2417,12 @@
24142417
blob_str(&cmdNames), 1);
24152418
blob_reset(&cmdNames);
24162419
fossil_exit(1);
24172420
}
24182421
}
2422
+#endif /* FOSSIL_DISABLE_JSON */
24192423
24202424
#undef BITSET_BYTEFOR
24212425
#undef BITSET_SET
24222426
#undef BITSET_UNSET
24232427
#undef BITSET_GET
24242428
#undef BITSET_TOGGLE
24252429
--- src/json.c
+++ src/json.c
@@ -2267,10 +2267,11 @@
2267 /* Last entry MUST have a NULL name. */
2268 {NULL,NULL,0}
2269 };
2270
2271
 
2272 /*
2273 ** WEBPAGE: json
2274 **
2275 ** Pages under /json/... must be entered into JsonPageDefs.
2276 ** This function dispatches them, and is the HTTP equivalent of
@@ -2320,11 +2321,13 @@
2320 blob_str(&cmdNames), 0);
2321 blob_reset(&cmdNames);
2322 }
2323
2324 }
 
2325
 
2326 /*
2327 ** This function dispatches json commands and is the CLI equivalent of
2328 ** json_page_top().
2329 **
2330 ** COMMAND: json
@@ -2414,11 +2417,12 @@
2414 blob_str(&cmdNames), 1);
2415 blob_reset(&cmdNames);
2416 fossil_exit(1);
2417 }
2418 }
 
2419
2420 #undef BITSET_BYTEFOR
2421 #undef BITSET_SET
2422 #undef BITSET_UNSET
2423 #undef BITSET_GET
2424 #undef BITSET_TOGGLE
2425
--- src/json.c
+++ src/json.c
@@ -2267,10 +2267,11 @@
2267 /* Last entry MUST have a NULL name. */
2268 {NULL,NULL,0}
2269 };
2270
2271
2272 #if !defined(FOSSIL_DISABLE_JSON)
2273 /*
2274 ** WEBPAGE: json
2275 **
2276 ** Pages under /json/... must be entered into JsonPageDefs.
2277 ** This function dispatches them, and is the HTTP equivalent of
@@ -2320,11 +2321,13 @@
2321 blob_str(&cmdNames), 0);
2322 blob_reset(&cmdNames);
2323 }
2324
2325 }
2326 #endif /* FOSSIL_DISABLE_JSON */
2327
2328 #if !defined(FOSSIL_DISABLE_JSON)
2329 /*
2330 ** This function dispatches json commands and is the CLI equivalent of
2331 ** json_page_top().
2332 **
2333 ** COMMAND: json
@@ -2414,11 +2417,12 @@
2417 blob_str(&cmdNames), 1);
2418 blob_reset(&cmdNames);
2419 fossil_exit(1);
2420 }
2421 }
2422 #endif /* FOSSIL_DISABLE_JSON */
2423
2424 #undef BITSET_BYTEFOR
2425 #undef BITSET_SET
2426 #undef BITSET_UNSET
2427 #undef BITSET_GET
2428 #undef BITSET_TOGGLE
2429
+18 -29
--- src/main.c
+++ src/main.c
@@ -826,35 +826,10 @@
826826
if( zPrefix && memcmp(zPrefix, z, nPrefix)!=0 ) continue;
827827
aCmd[nCmd++] = aCommand[i].zName;
828828
}
829829
multi_column_list(aCmd, nCmd);
830830
}
831
-
832
-/*
833
-** COMMAND: commands
834
-**
835
-** Usage: %fossil commands ?--test? ?--all? ?--aux?
836
-**
837
-** List available commands. If the --test option is used list only unsupported
838
-** commands intended for testing and debugging. With --all, show all commands
839
-** including test debugging commands. With --aux, show only the auxiliary
840
-** and less often used commands, and/or command aliases.
841
-*/
842
-void cmd_command_list(void){
843
- int cmdFlags = CMDFLAG_1ST_TIER | CMDFLAG_2ND_TIER;
844
- if( find_option("all",0,0)!=0 ){
845
- cmdFlags |= CMDFLAG_TEST;
846
- }else if( find_option("test",0,0)!=0 ){
847
- cmdFlags = CMDFLAG_TEST;
848
- }else if( find_option("aux",0,0)!=0 ){
849
- cmdFlags = CMDFLAG_2ND_TIER;
850
- }else{
851
- fossil_print("Use --test or --all to see test and debug commands.\n");
852
- }
853
- command_list(0, cmdFlags);
854
-}
855
-
856831
857832
/*
858833
** COMMAND: test-list-webpage
859834
**
860835
** List all web pages
@@ -865,11 +840,10 @@
865840
for(i=nCmd=0; i<count(aWebpage); i++){
866841
aCmd[nCmd++] = aWebpage[i].zName;
867842
}
868843
multi_column_list(aCmd, nCmd);
869844
}
870
-
871845
872846
/*
873847
** COMMAND: version
874848
**
875849
** Usage: %fossil version
@@ -887,26 +861,41 @@
887861
**
888862
** Usage: %fossil help COMMAND
889863
** or: %fossil COMMAND -help
890864
**
891865
** Display information on how to use COMMAND. To display a list of
892
-** available commands use:
866
+** available commands one of:
893867
**
894
-** %fossil commands
868
+** %fossil help Show common commands
869
+** %fossil help --all Show both command and auxiliary commands
870
+** %fossil help --test Show test commands only
871
+** %fossil help --aux Show auxiliary commands only
895872
*/
896873
void help_cmd(void){
897874
int rc, idx;
898875
const char *z;
899876
if( g.argc<3 ){
900877
z = fossil_nameofexe();
901878
fossil_print(
902879
"Usage: %s help COMMAND\n"
903
- "Common COMMANDs: (use \"%s commands\" for a complete list)\n",
880
+ "Common COMMANDs: (use \"%s help --all\" for a complete list)\n",
904881
z, z);
905882
command_list(0, CMDFLAG_1ST_TIER);
906883
version_cmd();
907884
return;
885
+ }
886
+ if( find_option("all",0,0) ){
887
+ command_list(0, CMDFLAG_1ST_TIER | CMDFLAG_2ND_TIER);
888
+ return;
889
+ }
890
+ if( find_option("aux",0,0) ){
891
+ command_list(0, CMDFLAG_2ND_TIER);
892
+ return;
893
+ }
894
+ if( find_option("test",0,0) ){
895
+ command_list(0, CMDFLAG_TEST);
896
+ return;
908897
}
909898
rc = name_search(g.argv[2], aCommand, count(aCommand), &idx);
910899
if( rc==1 ){
911900
fossil_print("unknown command: %s\nAvailable commands:\n", g.argv[2]);
912901
command_list(0, 0xff);
913902
--- src/main.c
+++ src/main.c
@@ -826,35 +826,10 @@
826 if( zPrefix && memcmp(zPrefix, z, nPrefix)!=0 ) continue;
827 aCmd[nCmd++] = aCommand[i].zName;
828 }
829 multi_column_list(aCmd, nCmd);
830 }
831
832 /*
833 ** COMMAND: commands
834 **
835 ** Usage: %fossil commands ?--test? ?--all? ?--aux?
836 **
837 ** List available commands. If the --test option is used list only unsupported
838 ** commands intended for testing and debugging. With --all, show all commands
839 ** including test debugging commands. With --aux, show only the auxiliary
840 ** and less often used commands, and/or command aliases.
841 */
842 void cmd_command_list(void){
843 int cmdFlags = CMDFLAG_1ST_TIER | CMDFLAG_2ND_TIER;
844 if( find_option("all",0,0)!=0 ){
845 cmdFlags |= CMDFLAG_TEST;
846 }else if( find_option("test",0,0)!=0 ){
847 cmdFlags = CMDFLAG_TEST;
848 }else if( find_option("aux",0,0)!=0 ){
849 cmdFlags = CMDFLAG_2ND_TIER;
850 }else{
851 fossil_print("Use --test or --all to see test and debug commands.\n");
852 }
853 command_list(0, cmdFlags);
854 }
855
856
857 /*
858 ** COMMAND: test-list-webpage
859 **
860 ** List all web pages
@@ -865,11 +840,10 @@
865 for(i=nCmd=0; i<count(aWebpage); i++){
866 aCmd[nCmd++] = aWebpage[i].zName;
867 }
868 multi_column_list(aCmd, nCmd);
869 }
870
871
872 /*
873 ** COMMAND: version
874 **
875 ** Usage: %fossil version
@@ -887,26 +861,41 @@
887 **
888 ** Usage: %fossil help COMMAND
889 ** or: %fossil COMMAND -help
890 **
891 ** Display information on how to use COMMAND. To display a list of
892 ** available commands use:
893 **
894 ** %fossil commands
 
 
 
895 */
896 void help_cmd(void){
897 int rc, idx;
898 const char *z;
899 if( g.argc<3 ){
900 z = fossil_nameofexe();
901 fossil_print(
902 "Usage: %s help COMMAND\n"
903 "Common COMMANDs: (use \"%s commands\" for a complete list)\n",
904 z, z);
905 command_list(0, CMDFLAG_1ST_TIER);
906 version_cmd();
907 return;
 
 
 
 
 
 
 
 
 
 
 
 
908 }
909 rc = name_search(g.argv[2], aCommand, count(aCommand), &idx);
910 if( rc==1 ){
911 fossil_print("unknown command: %s\nAvailable commands:\n", g.argv[2]);
912 command_list(0, 0xff);
913
--- src/main.c
+++ src/main.c
@@ -826,35 +826,10 @@
826 if( zPrefix && memcmp(zPrefix, z, nPrefix)!=0 ) continue;
827 aCmd[nCmd++] = aCommand[i].zName;
828 }
829 multi_column_list(aCmd, nCmd);
830 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
831
832 /*
833 ** COMMAND: test-list-webpage
834 **
835 ** List all web pages
@@ -865,11 +840,10 @@
840 for(i=nCmd=0; i<count(aWebpage); i++){
841 aCmd[nCmd++] = aWebpage[i].zName;
842 }
843 multi_column_list(aCmd, nCmd);
844 }
 
845
846 /*
847 ** COMMAND: version
848 **
849 ** Usage: %fossil version
@@ -887,26 +861,41 @@
861 **
862 ** Usage: %fossil help COMMAND
863 ** or: %fossil COMMAND -help
864 **
865 ** Display information on how to use COMMAND. To display a list of
866 ** available commands one of:
867 **
868 ** %fossil help Show common commands
869 ** %fossil help --all Show both command and auxiliary commands
870 ** %fossil help --test Show test commands only
871 ** %fossil help --aux Show auxiliary commands only
872 */
873 void help_cmd(void){
874 int rc, idx;
875 const char *z;
876 if( g.argc<3 ){
877 z = fossil_nameofexe();
878 fossil_print(
879 "Usage: %s help COMMAND\n"
880 "Common COMMANDs: (use \"%s help --all\" for a complete list)\n",
881 z, z);
882 command_list(0, CMDFLAG_1ST_TIER);
883 version_cmd();
884 return;
885 }
886 if( find_option("all",0,0) ){
887 command_list(0, CMDFLAG_1ST_TIER | CMDFLAG_2ND_TIER);
888 return;
889 }
890 if( find_option("aux",0,0) ){
891 command_list(0, CMDFLAG_2ND_TIER);
892 return;
893 }
894 if( find_option("test",0,0) ){
895 command_list(0, CMDFLAG_TEST);
896 return;
897 }
898 rc = name_search(g.argv[2], aCommand, count(aCommand), &idx);
899 if( rc==1 ){
900 fossil_print("unknown command: %s\nAvailable commands:\n", g.argv[2]);
901 command_list(0, 0xff);
902
+18 -29
--- src/main.c
+++ src/main.c
@@ -826,35 +826,10 @@
826826
if( zPrefix && memcmp(zPrefix, z, nPrefix)!=0 ) continue;
827827
aCmd[nCmd++] = aCommand[i].zName;
828828
}
829829
multi_column_list(aCmd, nCmd);
830830
}
831
-
832
-/*
833
-** COMMAND: commands
834
-**
835
-** Usage: %fossil commands ?--test? ?--all? ?--aux?
836
-**
837
-** List available commands. If the --test option is used list only unsupported
838
-** commands intended for testing and debugging. With --all, show all commands
839
-** including test debugging commands. With --aux, show only the auxiliary
840
-** and less often used commands, and/or command aliases.
841
-*/
842
-void cmd_command_list(void){
843
- int cmdFlags = CMDFLAG_1ST_TIER | CMDFLAG_2ND_TIER;
844
- if( find_option("all",0,0)!=0 ){
845
- cmdFlags |= CMDFLAG_TEST;
846
- }else if( find_option("test",0,0)!=0 ){
847
- cmdFlags = CMDFLAG_TEST;
848
- }else if( find_option("aux",0,0)!=0 ){
849
- cmdFlags = CMDFLAG_2ND_TIER;
850
- }else{
851
- fossil_print("Use --test or --all to see test and debug commands.\n");
852
- }
853
- command_list(0, cmdFlags);
854
-}
855
-
856831
857832
/*
858833
** COMMAND: test-list-webpage
859834
**
860835
** List all web pages
@@ -865,11 +840,10 @@
865840
for(i=nCmd=0; i<count(aWebpage); i++){
866841
aCmd[nCmd++] = aWebpage[i].zName;
867842
}
868843
multi_column_list(aCmd, nCmd);
869844
}
870
-
871845
872846
/*
873847
** COMMAND: version
874848
**
875849
** Usage: %fossil version
@@ -887,26 +861,41 @@
887861
**
888862
** Usage: %fossil help COMMAND
889863
** or: %fossil COMMAND -help
890864
**
891865
** Display information on how to use COMMAND. To display a list of
892
-** available commands use:
866
+** available commands one of:
893867
**
894
-** %fossil commands
868
+** %fossil help Show common commands
869
+** %fossil help --all Show both command and auxiliary commands
870
+** %fossil help --test Show test commands only
871
+** %fossil help --aux Show auxiliary commands only
895872
*/
896873
void help_cmd(void){
897874
int rc, idx;
898875
const char *z;
899876
if( g.argc<3 ){
900877
z = fossil_nameofexe();
901878
fossil_print(
902879
"Usage: %s help COMMAND\n"
903
- "Common COMMANDs: (use \"%s commands\" for a complete list)\n",
880
+ "Common COMMANDs: (use \"%s help --all\" for a complete list)\n",
904881
z, z);
905882
command_list(0, CMDFLAG_1ST_TIER);
906883
version_cmd();
907884
return;
885
+ }
886
+ if( find_option("all",0,0) ){
887
+ command_list(0, CMDFLAG_1ST_TIER | CMDFLAG_2ND_TIER);
888
+ return;
889
+ }
890
+ if( find_option("aux",0,0) ){
891
+ command_list(0, CMDFLAG_2ND_TIER);
892
+ return;
893
+ }
894
+ if( find_option("test",0,0) ){
895
+ command_list(0, CMDFLAG_TEST);
896
+ return;
908897
}
909898
rc = name_search(g.argv[2], aCommand, count(aCommand), &idx);
910899
if( rc==1 ){
911900
fossil_print("unknown command: %s\nAvailable commands:\n", g.argv[2]);
912901
command_list(0, 0xff);
913902
--- src/main.c
+++ src/main.c
@@ -826,35 +826,10 @@
826 if( zPrefix && memcmp(zPrefix, z, nPrefix)!=0 ) continue;
827 aCmd[nCmd++] = aCommand[i].zName;
828 }
829 multi_column_list(aCmd, nCmd);
830 }
831
832 /*
833 ** COMMAND: commands
834 **
835 ** Usage: %fossil commands ?--test? ?--all? ?--aux?
836 **
837 ** List available commands. If the --test option is used list only unsupported
838 ** commands intended for testing and debugging. With --all, show all commands
839 ** including test debugging commands. With --aux, show only the auxiliary
840 ** and less often used commands, and/or command aliases.
841 */
842 void cmd_command_list(void){
843 int cmdFlags = CMDFLAG_1ST_TIER | CMDFLAG_2ND_TIER;
844 if( find_option("all",0,0)!=0 ){
845 cmdFlags |= CMDFLAG_TEST;
846 }else if( find_option("test",0,0)!=0 ){
847 cmdFlags = CMDFLAG_TEST;
848 }else if( find_option("aux",0,0)!=0 ){
849 cmdFlags = CMDFLAG_2ND_TIER;
850 }else{
851 fossil_print("Use --test or --all to see test and debug commands.\n");
852 }
853 command_list(0, cmdFlags);
854 }
855
856
857 /*
858 ** COMMAND: test-list-webpage
859 **
860 ** List all web pages
@@ -865,11 +840,10 @@
865 for(i=nCmd=0; i<count(aWebpage); i++){
866 aCmd[nCmd++] = aWebpage[i].zName;
867 }
868 multi_column_list(aCmd, nCmd);
869 }
870
871
872 /*
873 ** COMMAND: version
874 **
875 ** Usage: %fossil version
@@ -887,26 +861,41 @@
887 **
888 ** Usage: %fossil help COMMAND
889 ** or: %fossil COMMAND -help
890 **
891 ** Display information on how to use COMMAND. To display a list of
892 ** available commands use:
893 **
894 ** %fossil commands
 
 
 
895 */
896 void help_cmd(void){
897 int rc, idx;
898 const char *z;
899 if( g.argc<3 ){
900 z = fossil_nameofexe();
901 fossil_print(
902 "Usage: %s help COMMAND\n"
903 "Common COMMANDs: (use \"%s commands\" for a complete list)\n",
904 z, z);
905 command_list(0, CMDFLAG_1ST_TIER);
906 version_cmd();
907 return;
 
 
 
 
 
 
 
 
 
 
 
 
908 }
909 rc = name_search(g.argv[2], aCommand, count(aCommand), &idx);
910 if( rc==1 ){
911 fossil_print("unknown command: %s\nAvailable commands:\n", g.argv[2]);
912 command_list(0, 0xff);
913
--- src/main.c
+++ src/main.c
@@ -826,35 +826,10 @@
826 if( zPrefix && memcmp(zPrefix, z, nPrefix)!=0 ) continue;
827 aCmd[nCmd++] = aCommand[i].zName;
828 }
829 multi_column_list(aCmd, nCmd);
830 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
831
832 /*
833 ** COMMAND: test-list-webpage
834 **
835 ** List all web pages
@@ -865,11 +840,10 @@
840 for(i=nCmd=0; i<count(aWebpage); i++){
841 aCmd[nCmd++] = aWebpage[i].zName;
842 }
843 multi_column_list(aCmd, nCmd);
844 }
 
845
846 /*
847 ** COMMAND: version
848 **
849 ** Usage: %fossil version
@@ -887,26 +861,41 @@
861 **
862 ** Usage: %fossil help COMMAND
863 ** or: %fossil COMMAND -help
864 **
865 ** Display information on how to use COMMAND. To display a list of
866 ** available commands one of:
867 **
868 ** %fossil help Show common commands
869 ** %fossil help --all Show both command and auxiliary commands
870 ** %fossil help --test Show test commands only
871 ** %fossil help --aux Show auxiliary commands only
872 */
873 void help_cmd(void){
874 int rc, idx;
875 const char *z;
876 if( g.argc<3 ){
877 z = fossil_nameofexe();
878 fossil_print(
879 "Usage: %s help COMMAND\n"
880 "Common COMMANDs: (use \"%s help --all\" for a complete list)\n",
881 z, z);
882 command_list(0, CMDFLAG_1ST_TIER);
883 version_cmd();
884 return;
885 }
886 if( find_option("all",0,0) ){
887 command_list(0, CMDFLAG_1ST_TIER | CMDFLAG_2ND_TIER);
888 return;
889 }
890 if( find_option("aux",0,0) ){
891 command_list(0, CMDFLAG_2ND_TIER);
892 return;
893 }
894 if( find_option("test",0,0) ){
895 command_list(0, CMDFLAG_TEST);
896 return;
897 }
898 rc = name_search(g.argv[2], aCommand, count(aCommand), &idx);
899 if( rc==1 ){
900 fossil_print("unknown command: %s\nAvailable commands:\n", g.argv[2]);
901 command_list(0, 0xff);
902
--- src/mkindex.c
+++ src/mkindex.c
@@ -61,10 +61,11 @@
6161
/*
6262
** Each entry looks like this:
6363
*/
6464
typedef struct Entry {
6565
int eType;
66
+ char *zIf;
6667
char *zFunc;
6768
char *zPath;
6869
char *zHelp;
6970
} Entry;
7071
@@ -87,10 +88,15 @@
8788
** Current help message accumulator
8889
*/
8990
char zHelp[MX_HELP];
9091
int nHelp;
9192
93
+/*
94
+** Most recently encountered #if
95
+*/
96
+char zIf[200];
97
+
9298
/*
9399
** How many entries are used
94100
*/
95101
int nUsed;
96102
int nFixed;
@@ -135,10 +141,30 @@
135141
aEntry[nUsed].eType = eType;
136142
aEntry[nUsed].zPath = string_dup(&zLine[i], j);
137143
aEntry[nUsed].zFunc = 0;
138144
nUsed++;
139145
}
146
+
147
+/*
148
+** Check to see if the current line is an #if and if it is, add it to
149
+** the zIf[] string. If the current line is an #endif or #else or #elif
150
+** then cancel the current zIf[] string.
151
+*/
152
+void scan_for_if(const char *zLine){
153
+ int i;
154
+ int len;
155
+ if( zLine[0]!='#' ) return;
156
+ for(i=1; isspace(zLine[i]); i++){}
157
+ if( zLine[i]==0 ) return;
158
+ len = strlen(&zLine[i]);
159
+ if( memcmp(&zLine[i],"if",2)==0 ){
160
+ zIf[0] = '#';
161
+ memcpy(&zIf[1], &zLine[i], len+1);
162
+ }else if( zLine[i]=='e' ){
163
+ zIf[0] = 0;
164
+ }
165
+}
140166
141167
/*
142168
** Scan a line for a function that implements a web page or command.
143169
*/
144170
void scan_for_func(char *zLine){
@@ -179,10 +205,11 @@
179205
z = string_dup(&zHelp[k], nHelp-k);
180206
}else{
181207
z = 0;
182208
}
183209
for(k=nFixed; k<nUsed; k++){
210
+ aEntry[k].zIf = zIf[0] ? string_dup(zIf, -1) : 0;
184211
aEntry[k].zFunc = string_dup(&zLine[i], j);
185212
aEntry[k].zHelp = z;
186213
}
187214
i+=j;
188215
while( isspace(zLine[i]) ){ i++; }
@@ -219,11 +246,13 @@
219246
int i;
220247
int nType0;
221248
222249
qsort(aEntry, nFixed, sizeof(aEntry[0]), e_compare);
223250
for(i=0; i<nFixed; i++){
251
+ if( aEntry[i].zIf ) printf("%s", aEntry[i].zIf);
224252
printf("extern void %s(void);\n", aEntry[i].zFunc);
253
+ if( aEntry[i].zIf ) printf("#endif\n");
225254
}
226255
printf(
227256
"typedef struct NameMap NameMap;\n"
228257
"struct NameMap {\n"
229258
" const char *zName;\n"
@@ -236,16 +265,18 @@
236265
"static const NameMap aWebpage[] = {\n"
237266
);
238267
for(i=0; i<nFixed && aEntry[i].eType==0; i++){
239268
const char *z = aEntry[i].zPath;
240269
int n = strlen(z);
270
+ if( aEntry[i].zIf ) printf("%s", aEntry[i].zIf);
241271
printf(" { \"%s\",%*s %s,%*s 1 },\n",
242272
z,
243273
25-n, "",
244274
aEntry[i].zFunc,
245275
(int)(35-strlen(aEntry[i].zFunc)), ""
246276
);
277
+ if( aEntry[i].zIf ) printf("#endif\n");
247278
}
248279
printf("};\n");
249280
nType0 = i;
250281
printf(
251282
"static const NameMap aCommand[] = {\n"
@@ -258,22 +289,25 @@
258289
n--;
259290
cmdFlags = 0x02;
260291
}else if( memcmp(z, "test-", 5)==0 ){
261292
cmdFlags = 0x04;
262293
}
294
+ if( aEntry[i].zIf ) printf("%s", aEntry[i].zIf);
263295
printf(" { \"%.*s\",%*s %s,%*s %d },\n",
264296
n, z,
265297
25-n, "",
266298
aEntry[i].zFunc,
267299
(int)(35-strlen(aEntry[i].zFunc)), "",
268300
cmdFlags
269301
);
302
+ if( aEntry[i].zIf ) printf("#endif\n");
270303
}
271304
printf("};\n");
272305
for(i=nType0; i<nFixed; i++){
273306
char *z = aEntry[i].zHelp;
274307
if( z && z[0] ){
308
+ if( aEntry[i].zIf ) printf("%s", aEntry[i].zIf);
275309
printf("static const char zHelp_%s[] = \n", aEntry[i].zFunc);
276310
printf(" \"");
277311
while( *z ){
278312
if( *z=='\n' ){
279313
printf("\\n\"\n \"");
@@ -283,22 +317,25 @@
283317
putchar(*z);
284318
}
285319
z++;
286320
}
287321
printf("\";\n");
322
+ if( aEntry[i].zIf ) printf("#endif\n");
288323
aEntry[i].zHelp[0] = 0;
289324
}
290325
}
291326
printf(
292327
"static const char * const aCmdHelp[] = {\n"
293328
);
294329
for(i=nType0; i<nFixed; i++){
330
+ if( aEntry[i].zIf ) printf("%s", aEntry[i].zIf);
295331
if( aEntry[i].zHelp==0 ){
296332
printf(" 0,\n");
297333
}else{
298334
printf(" zHelp_%s,\n", aEntry[i].zFunc);
299335
}
336
+ if( aEntry[i].zIf ) printf("#endif\n");
300337
}
301338
printf("};\n");
302339
}
303340
304341
/*
@@ -312,10 +349,11 @@
312349
return;
313350
}
314351
nLine = 0;
315352
while( fgets(zLine, sizeof(zLine), in) ){
316353
nLine++;
354
+ scan_for_if(zLine);
317355
scan_for_label("WEBPAGE:",zLine,0);
318356
scan_for_label("COMMAND:",zLine,1);
319357
scan_for_func(zLine);
320358
}
321359
fclose(in);
322360
--- src/mkindex.c
+++ src/mkindex.c
@@ -61,10 +61,11 @@
61 /*
62 ** Each entry looks like this:
63 */
64 typedef struct Entry {
65 int eType;
 
66 char *zFunc;
67 char *zPath;
68 char *zHelp;
69 } Entry;
70
@@ -87,10 +88,15 @@
87 ** Current help message accumulator
88 */
89 char zHelp[MX_HELP];
90 int nHelp;
91
 
 
 
 
 
92 /*
93 ** How many entries are used
94 */
95 int nUsed;
96 int nFixed;
@@ -135,10 +141,30 @@
135 aEntry[nUsed].eType = eType;
136 aEntry[nUsed].zPath = string_dup(&zLine[i], j);
137 aEntry[nUsed].zFunc = 0;
138 nUsed++;
139 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
140
141 /*
142 ** Scan a line for a function that implements a web page or command.
143 */
144 void scan_for_func(char *zLine){
@@ -179,10 +205,11 @@
179 z = string_dup(&zHelp[k], nHelp-k);
180 }else{
181 z = 0;
182 }
183 for(k=nFixed; k<nUsed; k++){
 
184 aEntry[k].zFunc = string_dup(&zLine[i], j);
185 aEntry[k].zHelp = z;
186 }
187 i+=j;
188 while( isspace(zLine[i]) ){ i++; }
@@ -219,11 +246,13 @@
219 int i;
220 int nType0;
221
222 qsort(aEntry, nFixed, sizeof(aEntry[0]), e_compare);
223 for(i=0; i<nFixed; i++){
 
224 printf("extern void %s(void);\n", aEntry[i].zFunc);
 
225 }
226 printf(
227 "typedef struct NameMap NameMap;\n"
228 "struct NameMap {\n"
229 " const char *zName;\n"
@@ -236,16 +265,18 @@
236 "static const NameMap aWebpage[] = {\n"
237 );
238 for(i=0; i<nFixed && aEntry[i].eType==0; i++){
239 const char *z = aEntry[i].zPath;
240 int n = strlen(z);
 
241 printf(" { \"%s\",%*s %s,%*s 1 },\n",
242 z,
243 25-n, "",
244 aEntry[i].zFunc,
245 (int)(35-strlen(aEntry[i].zFunc)), ""
246 );
 
247 }
248 printf("};\n");
249 nType0 = i;
250 printf(
251 "static const NameMap aCommand[] = {\n"
@@ -258,22 +289,25 @@
258 n--;
259 cmdFlags = 0x02;
260 }else if( memcmp(z, "test-", 5)==0 ){
261 cmdFlags = 0x04;
262 }
 
263 printf(" { \"%.*s\",%*s %s,%*s %d },\n",
264 n, z,
265 25-n, "",
266 aEntry[i].zFunc,
267 (int)(35-strlen(aEntry[i].zFunc)), "",
268 cmdFlags
269 );
 
270 }
271 printf("};\n");
272 for(i=nType0; i<nFixed; i++){
273 char *z = aEntry[i].zHelp;
274 if( z && z[0] ){
 
275 printf("static const char zHelp_%s[] = \n", aEntry[i].zFunc);
276 printf(" \"");
277 while( *z ){
278 if( *z=='\n' ){
279 printf("\\n\"\n \"");
@@ -283,22 +317,25 @@
283 putchar(*z);
284 }
285 z++;
286 }
287 printf("\";\n");
 
288 aEntry[i].zHelp[0] = 0;
289 }
290 }
291 printf(
292 "static const char * const aCmdHelp[] = {\n"
293 );
294 for(i=nType0; i<nFixed; i++){
 
295 if( aEntry[i].zHelp==0 ){
296 printf(" 0,\n");
297 }else{
298 printf(" zHelp_%s,\n", aEntry[i].zFunc);
299 }
 
300 }
301 printf("};\n");
302 }
303
304 /*
@@ -312,10 +349,11 @@
312 return;
313 }
314 nLine = 0;
315 while( fgets(zLine, sizeof(zLine), in) ){
316 nLine++;
 
317 scan_for_label("WEBPAGE:",zLine,0);
318 scan_for_label("COMMAND:",zLine,1);
319 scan_for_func(zLine);
320 }
321 fclose(in);
322
--- src/mkindex.c
+++ src/mkindex.c
@@ -61,10 +61,11 @@
61 /*
62 ** Each entry looks like this:
63 */
64 typedef struct Entry {
65 int eType;
66 char *zIf;
67 char *zFunc;
68 char *zPath;
69 char *zHelp;
70 } Entry;
71
@@ -87,10 +88,15 @@
88 ** Current help message accumulator
89 */
90 char zHelp[MX_HELP];
91 int nHelp;
92
93 /*
94 ** Most recently encountered #if
95 */
96 char zIf[200];
97
98 /*
99 ** How many entries are used
100 */
101 int nUsed;
102 int nFixed;
@@ -135,10 +141,30 @@
141 aEntry[nUsed].eType = eType;
142 aEntry[nUsed].zPath = string_dup(&zLine[i], j);
143 aEntry[nUsed].zFunc = 0;
144 nUsed++;
145 }
146
147 /*
148 ** Check to see if the current line is an #if and if it is, add it to
149 ** the zIf[] string. If the current line is an #endif or #else or #elif
150 ** then cancel the current zIf[] string.
151 */
152 void scan_for_if(const char *zLine){
153 int i;
154 int len;
155 if( zLine[0]!='#' ) return;
156 for(i=1; isspace(zLine[i]); i++){}
157 if( zLine[i]==0 ) return;
158 len = strlen(&zLine[i]);
159 if( memcmp(&zLine[i],"if",2)==0 ){
160 zIf[0] = '#';
161 memcpy(&zIf[1], &zLine[i], len+1);
162 }else if( zLine[i]=='e' ){
163 zIf[0] = 0;
164 }
165 }
166
167 /*
168 ** Scan a line for a function that implements a web page or command.
169 */
170 void scan_for_func(char *zLine){
@@ -179,10 +205,11 @@
205 z = string_dup(&zHelp[k], nHelp-k);
206 }else{
207 z = 0;
208 }
209 for(k=nFixed; k<nUsed; k++){
210 aEntry[k].zIf = zIf[0] ? string_dup(zIf, -1) : 0;
211 aEntry[k].zFunc = string_dup(&zLine[i], j);
212 aEntry[k].zHelp = z;
213 }
214 i+=j;
215 while( isspace(zLine[i]) ){ i++; }
@@ -219,11 +246,13 @@
246 int i;
247 int nType0;
248
249 qsort(aEntry, nFixed, sizeof(aEntry[0]), e_compare);
250 for(i=0; i<nFixed; i++){
251 if( aEntry[i].zIf ) printf("%s", aEntry[i].zIf);
252 printf("extern void %s(void);\n", aEntry[i].zFunc);
253 if( aEntry[i].zIf ) printf("#endif\n");
254 }
255 printf(
256 "typedef struct NameMap NameMap;\n"
257 "struct NameMap {\n"
258 " const char *zName;\n"
@@ -236,16 +265,18 @@
265 "static const NameMap aWebpage[] = {\n"
266 );
267 for(i=0; i<nFixed && aEntry[i].eType==0; i++){
268 const char *z = aEntry[i].zPath;
269 int n = strlen(z);
270 if( aEntry[i].zIf ) printf("%s", aEntry[i].zIf);
271 printf(" { \"%s\",%*s %s,%*s 1 },\n",
272 z,
273 25-n, "",
274 aEntry[i].zFunc,
275 (int)(35-strlen(aEntry[i].zFunc)), ""
276 );
277 if( aEntry[i].zIf ) printf("#endif\n");
278 }
279 printf("};\n");
280 nType0 = i;
281 printf(
282 "static const NameMap aCommand[] = {\n"
@@ -258,22 +289,25 @@
289 n--;
290 cmdFlags = 0x02;
291 }else if( memcmp(z, "test-", 5)==0 ){
292 cmdFlags = 0x04;
293 }
294 if( aEntry[i].zIf ) printf("%s", aEntry[i].zIf);
295 printf(" { \"%.*s\",%*s %s,%*s %d },\n",
296 n, z,
297 25-n, "",
298 aEntry[i].zFunc,
299 (int)(35-strlen(aEntry[i].zFunc)), "",
300 cmdFlags
301 );
302 if( aEntry[i].zIf ) printf("#endif\n");
303 }
304 printf("};\n");
305 for(i=nType0; i<nFixed; i++){
306 char *z = aEntry[i].zHelp;
307 if( z && z[0] ){
308 if( aEntry[i].zIf ) printf("%s", aEntry[i].zIf);
309 printf("static const char zHelp_%s[] = \n", aEntry[i].zFunc);
310 printf(" \"");
311 while( *z ){
312 if( *z=='\n' ){
313 printf("\\n\"\n \"");
@@ -283,22 +317,25 @@
317 putchar(*z);
318 }
319 z++;
320 }
321 printf("\";\n");
322 if( aEntry[i].zIf ) printf("#endif\n");
323 aEntry[i].zHelp[0] = 0;
324 }
325 }
326 printf(
327 "static const char * const aCmdHelp[] = {\n"
328 );
329 for(i=nType0; i<nFixed; i++){
330 if( aEntry[i].zIf ) printf("%s", aEntry[i].zIf);
331 if( aEntry[i].zHelp==0 ){
332 printf(" 0,\n");
333 }else{
334 printf(" zHelp_%s,\n", aEntry[i].zFunc);
335 }
336 if( aEntry[i].zIf ) printf("#endif\n");
337 }
338 printf("};\n");
339 }
340
341 /*
@@ -312,10 +349,11 @@
349 return;
350 }
351 nLine = 0;
352 while( fgets(zLine, sizeof(zLine), in) ){
353 nLine++;
354 scan_for_if(zLine);
355 scan_for_label("WEBPAGE:",zLine,0);
356 scan_for_label("COMMAND:",zLine,1);
357 scan_for_func(zLine);
358 }
359 fclose(in);
360
--- src/winhttp.c
+++ src/winhttp.c
@@ -848,15 +848,6 @@
848848
" create delete show start stop");
849849
}
850850
return;
851851
}
852852
853
-#else /* _WIN32 -- This code is for win32 only */
854
-#include "winhttp.h"
855
-
856
-void cmd_win32_service(void){
857
- fossil_fatal("The winsrv command is platform specific "
858
- "and not available on this platform.");
859
- return;
860
-}
861
-
862853
#endif /* _WIN32 -- This code is for win32 only */
863854
--- src/winhttp.c
+++ src/winhttp.c
@@ -848,15 +848,6 @@
848 " create delete show start stop");
849 }
850 return;
851 }
852
853 #else /* _WIN32 -- This code is for win32 only */
854 #include "winhttp.h"
855
856 void cmd_win32_service(void){
857 fossil_fatal("The winsrv command is platform specific "
858 "and not available on this platform.");
859 return;
860 }
861
862 #endif /* _WIN32 -- This code is for win32 only */
863
--- src/winhttp.c
+++ src/winhttp.c
@@ -848,15 +848,6 @@
848 " create delete show start stop");
849 }
850 return;
851 }
852
 
 
 
 
 
 
 
 
 
853 #endif /* _WIN32 -- This code is for win32 only */
854

Keyboard Shortcuts

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