diff -r f45fd4cd3832 -r 34654679f262 doc/doxygen/html/TestMasterSlave_2getopt_8c-source.html --- a/doc/doxygen/html/TestMasterSlave_2getopt_8c-source.html Fri Jul 06 10:53:15 2007 +0200 +++ b/doc/doxygen/html/TestMasterSlave_2getopt_8c-source.html Mon Jul 16 08:56:03 2007 +0200 @@ -18,7 +18,7 @@
00001 /* from http://www.pwilson.net/getopt.html */ 00002 00003 /* Getopt for GNU. @@ -72,7 +72,7 @@ 00051 program understand `configure --with-gnu-libc' and omit the object files, 00052 it is simpler to just do this in the source for each such file. */ 00053 -00054 #define GETOPT_INTERFACE_VERSION 2 +00054 #define GETOPT_INTERFACE_VERSION 2 00055 #if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2 00056 # include <gnu-versions.h> 00057 # if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION @@ -107,7 +107,7 @@ 00086 # define _(msgid) gettext (msgid) 00087 # endif 00088 # else -00089 # define _(msgid) (msgid) +00089 # define _(msgid) (msgid) 00090 # endif 00091 # if defined _LIBC && defined USE_IN_LIBIO 00092 # include <wchar.h> @@ -136,7 +136,7 @@ 00115 Also, when `ordering' is RETURN_IN_ORDER, 00116 each non-option ARGV-element is returned here. */ 00117 -00118 char *optarg; +00118 char *optarg; 00119 00120 /* Index in ARGV of the next element to be scanned. 00121 This is used for communication to and from the caller @@ -151,13 +151,13 @@ 00130 how much of ARGV has been scanned so far. */ 00131 00132 /* 1003.2 says this must be 1 before any call. */ -00133 int optind = 1; +00133 int optind = 1; 00134 00135 /* Formerly, initialization of getopt depended on optind==0, which 00136 causes problems with re-calling getopt as programs generally don't 00137 know that. */ 00138 -00139 int __getopt_initialized; +00139 int __getopt_initialized; 00140 00141 /* The next char to be scanned in the option-element 00142 in which the last option character we returned was found. @@ -171,13 +171,13 @@ 00150 /* Callers store zero here to inhibit the error message 00151 for unrecognized options. */ 00152 -00153 int opterr = 1; +00153 int opterr = 1; 00154 00155 /* Set to an option character which was unrecognized. 00156 This must be initialized on some systems to avoid linking in the 00157 system's own getopt implementation. */ 00158 -00159 int optopt = '?'; +00159 int optopt = '?'; 00160 00161 /* Describe how to deal with options that follow non-option ARGV-elements. 00162 @@ -210,7 +210,7 @@ 00189 00190 static enum 00191 { -00192 REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER +00192 REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER 00193 } ordering; 00194 00195 /* Value of POSIXLY_CORRECT environment variable. */ @@ -235,7 +235,7 @@ 00214 whose names are inconsistent. */ 00215 00216 #ifndef getenv -00217 extern char *getenv (); +00217 extern char *getenv (); 00218 #endif 00219 00220 static char * @@ -305,7 +305,7 @@ 00284 # define SWAP_FLAGS(ch1, ch2) 00285 # endif 00286 #else /* !_LIBC */ -00287 # define SWAP_FLAGS(ch1, ch2) +00287 # define SWAP_FLAGS(ch1, ch2) 00288 #endif /* _LIBC */ 00289 00290 /* Exchange two adjacent subsequences of ARGV. @@ -327,7 +327,7 @@ 00306 { 00307 int bottom = first_nonopt; 00308 int middle = last_nonopt; -00309 int top = optind; +00309 int top = optind; 00310 char *tem; 00311 00312 /* Exchange the shorter segment with the far end of the longer segment. @@ -371,7 +371,7 @@ 00350 tem = argv[bottom + i]; 00351 argv[bottom + i] = argv[top - (middle - bottom) + i]; 00352 argv[top - (middle - bottom) + i] = tem; -00353 SWAP_FLAGS (bottom + i, top - (middle - bottom) + i); +00353 SWAP_FLAGS (bottom + i, top - (middle - bottom) + i); 00354 } 00355 /* Exclude the moved bottom segment from further swapping. */ 00356 top -= len; @@ -388,7 +388,7 @@ 00367 tem = argv[bottom + i]; 00368 argv[bottom + i] = argv[middle + i]; 00369 argv[middle + i] = tem; -00370 SWAP_FLAGS (bottom + i, middle + i); +00370 SWAP_FLAGS (bottom + i, middle + i); 00371 } 00372 /* Exclude the moved top segment from further swapping. */ 00373 bottom += len; @@ -397,8 +397,8 @@ 00376 00377 /* Update records for the slots the non-options now occupy. */ 00378 -00379 first_nonopt += (optind - last_nonopt); -00380 last_nonopt = optind; +00379 first_nonopt += (optind - last_nonopt); +00380 last_nonopt = optind; 00381 } 00382 00383 /* Initialize the internal data when the first call is made. */ @@ -416,28 +416,28 @@ 00395 is the program name); the sequence of previously skipped 00396 non-option ARGV-elements is empty. */ 00397 -00398 first_nonopt = last_nonopt = optind; +00398 first_nonopt = last_nonopt = optind; 00399 00400 nextchar = NULL; 00401 -00402 posixly_correct = getenv ("POSIXLY_CORRECT"); +00402 posixly_correct = getenv ("POSIXLY_CORRECT"); 00403 00404 /* Determine how to handle the ordering of options and nonoptions. */ 00405 00406 if (optstring[0] == '-') 00407 { -00408 ordering = RETURN_IN_ORDER; +00408 ordering = RETURN_IN_ORDER; 00409 ++optstring; 00410 } 00411 else if (optstring[0] == '+') 00412 { -00413 ordering = REQUIRE_ORDER; +00413 ordering = REQUIRE_ORDER; 00414 ++optstring; 00415 } 00416 else if (posixly_correct != NULL) -00417 ordering = REQUIRE_ORDER; +00417 ordering = REQUIRE_ORDER; 00418 else -00419 ordering = PERMUTE; +00419 ordering = PERMUTE; 00420 00421 #if defined _LIBC && defined USE_NONOPTION_FLAGS 00422 if (posixly_correct == NULL @@ -529,7 +529,7 @@ 00508 long-named options. */ 00509 00510 int -00511 _getopt_internal (argc, argv, optstring, longopts, longind, long_only) +00511 _getopt_internal (argc, argv, optstring, longopts, longind, long_only) 00512 int argc; 00513 char *const *argv; 00514 const char *optstring; @@ -537,21 +537,21 @@ 00516 int *longind; 00517 int long_only; 00518 { -00519 int print_errors = opterr; +00519 int print_errors = opterr; 00520 if (optstring[0] == ':') 00521 print_errors = 0; 00522 00523 if (argc < 1) 00524 return -1; 00525 -00526 optarg = NULL; +00526 optarg = NULL; 00527 -00528 if (optind == 0 || !__getopt_initialized) +00528 if (optind == 0 || !__getopt_initialized) 00529 { -00530 if (optind == 0) -00531 optind = 1; /* Don't scan ARGV[0], the program name. */ +00530 if (optind == 0) +00531 optind = 1; /* Don't scan ARGV[0], the program name. */ 00532 optstring = _getopt_initialize (argc, argv, optstring); -00533 __getopt_initialized = 1; +00533 __getopt_initialized = 1; 00534 } 00535 00536 /* Test whether ARGV[optind] points to a non-option argument. @@ -572,27 +572,27 @@ 00551 00552 /* Give FIRST_NONOPT and LAST_NONOPT rational values if OPTIND has been 00553 moved back by the user (who may also have changed the arguments). */ -00554 if (last_nonopt > optind) -00555 last_nonopt = optind; -00556 if (first_nonopt > optind) -00557 first_nonopt = optind; +00554 if (last_nonopt > optind) +00555 last_nonopt = optind; +00556 if (first_nonopt > optind) +00557 first_nonopt = optind; 00558 -00559 if (ordering == PERMUTE) +00559 if (ordering == PERMUTE) 00560 { 00561 /* If we have just processed some options following some non-options, 00562 exchange them so that the options come first. */ 00563 -00564 if (first_nonopt != last_nonopt && last_nonopt != optind) +00564 if (first_nonopt != last_nonopt && last_nonopt != optind) 00565 exchange ((char **) argv); -00566 else if (last_nonopt != optind) -00567 first_nonopt = optind; +00566 else if (last_nonopt != optind) +00567 first_nonopt = optind; 00568 00569 /* Skip any additional non-options 00570 and extend the range of non-options previously skipped. */ 00571 -00572 while (optind < argc && NONOPTION_P) -00573 optind++; -00574 last_nonopt = optind; +00572 while (optind < argc && NONOPTION_P) +00573 optind++; +00574 last_nonopt = optind; 00575 } 00576 00577 /* The special ARGV-element `--' means premature end of options. @@ -600,7 +600,7 @@ 00579 then exchange with previous non-options as if it were an option, 00580 then skip everything else like a non-option. */ 00581 -00582 if (optind != argc && !strcmp (argv[optind], "--")) +00582 if (optind != argc && !strcmp (argv[optind], "--")) 00583 { 00584 optind++; 00585 @@ -628,11 +628,11 @@ 00607 /* If we have come to a non-option and did not permute it, 00608 either stop the scan or describe it to the caller and pass it by. */ 00609 -00610 if (NONOPTION_P) +00610 if (NONOPTION_P) 00611 { -00612 if (ordering == REQUIRE_ORDER) +00612 if (ordering == REQUIRE_ORDER) 00613 return -1; -00614 optarg = argv[optind++]; +00614 optarg = argv[optind++]; 00615 return 1; 00616 } 00617 @@ -659,8 +659,8 @@ 00638 This distinction seems to be the most useful approach. */ 00639 00640 if (longopts != NULL -00641 && (argv[optind][1] == '-' -00642 || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1]))))) +00641 && (argv[optind][1] == '-' +00642 || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1]))))) 00643 { 00644 char *nameend; 00645 const struct option *p; @@ -675,11 +675,11 @@ 00654 00655 /* Test all long options for either exact match 00656 or abbreviated matches. */ -00657 for (p = longopts, option_index = 0; p->name; p++, option_index++) -00658 if (!strncmp (p->name, nextchar, nameend - nextchar)) +00657 for (p = longopts, option_index = 0; p->name; p++, option_index++) +00658 if (!strncmp (p->name, nextchar, nameend - nextchar)) 00659 { 00660 if ((unsigned int) (nameend - nextchar) -00661 == (unsigned int) strlen (p->name)) +00661 == (unsigned int) strlen (p->name)) 00662 { 00663 /* Exact match found. */ 00664 pfound = p; @@ -708,8 +708,8 @@ 00687 #if defined _LIBC && defined USE_IN_LIBIO 00688 char *buf; 00689 -00690 __asprintf (&buf, _("%s: option `%s' is ambiguous\n"), -00691 argv[0], argv[optind]); +00690 __asprintf (&buf, _("%s: option `%s' is ambiguous\n"), +00691 argv[0], argv[optind]); 00692 00693 if (_IO_fwide (stderr, 0) > 0) 00694 __fwprintf (stderr, L"%s", buf); @@ -718,26 +718,26 @@ 00697 00698 free (buf); 00699 #else -00700 fprintf (stderr, _("%s: option `%s' is ambiguous\n"), -00701 argv[0], argv[optind]); +00700 fprintf (stderr, _("%s: option `%s' is ambiguous\n"), +00701 argv[0], argv[optind]); 00702 #endif 00703 } 00704 nextchar += strlen (nextchar); -00705 optind++; -00706 optopt = 0; +00705 optind++; +00706 optopt = 0; 00707 return '?'; 00708 } 00709 00710 if (pfound != NULL) 00711 { 00712 option_index = indfound; -00713 optind++; +00713 optind++; 00714 if (*nameend) 00715 { 00716 /* Don't test has_arg with >, because some C compilers don't 00717 allow it to be used on enums. */ 00718 if (pfound->has_arg) -00719 optarg = nameend + 1; +00719 optarg = nameend + 1; 00720 else 00721 { 00722 if (print_errors) @@ -746,15 +746,15 @@ 00725 char *buf; 00726 #endif 00727 -00728 if (argv[optind - 1][1] == '-') +00728 if (argv[optind - 1][1] == '-') 00729 { 00730 /* --option */ 00731 #if defined _LIBC && defined USE_IN_LIBIO -00732 __asprintf (&buf, _("\ +00732 __asprintf (&buf, _("\ 00733 %s: option `--%s' doesn't allow an argument\n"), 00734 argv[0], pfound->name); 00735 #else -00736 fprintf (stderr, _("\ +00736 fprintf (stderr, _("\ 00737 %s: option `--%s' doesn't allow an argument\n"), 00738 argv[0], pfound->name); 00739 #endif @@ -763,14 +763,14 @@ 00742 { 00743 /* +option or -option */ 00744 #if defined _LIBC && defined USE_IN_LIBIO -00745 __asprintf (&buf, _("\ +00745 __asprintf (&buf, _("\ 00746 %s: option `%c%s' doesn't allow an argument\n"), -00747 argv[0], argv[optind - 1][0], +00747 argv[0], argv[optind - 1][0], 00748 pfound->name); 00749 #else -00750 fprintf (stderr, _("\ +00750 fprintf (stderr, _("\ 00751 %s: option `%c%s' doesn't allow an argument\n"), -00752 argv[0], argv[optind - 1][0], pfound->name); +00752 argv[0], argv[optind - 1][0], pfound->name); 00753 #endif 00754 } 00755 @@ -786,14 +786,14 @@ 00765 00766 nextchar += strlen (nextchar); 00767 -00768 optopt = pfound->val; +00768 optopt = pfound->val; 00769 return '?'; 00770 } 00771 } 00772 else if (pfound->has_arg == 1) 00773 { -00774 if (optind < argc) -00775 optarg = argv[optind++]; +00774 if (optind < argc) +00775 optarg = argv[optind++]; 00776 else 00777 { 00778 if (print_errors) @@ -802,8 +802,8 @@ 00781 char *buf; 00782 00783 __asprintf (&buf, -00784 _("%s: option `%s' requires an argument\n"), -00785 argv[0], argv[optind - 1]); +00784 _("%s: option `%s' requires an argument\n"), +00785 argv[0], argv[optind - 1]); 00786 00787 if (_IO_fwide (stderr, 0) > 0) 00788 __fwprintf (stderr, L"%s", buf); @@ -813,12 +813,12 @@ 00792 free (buf); 00793 #else 00794 fprintf (stderr, -00795 _("%s: option `%s' requires an argument\n"), -00796 argv[0], argv[optind - 1]); +00795 _("%s: option `%s' requires an argument\n"), +00796 argv[0], argv[optind - 1]); 00797 #endif 00798 } 00799 nextchar += strlen (nextchar); -00800 optopt = pfound->val; +00800 optopt = pfound->val; 00801 return optstring[0] == ':' ? ':' : '?'; 00802 } 00803 } @@ -837,7 +837,7 @@ 00816 or the option starts with '--' or is not a valid short 00817 option, then it's an error. 00818 Otherwise interpret it as a short option. */ -00819 if (!long_only || argv[optind][1] == '-' +00819 if (!long_only || argv[optind][1] == '-' 00820 || my_index (optstring, *nextchar) == NULL) 00821 { 00822 if (print_errors) @@ -846,14 +846,14 @@ 00825 char *buf; 00826 #endif 00827 -00828 if (argv[optind][1] == '-') +00828 if (argv[optind][1] == '-') 00829 { 00830 /* --option */ 00831 #if defined _LIBC && defined USE_IN_LIBIO -00832 __asprintf (&buf, _("%s: unrecognized option `--%s'\n"), +00832 __asprintf (&buf, _("%s: unrecognized option `--%s'\n"), 00833 argv[0], nextchar); 00834 #else -00835 fprintf (stderr, _("%s: unrecognized option `--%s'\n"), +00835 fprintf (stderr, _("%s: unrecognized option `--%s'\n"), 00836 argv[0], nextchar); 00837 #endif 00838 } @@ -861,11 +861,11 @@ 00840 { 00841 /* +option or -option */ 00842 #if defined _LIBC && defined USE_IN_LIBIO -00843 __asprintf (&buf, _("%s: unrecognized option `%c%s'\n"), -00844 argv[0], argv[optind][0], nextchar); +00843 __asprintf (&buf, _("%s: unrecognized option `%c%s'\n"), +00844 argv[0], argv[optind][0], nextchar); 00845 #else -00846 fprintf (stderr, _("%s: unrecognized option `%c%s'\n"), -00847 argv[0], argv[optind][0], nextchar); +00846 fprintf (stderr, _("%s: unrecognized option `%c%s'\n"), +00847 argv[0], argv[optind][0], nextchar); 00848 #endif 00849 } 00850 @@ -879,8 +879,8 @@ 00858 #endif 00859 } 00860 nextchar = (char *) ""; -00861 optind++; -00862 optopt = 0; +00861 optind++; +00862 optopt = 0; 00863 return '?'; 00864 } 00865 } @@ -893,7 +893,7 @@ 00872 00873 /* Increment `optind' when we start to process its last character. */ 00874 if (*nextchar == '\0') -00875 ++optind; +00875 ++optind; 00876 00877 if (temp == NULL || c == ':') 00878 { @@ -907,19 +907,19 @@ 00886 { 00887 /* 1003.2 specifies the format of this message. */ 00888 #if defined _LIBC && defined USE_IN_LIBIO -00889 __asprintf (&buf, _("%s: illegal option -- %c\n"), +00889 __asprintf (&buf, _("%s: illegal option -- %c\n"), 00890 argv[0], c); 00891 #else -00892 fprintf (stderr, _("%s: illegal option -- %c\n"), argv[0], c); +00892 fprintf (stderr, _("%s: illegal option -- %c\n"), argv[0], c); 00893 #endif 00894 } 00895 else 00896 { 00897 #if defined _LIBC && defined USE_IN_LIBIO -00898 __asprintf (&buf, _("%s: invalid option -- %c\n"), +00898 __asprintf (&buf, _("%s: invalid option -- %c\n"), 00899 argv[0], c); 00900 #else -00901 fprintf (stderr, _("%s: invalid option -- %c\n"), argv[0], c); +00901 fprintf (stderr, _("%s: invalid option -- %c\n"), argv[0], c); 00902 #endif 00903 } 00904 @@ -932,7 +932,7 @@ 00911 free (buf); 00912 #endif 00913 } -00914 optopt = c; +00914 optopt = c; 00915 return '?'; 00916 } 00917 /* Convenience. Treat POSIX -W foo same as long option --foo */ @@ -949,12 +949,12 @@ 00928 /* This is an option that requires an argument. */ 00929 if (*nextchar != '\0') 00930 { -00931 optarg = nextchar; +00931 optarg = nextchar; 00932 /* If we end this ARGV-element by taking the rest as an arg, 00933 we must advance to the next element now. */ -00934 optind++; +00934 optind++; 00935 } -00936 else if (optind == argc) +00936 else if (optind == argc) 00937 { 00938 if (print_errors) 00939 { @@ -962,7 +962,7 @@ 00941 #if defined _LIBC && defined USE_IN_LIBIO 00942 char *buf; 00943 -00944 __asprintf (&buf, _("%s: option requires an argument -- %c\n"), +00944 __asprintf (&buf, _("%s: option requires an argument -- %c\n"), 00945 argv[0], c); 00946 00947 if (_IO_fwide (stderr, 0) > 0) @@ -972,11 +972,11 @@ 00951 00952 free (buf); 00953 #else -00954 fprintf (stderr, _("%s: option requires an argument -- %c\n"), +00954 fprintf (stderr, _("%s: option requires an argument -- %c\n"), 00955 argv[0], c); 00956 #endif 00957 } -00958 optopt = c; +00958 optopt = c; 00959 if (optstring[0] == ':') 00960 c = ':'; 00961 else @@ -986,20 +986,20 @@ 00965 else 00966 /* We already incremented `optind' once; 00967 increment it again when taking next ARGV-elt as argument. */ -00968 optarg = argv[optind++]; +00968 optarg = argv[optind++]; 00969 00970 /* optarg is now the argument, see if it's in the 00971 table of longopts. */ 00972 -00973 for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++) +00973 for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++) 00974 /* Do nothing. */ ; 00975 00976 /* Test all long options for either exact match 00977 or abbreviated matches. */ -00978 for (p = longopts, option_index = 0; p->name; p++, option_index++) -00979 if (!strncmp (p->name, nextchar, nameend - nextchar)) +00978 for (p = longopts, option_index = 0; p->name; p++, option_index++) +00979 if (!strncmp (p->name, nextchar, nameend - nextchar)) 00980 { -00981 if ((unsigned int) (nameend - nextchar) == strlen (p->name)) +00981 if ((unsigned int) (nameend - nextchar) == strlen (p->name)) 00982 { 00983 /* Exact match found. */ 00984 pfound = p; @@ -1024,8 +1024,8 @@ 01003 #if defined _LIBC && defined USE_IN_LIBIO 01004 char *buf; 01005 -01006 __asprintf (&buf, _("%s: option `-W %s' is ambiguous\n"), -01007 argv[0], argv[optind]); +01006 __asprintf (&buf, _("%s: option `-W %s' is ambiguous\n"), +01007 argv[0], argv[optind]); 01008 01009 if (_IO_fwide (stderr, 0) > 0) 01010 __fwprintf (stderr, L"%s", buf); @@ -1034,12 +1034,12 @@ 01013 01014 free (buf); 01015 #else -01016 fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"), -01017 argv[0], argv[optind]); +01016 fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"), +01017 argv[0], argv[optind]); 01018 #endif 01019 } 01020 nextchar += strlen (nextchar); -01021 optind++; +01021 optind++; 01022 return '?'; 01023 } 01024 if (pfound != NULL) @@ -1049,8 +1049,8 @@ 01028 { 01029 /* Don't test has_arg with >, because some C compilers don't 01030 allow it to be used on enums. */ -01031 if (pfound->has_arg) -01032 optarg = nameend + 1; +01031 if (pfound->has_arg) +01032 optarg = nameend + 1; 01033 else 01034 { 01035 if (print_errors) @@ -1058,9 +1058,9 @@ 01037 #if defined _LIBC && defined USE_IN_LIBIO 01038 char *buf; 01039 -01040 __asprintf (&buf, _("\ +01040 __asprintf (&buf, _("\ 01041 %s: option `-W %s' doesn't allow an argument\n"), -01042 argv[0], pfound->name); +01042 argv[0], pfound->name); 01043 01044 if (_IO_fwide (stderr, 0) > 0) 01045 __fwprintf (stderr, L"%s", buf); @@ -1069,9 +1069,9 @@ 01048 01049 free (buf); 01050 #else -01051 fprintf (stderr, _("\ +01051 fprintf (stderr, _("\ 01052 %s: option `-W %s' doesn't allow an argument\n"), -01053 argv[0], pfound->name); +01053 argv[0], pfound->name); 01054 #endif 01055 } 01056 @@ -1079,10 +1079,10 @@ 01058 return '?'; 01059 } 01060 } -01061 else if (pfound->has_arg == 1) +01061 else if (pfound->has_arg == 1) 01062 { -01063 if (optind < argc) -01064 optarg = argv[optind++]; +01063 if (optind < argc) +01064 optarg = argv[optind++]; 01065 else 01066 { 01067 if (print_errors) @@ -1090,9 +1090,9 @@ 01069 #if defined _LIBC && defined USE_IN_LIBIO 01070 char *buf; 01071 -01072 __asprintf (&buf, _("\ +01072 __asprintf (&buf, _("\ 01073 %s: option `%s' requires an argument\n"), -01074 argv[0], argv[optind - 1]); +01074 argv[0], argv[optind - 1]); 01075 01076 if (_IO_fwide (stderr, 0) > 0) 01077 __fwprintf (stderr, L"%s", buf); @@ -1102,8 +1102,8 @@ 01081 free (buf); 01082 #else 01083 fprintf (stderr, -01084 _("%s: option `%s' requires an argument\n"), -01085 argv[0], argv[optind - 1]); +01084 _("%s: option `%s' requires an argument\n"), +01085 argv[0], argv[optind - 1]); 01086 #endif 01087 } 01088 nextchar += strlen (nextchar); @@ -1113,12 +1113,12 @@ 01092 nextchar += strlen (nextchar); 01093 if (longind != NULL) 01094 *longind = option_index; -01095 if (pfound->flag) +01095 if (pfound->flag) 01096 { -01097 *(pfound->flag) = pfound->val; +01097 *(pfound->flag) = pfound->val; 01098 return 0; 01099 } -01100 return pfound->val; +01100 return pfound->val; 01101 } 01102 nextchar = NULL; 01103 return 'W'; /* Let the application handle it. */ @@ -1130,11 +1130,11 @@ 01109 /* This is an option that accepts an argument optionally. */ 01110 if (*nextchar != '\0') 01111 { -01112 optarg = nextchar; -01113 optind++; +01112 optarg = nextchar; +01113 optind++; 01114 } 01115 else -01116 optarg = NULL; +01116 optarg = NULL; 01117 nextchar = NULL; 01118 } 01119 else @@ -1142,12 +1142,12 @@ 01121 /* This is an option that requires an argument. */ 01122 if (*nextchar != '\0') 01123 { -01124 optarg = nextchar; +01124 optarg = nextchar; 01125 /* If we end this ARGV-element by taking the rest as an arg, 01126 we must advance to the next element now. */ -01127 optind++; +01127 optind++; 01128 } -01129 else if (optind == argc) +01129 else if (optind == argc) 01130 { 01131 if (print_errors) 01132 { @@ -1156,7 +1156,7 @@ 01135 char *buf; 01136 01137 __asprintf (&buf, -01138 _("%s: option requires an argument -- %c\n"), +01138 _("%s: option requires an argument -- %c\n"), 01139 argv[0], c); 01140 01141 if (_IO_fwide (stderr, 0) > 0) @@ -1167,11 +1167,11 @@ 01146 free (buf); 01147 #else 01148 fprintf (stderr, -01149 _("%s: option requires an argument -- %c\n"), +01149 _("%s: option requires an argument -- %c\n"), 01150 argv[0], c); 01151 #endif 01152 } -01153 optopt = c; +01153 optopt = c; 01154 if (optstring[0] == ':') 01155 c = ':'; 01156 else @@ -1180,7 +1180,7 @@ 01159 else 01160 /* We already incremented `optind' once; 01161 increment it again when taking next ARGV-elt as argument. */ -01162 optarg = argv[optind++]; +01162 optarg = argv[optind++]; 01163 nextchar = NULL; 01164 } 01165 } @@ -1189,12 +1189,12 @@ 01168 } 01169 01170 int -01171 getopt (argc, argv, optstring) +01171 getopt (argc, argv, optstring) 01172 int argc; 01173 char *const *argv; 01174 const char *optstring; 01175 { -01176 return _getopt_internal (argc, argv, optstring, +01176 return _getopt_internal (argc, argv, optstring, 01177 (const struct option *) 0, 01178 (int *) 0, 01179 0); @@ -1214,7 +1214,7 @@ 01193 #endif /* Pete Wilson mod 7/28/02 */ 01194 01195 int -01196 main (argc, argv) +01196 main (argc, argv) 01197 int argc; 01198 char **argv; 01199 { @@ -1223,9 +1223,9 @@ 01202 01203 while (1) 01204 { -01205 int this_option_optind = optind ? optind : 1; +01205 int this_option_optind = optind ? optind : 1; 01206 -01207 c = getopt (argc, argv, "abc:d:0123456789"); +01207 c = getopt (argc, argv, "abc:d:0123456789"); 01208 if (c == -1) 01209 break; 01210 @@ -1256,7 +1256,7 @@ 01235 break; 01236 01237 case 'c': -01238 printf ("option c with value `%s'\n", optarg); +01238 printf ("option c with value `%s'\n", optarg); 01239 break; 01240 01241 case '?': @@ -1267,11 +1267,11 @@ 01246 } 01247 } 01248 -01249 if (optind < argc) +01249 if (optind < argc) 01250 { 01251 printf ("non-option ARGV-elements: "); -01252 while (optind < argc) -01253 printf ("%s ", argv[optind++]); +01252 while (optind < argc) +01253 printf ("%s ", argv[optind++]); 01254 printf ("\n"); 01255 } 01256 @@ -1279,7 +1279,7 @@ 01258 } 01259 01260 #endif /* TEST */ -