Changeset 545 for trunk/src/ocat.c
- Timestamp:
- 02/11/10 14:42:19 (2 years ago)
- File:
-
- 1 edited
-
trunk/src/ocat.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/ocat.c
r543 r545 271 271 272 272 273 void parse_opt_early(int argc, char *argv [])273 void parse_opt_early(int argc, char *argv_orig[]) 274 274 { 275 275 int c; 276 276 char *argv[argc + 1]; 277 278 log_debug("parse_opt_early()"); 279 // argv array is copied to prevent the original one from being modified by 280 // getopt(). This behavior is at least true for Linux. 281 memcpy(&argv, argv_orig, sizeof(char*) * (argc + 1)); 277 282 opterr = 0; 278 283 while ((c = getopt(argc, argv, "f:I")) != -1) 284 { 285 log_debug("getopt(): c = %c, optind = %d, opterr = %d, optarg = \"%s\"", c, optind, opterr, optarg); 279 286 switch (c) 280 287 { … … 291 298 break; 292 299 } 300 } 293 301 } 294 302 … … 298 306 int c, urlconv = 0; 299 307 308 log_debug("parse_opt_early()"); 300 309 opterr = 1; 301 310 optind = 1; 302 311 while ((c = getopt(argc, argv, "f:IabBCd:hrRiopl:t:T:s:u:4L:P:")) != -1) 312 { 313 log_debug("getopt(): c = %c, optind = %d, opterr = %d, optarg = \"%s\"", c, optind, opterr, optarg); 303 314 switch (c) 304 315 { … … 399 410 exit(1); 400 411 } 412 } 401 413 402 414 return urlconv; … … 423 435 } 424 436 437 #ifdef DEBUG 438 for (c = 0; c < argc; c++) log_debug("argv[%d] = \"%s\"", c, argv[c]); 439 #endif 425 440 parse_opt_early(argc, argv); 426 441 … … 439 454 ctrl_handler((void*) (long) c); 440 455 441 456 #ifdef DEBUG 457 for (c = 0; c < argc; c++) log_debug("argv[%d] = \"%s\"", c, argv[c]); 458 #endif 442 459 urlconv = parse_opt(argc, argv); 443 460 … … 480 497 481 498 // copy onion-URL from command line 499 log_debug("argv[%d] = \"%s\"", optind, argv[optind]); 482 500 if (!CNF(rand_addr)) 483 501 strncpy(CNF(onion_url), argv[optind], NDESC(name_size));
Note: See TracChangeset
for help on using the changeset viewer.
