Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Handle --opt=arg as final command line argument, discussed in a90b5ebd36f4c134. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | find-options-last-arg-fix |
Files: | files | file ages | folders |
SHA3-256: |
9ac38481ec39a944a97783ece00d0805 |
User & Date: | preben 2023-09-28 18:59:15 |
Context
2023-09-29
| ||
06:56 | Fixing the long opt broke final short option if expected argument is not present. ... (Closed-Leaf check-in: d8b23d71 user: preben tags: find-options-last-arg-fix) | |
2023-09-28
| ||
18:59 | Handle --opt=arg as final command line argument, discussed in a90b5ebd36f4c134. ... (check-in: 9ac38481 user: preben tags: find-options-last-arg-fix) | |
14:15 | Update to the change log. ... (check-in: e3e28f43 user: drh tags: trunk) | |
Changes
Changes to src/main.c.
︙ | ︙ | |||
1022 1023 1024 1025 1026 1027 1028 | int i; int nLong; const char *zReturn = 0; assert( hasArg==0 || hasArg==1 ); nLong = strlen(zLong); for(i=1; i<g.argc; i++){ char *z; | < > | 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 | int i; int nLong; const char *zReturn = 0; assert( hasArg==0 || hasArg==1 ); nLong = strlen(zLong); for(i=1; i<g.argc; i++){ char *z; z = g.argv[i]; if( z[0]!='-' ) continue; z++; if( z[0]=='-' ){ if( z[1]==0 ){ /* Stop processing at "--" without consuming it. verify_all_options() will consume this flag. */ break; } z++; } if( strncmp(z,zLong,nLong)==0 ){ if( hasArg && z[nLong]=='=' ){ zReturn = &z[nLong+1]; remove_from_argv(i, 1); break; }else if( z[nLong]==0 ){ if( i+hasArg >= g.argc ) break; zReturn = g.argv[i+hasArg]; remove_from_argv(i, 1+hasArg); break; } }else if( fossil_strcmp(z,zShort)==0 ){ zReturn = g.argv[i+hasArg]; remove_from_argv(i, 1+hasArg); |
︙ | ︙ |