Changeset 545


Ignore:
Timestamp:
02/11/10 14:42:19 (2 years ago)
Author:
eagle
Message:

parse options twice caused some troubles at least on Linux.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/configure

    r544 r545  
    11#! /bin/sh 
    22# Guess values for system-dependent variables and create Makefiles. 
    3 # Generated by GNU Autoconf 2.62 for onioncat 0.2.2.r544. 
     3# Generated by GNU Autoconf 2.62 for onioncat 0.2.2.r545. 
    44# 
    55# Report bugs to <rahra@cypherpunk.at>. 
     
    597597PACKAGE_NAME='onioncat' 
    598598PACKAGE_TARNAME='onioncat' 
    599 PACKAGE_VERSION='0.2.2.r544' 
    600 PACKAGE_STRING='onioncat 0.2.2.r544' 
     599PACKAGE_VERSION='0.2.2.r545' 
     600PACKAGE_STRING='onioncat 0.2.2.r545' 
    601601PACKAGE_BUGREPORT='rahra@cypherpunk.at' 
    602602 
     
    12611261  # This message is too long to be a string in the A/UX 3.1 sh. 
    12621262  cat <<_ACEOF 
    1263 \`configure' configures onioncat 0.2.2.r544 to adapt to many kinds of systems. 
     1263\`configure' configures onioncat 0.2.2.r545 to adapt to many kinds of systems. 
    12641264 
    12651265Usage: $0 [OPTION]... [VAR=VALUE]... 
     
    13311331if test -n "$ac_init_help"; then 
    13321332  case $ac_init_help in 
    1333      short | recursive ) echo "Configuration of onioncat 0.2.2.r544:";; 
     1333     short | recursive ) echo "Configuration of onioncat 0.2.2.r545:";; 
    13341334   esac 
    13351335  cat <<\_ACEOF 
     
    14231423if $ac_init_version; then 
    14241424  cat <<\_ACEOF 
    1425 onioncat configure 0.2.2.r544 
     1425onioncat configure 0.2.2.r545 
    14261426generated by GNU Autoconf 2.62 
    14271427 
     
    14371437running configure, to aid debugging if configure makes a mistake. 
    14381438 
    1439 It was created by onioncat $as_me 0.2.2.r544, which was 
     1439It was created by onioncat $as_me 0.2.2.r545, which was 
    14401440generated by GNU Autoconf 2.62.  Invocation command line was 
    14411441 
     
    20862086# Define the identity of the package. 
    20872087 PACKAGE='onioncat' 
    2088  VERSION='0.2.2.r544' 
     2088 VERSION='0.2.2.r545' 
    20892089 
    20902090 
     
    22372237 
    22382238cat >>confdefs.h <<\_ACEOF 
    2239 #define SVN_REVISION "544" 
     2239#define SVN_REVISION "545" 
    22402240_ACEOF 
    22412241 
     
    53265326# values after options handling. 
    53275327ac_log=" 
    5328 This file was extended by onioncat $as_me 0.2.2.r544, which was 
     5328This file was extended by onioncat $as_me 0.2.2.r545, which was 
    53295329generated by GNU Autoconf 2.62.  Invocation command line was 
    53305330 
     
    53795379cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 
    53805380ac_cs_version="\\ 
    5381 onioncat config.status 0.2.2.r544 
     5381onioncat config.status 0.2.2.r545 
    53825382configured by $0, generated by GNU Autoconf 2.62, 
    53835383  with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" 
  • trunk/src/ocat.c

    r543 r545  
    271271 
    272272 
    273 void parse_opt_early(int argc, char *argv[]) 
     273void parse_opt_early(int argc, char *argv_orig[]) 
    274274{ 
    275275   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)); 
    277282   opterr = 0; 
    278283   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); 
    279286      switch (c) 
    280287      { 
     
    291298            break; 
    292299      } 
     300   } 
    293301} 
    294302 
     
    298306   int c, urlconv = 0; 
    299307 
     308   log_debug("parse_opt_early()"); 
    300309   opterr = 1; 
    301310   optind = 1; 
    302311   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); 
    303314      switch (c) 
    304315      { 
     
    399410            exit(1); 
    400411      } 
     412   } 
    401413 
    402414   return urlconv; 
     
    423435   } 
    424436 
     437#ifdef DEBUG 
     438   for (c = 0; c < argc; c++) log_debug("argv[%d] = \"%s\"", c, argv[c]); 
     439#endif 
    425440   parse_opt_early(argc, argv); 
    426441 
     
    439454      ctrl_handler((void*) (long) c); 
    440455  
    441  
     456#ifdef DEBUG 
     457   for (c = 0; c < argc; c++) log_debug("argv[%d] = \"%s\"", c, argv[c]); 
     458#endif 
    442459   urlconv = parse_opt(argc, argv); 
    443460 
     
    480497 
    481498   // copy onion-URL from command line 
     499   log_debug("argv[%d] = \"%s\"", optind, argv[optind]); 
    482500   if (!CNF(rand_addr)) 
    483501      strncpy(CNF(onion_url), argv[optind], NDESC(name_size)); 
Note: See TracChangeset for help on using the changeset viewer.