Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Merge the --args FILENAME patch into trunk. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
c0274f996266aefd4e7566245ecf4d44 |
User & Date: | drh 2011-10-04 23:07:52 |
References
2011-10-04
| ||
23:40 | merged and conflict-resolved trunk [c0274f996266aef]. ... (check-in: 4fbf77d4 user: stephan tags: json-multitag-test, json) | |
Context
2011-10-05
| ||
02:03 | Change a #ifdef so that builds on MSVC will work on repos larger than 2GB. ... (check-in: 6092935f user: drh tags: trunk) | |
2011-10-04
| ||
23:40 | merged and conflict-resolved trunk [c0274f996266aef]. ... (check-in: 4fbf77d4 user: stephan tags: json-multitag-test, json) | |
23:07 | Merge the --args FILENAME patch into trunk. ... (check-in: c0274f99 user: drh tags: trunk) | |
23:03 | Simplify the implementation of the --args FILENAME patch, as requested by the FIXME comment. ... (check-in: eb8d989d user: drh tags: stephan-hack) | |
15:15 | Merge protection against timing attacks into trunk. ... (check-in: d4a341b4 user: dmitry tags: trunk) | |
Changes
Changes to src/main.c.
︙ | ︙ | |||
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 | if( cnt==1 ){ *pIndex = m; return 0; } return 1+(cnt>1); } /* ** This procedure runs first. */ int main(int argc, char **argv){ const char *zCmdName = "unknown"; int idx; int rc; int i; sqlite3_config(SQLITE_CONFIG_LOG, fossil_sqlite_log, 0); g.now = time(0); g.argc = argc; g.argv = argv; for(i=0; i<argc; i++) g.argv[i] = fossil_mbcs_to_utf8(argv[i]); if( getenv("GATEWAY_INTERFACE")!=0 && !find_option("nocgi", 0, 0)){ zCmdName = "cgi"; }else if( argc<2 ){ fossil_fatal("Usage: %s COMMAND ...\n" "\"%s help\" for a list of available commands\n" "\"%s help COMMAND\" for specific details\n", | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 | if( cnt==1 ){ *pIndex = m; return 0; } return 1+(cnt>1); } /* ** Search g.argv for arguments "--args FILENAME". If found, then ** (1) remove the two arguments from g.argv ** (2) Read the file FILENAME ** (3) Use the contents of FILE to replace the two removed arguments: ** (a) Ignore blank lines in the file ** (b) Each non-empty line of the file is an argument, except ** (c) If the line begins with "-" and contains a space, it is broken ** into two arguments at the space. */ static void expand_args_option(void){ Blob file = empty_blob; /* Content of the file */ Blob line = empty_blob; /* One line of the file */ unsigned int nLine; /* Number of lines in the file*/ unsigned int i, j, k; /* Loop counters */ int n; /* Number of bytes in one line */ char *z; /* General use string pointer */ char **newArgv; /* New expanded g.argv under construction */ for(i=1; i<g.argc-1; i++){ z = g.argv[i]; if( z[0]!='-' ) continue; z++; if( z[0]=='-' ) z++; if( z[0]==0 ) return; /* Stop searching at "--" */ if( fossil_strcmp(z, "args")==0 ) break; } if( i>=g.argc-1 ) return; blob_read_from_file(&file, g.argv[i+1]); z = blob_str(&file); for(k=0, nLine=1; z[k]; k++) if( z[k]=='\n' ) nLine++; newArgv = fossil_malloc( sizeof(char*)*(g.argc + nLine*2) ); for(j=0; j<i; j++) newArgv[j] = g.argv[j]; blob_rewind(&file); while( (n = blob_line(&file, &line))>0 ){ if( n<=1 ) continue; z = blob_buffer(&line); z[n-1] = 0; newArgv[j++] = z; if( z[0]=='-' ){ for(k=1; z[k] && !fossil_isspace(z[k]); k++){} if( z[k] ){ z[k] = 0; k++; if( z[k] ) newArgv[j++] = &z[k]; } } } i += 2; while( i<g.argc ) newArgv[j++] = g.argv[i++]; newArgv[j] = 0; g.argc = j; g.argv = newArgv; } /* ** This procedure runs first. */ int main(int argc, char **argv){ const char *zCmdName = "unknown"; int idx; int rc; int i; sqlite3_config(SQLITE_CONFIG_LOG, fossil_sqlite_log, 0); g.now = time(0); g.argc = argc; g.argv = argv; expand_args_option(); argc = g.argc; argv = g.argv; for(i=0; i<argc; i++) g.argv[i] = fossil_mbcs_to_utf8(argv[i]); if( getenv("GATEWAY_INTERFACE")!=0 && !find_option("nocgi", 0, 0)){ zCmdName = "cgi"; }else if( argc<2 ){ fossil_fatal("Usage: %s COMMAND ...\n" "\"%s help\" for a list of available commands\n" "\"%s help COMMAND\" for specific details\n", |
︙ | ︙ |