| | @@ -174,10 +174,11 @@ |
| 174 | 174 | if( strncmp(zLine, "**", 2)==0 |
| 175 | 175 | && isspace(zLine[2]) |
| 176 | 176 | && strlen(zLine)<sizeof(zHelp)-nHelp-1 |
| 177 | 177 | && nUsed>nFixed |
| 178 | 178 | && memcmp(zLine,"** COMMAND:",11)!=0 |
| 179 | + && memcmp(zLine,"** WEBPAGE:",11)!=0 |
| 179 | 180 | ){ |
| 180 | 181 | if( zLine[2]=='\n' ){ |
| 181 | 182 | zHelp[nHelp++] = '\n'; |
| 182 | 183 | }else{ |
| 183 | 184 | if( strncmp(&zLine[3], "Usage: ", 6)==0 ) nHelp = 0; |
| | @@ -242,11 +243,10 @@ |
| 242 | 243 | /* |
| 243 | 244 | ** Build the binary search table. |
| 244 | 245 | */ |
| 245 | 246 | void build_table(void){ |
| 246 | 247 | int i; |
| 247 | | - int nType0; |
| 248 | 248 | |
| 249 | 249 | qsort(aEntry, nFixed, sizeof(aEntry[0]), e_compare); |
| 250 | 250 | for(i=0; i<nFixed; i++){ |
| 251 | 251 | if( aEntry[i].zIf ) printf("%s", aEntry[i].zIf); |
| 252 | 252 | printf("extern void %s(void);\n", aEntry[i].zFunc); |
| | @@ -260,10 +260,11 @@ |
| 260 | 260 | " char cmdFlags;\n" |
| 261 | 261 | "};\n" |
| 262 | 262 | "#define CMDFLAG_1ST_TIER 0x01\n" |
| 263 | 263 | "#define CMDFLAG_2ND_TIER 0x02\n" |
| 264 | 264 | "#define CMDFLAG_TEST 0x04\n" |
| 265 | + "#define CMDFLAG_WEBPAGE 0x08\n" |
| 265 | 266 | "static const NameMap aWebpage[] = {\n" |
| 266 | 267 | ); |
| 267 | 268 | for(i=0; i<nFixed && aEntry[i].eType==0; i++){ |
| 268 | 269 | const char *z = aEntry[i].zPath; |
| 269 | 270 | int n = strlen(z); |
| | @@ -275,36 +276,38 @@ |
| 275 | 276 | (int)(35-strlen(aEntry[i].zFunc)), "" |
| 276 | 277 | ); |
| 277 | 278 | if( aEntry[i].zIf ) printf("#endif\n"); |
| 278 | 279 | } |
| 279 | 280 | printf("};\n"); |
| 280 | | - nType0 = i; |
| 281 | 281 | printf( |
| 282 | 282 | "static const NameMap aCommand[] = {\n" |
| 283 | 283 | ); |
| 284 | | - for(i=nType0; i<nFixed && aEntry[i].eType==1; i++){ |
| 284 | + for(i=0; i<nFixed /*&& aEntry[i].eType==1*/; i++){ |
| 285 | 285 | const char *z = aEntry[i].zPath; |
| 286 | 286 | int n = strlen(z); |
| 287 | | - int cmdFlags = 0x01; |
| 288 | | - if( z[n-1]=='*' ){ |
| 289 | | - n--; |
| 290 | | - cmdFlags = 0x02; |
| 291 | | - }else if( memcmp(z, "test-", 5)==0 ){ |
| 292 | | - cmdFlags = 0x04; |
| 287 | + int cmdFlags = (1==aEntry[i].eType) ? 0x01 : 0x08; |
| 288 | + if(0x01==cmdFlags){ |
| 289 | + if( z[n-1]=='*' ){ |
| 290 | + n--; |
| 291 | + cmdFlags = 0x02; |
| 292 | + }else if( memcmp(z, "test-", 5)==0 ){ |
| 293 | + cmdFlags = 0x04; |
| 294 | + } |
| 293 | 295 | } |
| 294 | 296 | if( aEntry[i].zIf ) printf("%s", aEntry[i].zIf); |
| 295 | | - printf(" { \"%.*s\",%*s %s,%*s %d },\n", |
| 297 | + printf(" { \"%s%.*s\",%*s %s,%*s %d },\n", |
| 298 | + (0x08 & cmdFlags) ? "/" : "", |
| 296 | 299 | n, z, |
| 297 | 300 | 25-n, "", |
| 298 | 301 | aEntry[i].zFunc, |
| 299 | 302 | (int)(35-strlen(aEntry[i].zFunc)), "", |
| 300 | 303 | cmdFlags |
| 301 | 304 | ); |
| 302 | 305 | if( aEntry[i].zIf ) printf("#endif\n"); |
| 303 | 306 | } |
| 304 | 307 | printf("};\n"); |
| 305 | | - for(i=nType0; i<nFixed; i++){ |
| 308 | + for(i=0; i<nFixed; i++){ |
| 306 | 309 | char *z = aEntry[i].zHelp; |
| 307 | 310 | if( z && z[0] ){ |
| 308 | 311 | if( aEntry[i].zIf ) printf("%s", aEntry[i].zIf); |
| 309 | 312 | printf("static const char zHelp_%s[] = \n", aEntry[i].zFunc); |
| 310 | 313 | printf(" \""); |
| | @@ -321,19 +324,21 @@ |
| 321 | 324 | printf("\";\n"); |
| 322 | 325 | if( aEntry[i].zIf ) printf("#endif\n"); |
| 323 | 326 | aEntry[i].zHelp[0] = 0; |
| 324 | 327 | } |
| 325 | 328 | } |
| 326 | | - printf( |
| 327 | | - "static const char * const aCmdHelp[] = {\n" |
| 328 | | - ); |
| 329 | | - for(i=nType0; i<nFixed; i++){ |
| 329 | + puts("struct CmdHelp {" |
| 330 | + "int eType; " |
| 331 | + "char const * zText;" |
| 332 | + "};"); |
| 333 | + puts("static struct CmdHelp aCmdHelp[] = {"); |
| 334 | + for(i=0; i<nFixed; i++){ |
| 330 | 335 | if( aEntry[i].zIf ) printf("%s", aEntry[i].zIf); |
| 331 | 336 | if( aEntry[i].zHelp==0 ){ |
| 332 | | - printf(" 0,\n"); |
| 337 | + printf("{%d, 0},\n", aEntry[i].eType); |
| 333 | 338 | }else{ |
| 334 | | - printf(" zHelp_%s,\n", aEntry[i].zFunc); |
| 339 | + printf("{%d, zHelp_%s},\n", aEntry[i].eType, aEntry[i].zFunc); |
| 335 | 340 | } |
| 336 | 341 | if( aEntry[i].zIf ) printf("#endif\n"); |
| 337 | 342 | } |
| 338 | 343 | printf("};\n"); |
| 339 | 344 | } |
| 340 | 345 | |