Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch ambiguous_cmd_fix Excluding Merge-Ins
This is equivalent to a diff from 959807e9 to bb5162fe
2022-04-06
| ||
16:42 | Minor consistency fix about ambiguous sub-command dispatch and error reporting, see related forum post. ... (check-in: 512905ef user: mgagnon tags: trunk) | |
2022-04-05
| ||
19:51 | When reporting the list of matching ambiguous sub-commands, make sure settings with the same prefix are not listed. ... (Closed-Leaf check-in: bb5162fe user: mgagnon tags: ambiguous_cmd_fix) | |
16:49 | Don't give an "ambiguous command prefix" error when reported ambiguous commands are aliases to each others. Assume alias point to same function pointer and are all consecutive in the aCommand[] list. ... (check-in: 862ce7ce user: mgagnon tags: ambiguous_cmd_fix) | |
15:04 | Modify the makefiles to provide for compile-time options for pikchr. Reduce the token-count limit in pikchr to 10,000. ... (check-in: 959807e9 user: drh tags: trunk) | |
14:41 | Update to the latest Pikchr version that includes improved resistance to exponential macro-expansion attacks. ... (check-in: f7530419 user: drh tags: trunk) | |
Changes to src/dispatch.c.
︙ | ︙ | |||
123 124 125 126 127 128 129 | * exactly one entry with this prefix and the requested type. */ for( mid=-1; lwr<MX_COMMAND && strncmp(zName, aCommand[lwr].zName, nName)==0; ++lwr ){ if( aCommand[lwr].eCmdFlags & eType ){ if( mid<0 ){ mid = lwr; /* Potential ambiguous prefix */ }else{ | > | > | 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | * exactly one entry with this prefix and the requested type. */ for( mid=-1; lwr<MX_COMMAND && strncmp(zName, aCommand[lwr].zName, nName)==0; ++lwr ){ if( aCommand[lwr].eCmdFlags & eType ){ if( mid<0 ){ mid = lwr; /* Potential ambiguous prefix */ }else{ if( aCommand[lwr].xFunc != aCommand[mid].xFunc ){ return 2; /* Confirmed ambiguous prefix */ } } } } if( mid>=0 ){ *ppCmd = &aCommand[mid]; return 0; /* Prefix match */ } |
︙ | ︙ | |||
205 206 207 208 209 210 211 | } } return 0; } /* ** Fill Blob with a space-separated list of all command names that | | | > > > > > | 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | } } return 0; } /* ** Fill Blob with a space-separated list of all command names that ** match the prefix zPrefix and the eType CMDFLAGS_ bits. */ void dispatch_matching_names( const char *zPrefix, /* name prefix */ unsigned eType, /* CMDFLAG_ bits */ Blob *pList /* space-separated list of command names */ ){ int i; int nPrefix = (int)strlen(zPrefix); for(i=FOSSIL_FIRST_CMD; i<MX_COMMAND; i++){ if( (aCommand[i].eCmdFlags & eType)==0 ) continue; if( strncmp(zPrefix, aCommand[i].zName, nPrefix)==0 ){ blob_appendf(pList, " %s", aCommand[i].zName); } } } /* |
︙ | ︙ |
Changes to src/main.c.
︙ | ︙ | |||
909 910 911 912 913 914 915 | } } fossil_exit(0); #endif }else if( rc==2 ){ Blob couldbe; blob_init(&couldbe,0,0); | | | 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 | } } fossil_exit(0); #endif }else if( rc==2 ){ Blob couldbe; blob_init(&couldbe,0,0); dispatch_matching_names(zCmdName, CMDFLAG_COMMAND, &couldbe); fossil_print("%s: ambiguous command prefix: %s\n" "%s: could be any of:%s\n" "%s: use \"help\" for more information\n", g.argv[0], zCmdName, g.argv[0], blob_str(&couldbe), g.argv[0]); fossil_exit(1); } #ifdef FOSSIL_ENABLE_JSON |
︙ | ︙ |