getopt.cpp
Go to the documentation of this file.
00001 /* Getopt for GNU.
00002    NOTE: getopt is now part of the C library, so if you don't know what
00003    "Keep this file name-space clean" means, talk to roland@gnu.ai.mit.edu
00004    before changing it!
00005 
00006    Copyright (C) 1987, 88, 89, 90, 91, 92, 1993
00007            Free Software Foundation, Inc.
00008 
00009    This program is free software; you can redistribute it and/or modify it
00010    under the terms of the GNU General Public License as published by the
00011    Free Software Foundation; either version 2, or (at your option) any
00012    later version.
00013 
00014    This program is distributed in the hope that it will be useful,
00015    but WITHOUT ANY WARRANTY; without even the implied warranty of
00016    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017    GNU General Public License for more details.
00018 
00019    You should have received a copy of the GNU General Public License
00020    along with this program; if not, write to the Free Software
00021    Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
00022 
00023 
00024 
00025 /* NOTE!!!  AIX requires this to be the first thing in the file.
00026    Do not put ANYTHING before it!  */
00027 
00028 #ifdef HAVE_CONFIG_H
00029 # include <config.h>
00030 #endif /* HAVE_CONFIG_H */
00031 
00032 #if !__STDC__ && !defined(const) && IN_GCC
00033 #define const
00034 #endif
00035 
00036 /* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>.  */
00037 #ifndef _NO_PROTO
00038 #define _NO_PROTO
00039 #endif
00040 
00041 #include <stdio.h>
00042 #define HAVE_STRING_H
00043 #ifdef HAVE_STRING_H
00044 # include <string.h>
00045 #else
00046 # include <strings.h>
00047 #endif
00048 
00049 /* alloca header */
00050 #ifdef WIN32
00051 #include <malloc.h>
00052 #endif
00053 
00054 /* Comment out all this code if we are using the GNU C Library, and are not
00055    actually compiling the library itself.  This code is part of the GNU C
00056    Library, but also included in many other GNU distributions.  Compiling
00057    and linking in this code is a waste when using the GNU C library
00058    (especially if it is a shared library).  Rather than having every GNU
00059    program understand `configure --with-gnu-libc' and omit the object files,
00060    it is simpler to just do this in the source for each such file.  */
00061 
00062 #if defined (_LIBC) || !defined (__GNU_LIBRARY__)
00063 
00064 
00065 #include <stdlib.h>
00066 
00067 /* If GETOPT_COMPAT is defined, `+' as well as `--' can introduce a
00068    long-named option.  Because this is not POSIX.2 compliant, it is
00069    being phased out.  */
00070 /* #define GETOPT_COMPAT */
00071 
00072 /* This version of `getopt' appears to the caller like standard Unix `getopt'
00073    but it behaves differently for the user, since it allows the user
00074    to intersperse the options with the other arguments.
00075 
00076    As `getopt' works, it permutes the elements of ARGV so that,
00077    when it is done, all the options precede everything else.  Thus
00078    all application programs are extended to handle flexible argument order.
00079 
00080    Setting the environment variable POSIXLY_CORRECT disables permutation.
00081    Then the behavior is completely standard.
00082 
00083    GNU application programs can use a third alternative mode in which
00084    they can distinguish the relative order of options and other arguments.  */
00085 
00086 /* `gettext (FOO)' is long to write, so we use `_(FOO)'.  If NLS is
00087    unavailable, _(STRING) simply returns STRING.  */
00088 #ifdef HAVE_NLS
00089 # define _(string) gettext (string)
00090 # ifdef HAVE_LIBINTL_H
00091 #  include <libintl.h>
00092 # endif /* HAVE_LIBINTL_H */
00093 #else  /* not HAVE_NLS */
00094 # define _(string) string
00095 #endif /* not HAVE_NLS */
00096 
00097 #include "getopt.h"
00098 
00099 const char *exec_name;
00100 
00101 /* For communication from `getopt' to the caller.
00102    When `getopt' finds an option that takes an argument,
00103    the argument value is returned here.
00104    Also, when `ordering' is RETURN_IN_ORDER,
00105    each non-option ARGV-element is returned here.  */
00106 
00107 char *optarg = 0;
00108 
00109 /* Index in ARGV of the next element to be scanned.
00110    This is used for communication to and from the caller
00111    and for communication between successive calls to `getopt'.
00112 
00113    On entry to `getopt', zero means this is the first call; initialize.
00114 
00115    When `getopt' returns EOF, this is the index of the first of the
00116    non-option elements that the caller should itself scan.
00117 
00118    Otherwise, `optind' communicates from one call to the next
00119    how much of ARGV has been scanned so far.  */
00120 
00121 /* XXX 1003.2 says this must be 1 before any call.  */
00122 int optind = 0;
00123 
00124 /* The next char to be scanned in the option-element
00125    in which the last option character we returned was found.
00126    This allows us to pick up the scan where we left off.
00127 
00128    If this is zero, or a null string, it means resume the scan
00129    by advancing to the next ARGV-element.  */
00130 
00131 static char *nextchar;
00132 
00133 /* Callers store zero here to inhibit the error message
00134    for unrecognized options.  */
00135 
00136 int opterr = 1;
00137 
00138 /* Set to an option character which was unrecognized.
00139    This must be initialized on some systems to avoid linking in the
00140    system's own getopt implementation.  */
00141 
00142 int optopt = '?';
00143 
00144 /* Describe how to deal with options that follow non-option ARGV-elements.
00145 
00146    If the caller did not specify anything,
00147    the default is REQUIRE_ORDER if the environment variable
00148    POSIXLY_CORRECT is defined, PERMUTE otherwise.
00149 
00150    REQUIRE_ORDER means don't recognize them as options;
00151    stop option processing when the first non-option is seen.
00152    This is what Unix does.
00153    This mode of operation is selected by either setting the environment
00154    variable POSIXLY_CORRECT, or using `+' as the first character
00155    of the list of option characters.
00156 
00157    PERMUTE is the default.  We permute the contents of ARGV as we scan,
00158    so that eventually all the non-options are at the end.  This allows options
00159    to be given in any order, even with programs that were not written to
00160    expect this.
00161 
00162    RETURN_IN_ORDER is an option available to programs that were written
00163    to expect options and other ARGV-elements in any order and that care about
00164    the ordering of the two.  We describe each non-option ARGV-element
00165    as if it were the argument of an option with character code 1.
00166    Using `-' as the first character of the list of option characters
00167    selects this mode of operation.
00168 
00169    The special argument `--' forces an end of option-scanning regardless
00170    of the value of `ordering'.  In the case of RETURN_IN_ORDER, only
00171    `--' can cause `getopt' to return EOF with `optind' != ARGC.  */
00172 
00173 static enum
00174 {
00175   REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
00176 } ordering;
00177 
00178 #ifdef        __GNU_LIBRARY__
00179 /* We want to avoid inclusion of string.h with non-GNU libraries
00180    because there are many ways it can cause trouble.
00181    On some systems, it contains special magic macros that don't work
00182    in GCC.  */
00183 #include <string.h>
00184 #define        my_index        strchr
00185 #define        my_bcopy(src, dst, n)        memcpy ((dst), (src), (n))
00186 #else
00187 
00188 /* Avoid depending on library functions or files
00189    whose names are inconsistent.  */
00190 
00191 char *getenv ();
00192 
00193 static char *
00194 my_index (const char *str, int chr)
00195 {
00196   while (*str)
00197     {
00198       if (*str == chr)
00199         return (char *) str;
00200       str++;
00201     }
00202   return 0;
00203 }
00204 
00205 static void
00206 my_bcopy (const char *from, char *to, int size)
00207 {
00208   int i;
00209   for (i = 0; i < size; i++)
00210     to[i] = from[i];
00211 }
00212 #endif                                /* GNU C library.  */
00213 
00214 /* Handle permutation of arguments.  */
00215 
00216 /* Describe the part of ARGV that contains non-options that have
00217    been skipped.  `first_nonopt' is the index in ARGV of the first of them;
00218    `last_nonopt' is the index after the last of them.  */
00219 
00220 static int first_nonopt;
00221 static int last_nonopt;
00222 
00223 /* Exchange two adjacent subsequences of ARGV.
00224    One subsequence is elements [first_nonopt,last_nonopt)
00225    which contains all the non-options that have been skipped so far.
00226    The other is elements [last_nonopt,optind), which contains all
00227    the options processed since those non-options were skipped.
00228 
00229    `first_nonopt' and `last_nonopt' are relocated so that they describe
00230    the new indices of the non-options in ARGV after they are moved.  */
00231 
00232 static void
00233 exchange (char **argv)
00234 {
00235   int nonopts_size = (last_nonopt - first_nonopt) * sizeof (char *);
00236   char **temp = (char **) alloca (nonopts_size);
00237 
00238   /* Interchange the two blocks of data in ARGV.  */
00239 
00240   my_bcopy ((char *) &argv[first_nonopt], (char *) temp, nonopts_size);
00241   my_bcopy ((char *) &argv[last_nonopt], (char *) &argv[first_nonopt],
00242             (optind - last_nonopt) * sizeof (char *));
00243   my_bcopy ((char *) temp,
00244             (char *) &argv[first_nonopt + optind - last_nonopt],
00245             nonopts_size);
00246 
00247   /* Update records for the slots the non-options now occupy.  */
00248 
00249   first_nonopt += (optind - last_nonopt);
00250   last_nonopt = optind;
00251 }
00252 
00253 /* Scan elements of ARGV (whose length is ARGC) for option characters
00254    given in OPTSTRING.
00255 
00256    If an element of ARGV starts with '-', and is not exactly "-" or "--",
00257    then it is an option element.  The characters of this element
00258    (aside from the initial '-') are option characters.  If `getopt'
00259    is called repeatedly, it returns successively each of the option characters
00260    from each of the option elements.
00261 
00262    If `getopt' finds another option character, it returns that character,
00263    updating `optind' and `nextchar' so that the next call to `getopt' can
00264    resume the scan with the following option character or ARGV-element.
00265 
00266    If there are no more option characters, `getopt' returns `EOF'.
00267    Then `optind' is the index in ARGV of the first ARGV-element
00268    that is not an option.  (The ARGV-elements have been permuted
00269    so that those that are not options now come last.)
00270 
00271    OPTSTRING is a string containing the legitimate option characters.
00272    If an option character is seen that is not listed in OPTSTRING,
00273    return '?' after printing an error message.  If you set `opterr' to
00274    zero, the error message is suppressed but we still return '?'.
00275 
00276    If a char in OPTSTRING is followed by a colon, that means it wants an arg,
00277    so the following text in the same ARGV-element, or the text of the following
00278    ARGV-element, is returned in `optarg'.  Two colons mean an option that
00279    wants an optional arg; if there is text in the current ARGV-element,
00280    it is returned in `optarg', otherwise `optarg' is set to zero.
00281 
00282    If OPTSTRING starts with `-' or `+', it requests different methods of
00283    handling the non-option ARGV-elements.
00284    See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above.
00285 
00286    Long-named options begin with `--' instead of `-'.
00287    Their names may be abbreviated as long as the abbreviation is unique
00288    or is an exact match for some defined option.  If they have an
00289    argument, it follows the option name in the same ARGV-element, separated
00290    from the option name by a `=', or else the in next ARGV-element.
00291    When `getopt' finds a long-named option, it returns 0 if that option's
00292    `flag' field is nonzero, the value of the option's `val' field
00293    if the `flag' field is zero.
00294 
00295    The elements of ARGV aren't really const, because we permute them.
00296    But we pretend they're const in the prototype to be compatible
00297    with other systems.
00298 
00299    LONGOPTS is a vector of `struct option' terminated by an
00300    element containing a name which is zero.
00301 
00302    LONGIND returns the index in LONGOPT of the long-named option found.
00303    It is only valid when a long-named option has been found by the most
00304    recent call.
00305 
00306    If LONG_ONLY is nonzero, '-' as well as '--' can introduce
00307    long-named options.  */
00308 
00309 int
00310 _getopt_internal (int argc, char *const *argv, const char *optstring,
00311                   const struct option *longopts, int *longind, int long_only)
00312 {
00313   int option_index;
00314 
00315   optarg = 0;
00316 
00317   /* Initialize the internal data when the first call is made.
00318      Start processing options with ARGV-element 1 (since ARGV-element 0
00319      is the program name); the sequence of previously skipped
00320      non-option ARGV-elements is empty.  */
00321 
00322   if (optind == 0)
00323     {
00324       first_nonopt = last_nonopt = optind = 1;
00325 
00326       nextchar = NULL;
00327 
00328       /* Determine how to handle the ordering of options and nonoptions.  */
00329 
00330       if (optstring[0] == '-')
00331         {
00332           ordering = RETURN_IN_ORDER;
00333           ++optstring;
00334         }
00335       else if (optstring[0] == '+')
00336         {
00337           ordering = REQUIRE_ORDER;
00338           ++optstring;
00339         }
00340       else if (getenv ("POSIXLY_CORRECT") != NULL)
00341         ordering = REQUIRE_ORDER;
00342       else
00343         ordering = PERMUTE;
00344     }
00345 
00346   if (nextchar == NULL || *nextchar == '\0')
00347     {
00348       if (ordering == PERMUTE)
00349         {
00350           /* If we have just processed some options following some non-options,
00351              exchange them so that the options come first.  */
00352 
00353           if (first_nonopt != last_nonopt && last_nonopt != optind)
00354             exchange ((char **) argv);
00355           else if (last_nonopt != optind)
00356             first_nonopt = optind;
00357 
00358           /* Now skip any additional non-options
00359              and extend the range of non-options previously skipped.  */
00360 
00361           while (optind < argc
00362                  && (argv[optind][0] != '-' || argv[optind][1] == '\0')
00363 #ifdef GETOPT_COMPAT
00364                  && (longopts == NULL
00365                      || argv[optind][0] != '+' || argv[optind][1] == '\0')
00366 #endif                                /* GETOPT_COMPAT */
00367                  )
00368             optind++;
00369           last_nonopt = optind;
00370         }
00371 
00372       /* Special ARGV-element `--' means premature end of options.
00373          Skip it like a null option,
00374          then exchange with previous non-options as if it were an option,
00375          then skip everything else like a non-option.  */
00376 
00377       if (optind != argc && !strcmp (argv[optind], "--"))
00378         {
00379           optind++;
00380 
00381           if (first_nonopt != last_nonopt && last_nonopt != optind)
00382             exchange ((char **) argv);
00383           else if (first_nonopt == last_nonopt)
00384             first_nonopt = optind;
00385           last_nonopt = argc;
00386 
00387           optind = argc;
00388         }
00389 
00390       /* If we have done all the ARGV-elements, stop the scan
00391          and back over any non-options that we skipped and permuted.  */
00392 
00393       if (optind == argc)
00394         {
00395           /* Set the next-arg-index to point at the non-options
00396              that we previously skipped, so the caller will digest them.  */
00397           if (first_nonopt != last_nonopt)
00398             optind = first_nonopt;
00399           return EOF;
00400         }
00401 
00402       /* If we have come to a non-option and did not permute it,
00403          either stop the scan or describe it to the caller and pass it by.  */
00404 
00405       if ((argv[optind][0] != '-' || argv[optind][1] == '\0')
00406 #ifdef GETOPT_COMPAT
00407           && (longopts == NULL
00408               || argv[optind][0] != '+' || argv[optind][1] == '\0')
00409 #endif                                /* GETOPT_COMPAT */
00410           )
00411         {
00412           if (ordering == REQUIRE_ORDER)
00413             return EOF;
00414           optarg = argv[optind++];
00415           return 1;
00416         }
00417 
00418       /* We have found another option-ARGV-element.
00419          Start decoding its characters.  */
00420 
00421       nextchar = (argv[optind] + 1
00422                   + (longopts != NULL && argv[optind][1] == '-'));
00423     }
00424 
00425   if (longopts != NULL
00426       && ((argv[optind][0] == '-'
00427            && (argv[optind][1] == '-' || long_only))
00428 #ifdef GETOPT_COMPAT
00429           || argv[optind][0] == '+'
00430 #endif                                /* GETOPT_COMPAT */
00431           ))
00432     {
00433       const struct option *p;
00434       char *s = nextchar;
00435       int exact = 0;
00436       int ambig = 0;
00437       const struct option *pfound = NULL;
00438       int indfound;
00439 
00440       indfound = 0;             /* To silence the compiler.  */
00441 
00442       while (*s && *s != '=')
00443         s++;
00444 
00445       /* Test all options for either exact match or abbreviated matches.  */
00446       for (p = longopts, option_index = 0; p->name;
00447            p++, option_index++)
00448         if (!strncmp (p->name, nextchar, s - nextchar))
00449           {
00450             if (s - nextchar == strlen (p->name))
00451               {
00452                 /* Exact match found.  */
00453                 pfound = p;
00454                 indfound = option_index;
00455                 exact = 1;
00456                 break;
00457               }
00458             else if (pfound == NULL)
00459               {
00460                 /* First nonexact match found.  */
00461                 pfound = p;
00462                 indfound = option_index;
00463               }
00464             else
00465               /* Second nonexact match found.  */
00466               ambig = 1;
00467           }
00468 
00469       if (ambig && !exact)
00470         {
00471           if (opterr)
00472             fprintf (stderr, _("%s: option `%s' is ambiguous\n"),
00473                      exec_name, argv[optind]);
00474           nextchar += strlen (nextchar);
00475           optind++;
00476           return '?';
00477         }
00478 
00479       if (pfound != NULL)
00480         {
00481           option_index = indfound;
00482           optind++;
00483           if (*s)
00484             {
00485               /* Don't test has_arg with >, because some C compilers don't
00486                  allow it to be used on enums.  */
00487               if (pfound->has_arg)
00488                 optarg = s + 1;
00489               else
00490                 {
00491                   if (opterr)
00492                     {
00493                       if (argv[optind - 1][1] == '-')
00494                         /* --option */
00495                         fprintf (stderr,
00496                                  _("%s: option `--%s' doesn't allow an argument\n"),
00497                                  exec_name, pfound->name);
00498                       else
00499                         /* +option or -option */
00500                         fprintf (stderr,
00501                                  _("%s: option `%c%s' doesn't allow an argument\n"),
00502                                  exec_name, argv[optind - 1][0], pfound->name);
00503                     }
00504                   nextchar += strlen (nextchar);
00505                   return '?';
00506                 }
00507             }
00508           else if (pfound->has_arg == 1)
00509             {
00510               if (optind < argc)
00511                 optarg = argv[optind++];
00512               else
00513                 {
00514                   if (opterr)
00515                     fprintf (stderr,
00516                              _("%s: option `%s' requires an argument\n"),
00517                              exec_name, argv[optind - 1]);
00518                   nextchar += strlen (nextchar);
00519                   return optstring[0] == ':' ? ':' : '?';
00520                 }
00521             }
00522           nextchar += strlen (nextchar);
00523           if (longind != NULL)
00524             *longind = option_index;
00525           if (pfound->flag)
00526             {
00527               *(pfound->flag) = pfound->val;
00528               return 0;
00529             }
00530           return pfound->val;
00531         }
00532       /* Can't find it as a long option.  If this is not getopt_long_only,
00533          or the option starts with '--' or is not a valid short
00534          option, then it's an error.
00535          Otherwise interpret it as a short option.  */
00536       if (!long_only || argv[optind][1] == '-'
00537 #ifdef GETOPT_COMPAT
00538           || argv[optind][0] == '+'
00539 #endif                                /* GETOPT_COMPAT */
00540           || my_index (optstring, *nextchar) == NULL)
00541         {
00542           if (opterr)
00543             {
00544               if (argv[optind][1] == '-')
00545                 /* --option */
00546                 fprintf (stderr, _("%s: unrecognized option `--%s'\n"),
00547                          exec_name, nextchar);
00548               else
00549                 /* +option or -option */
00550                 fprintf (stderr, _("%s: unrecognized option `%c%s'\n"),
00551                          exec_name, argv[optind][0], nextchar);
00552             }
00553           nextchar = (char *) "";
00554           optind++;
00555           return '?';
00556         }
00557     }
00558 
00559   /* Look at and handle the next option-character.  */
00560 
00561   {
00562     char c = *nextchar++;
00563     char *temp = my_index (optstring, c);
00564 
00565     /* Increment `optind' when we start to process its last character.  */
00566     if (*nextchar == '\0')
00567       ++optind;
00568 
00569     if (temp == NULL || c == ':')
00570       {
00571         if (opterr)
00572           {
00573 #if 0
00574             if (c < 040 || c >= 0177)
00575               fprintf (stderr, "%s: unrecognized option, character code 0%o\n",
00576                        exec_name, c);
00577             else
00578               fprintf (stderr, "%s: unrecognized option `-%c'\n", exec_name, c);
00579 #else
00580             /* 1003.2 specifies the format of this message.  */
00581             fprintf (stderr, _("%s: illegal option -- %c\n"), exec_name, c);
00582 #endif
00583           }
00584         optopt = c;
00585         return '?';
00586       }
00587     if (temp[1] == ':')
00588       {
00589         if (temp[2] == ':')
00590           {
00591             /* This is an option that accepts an argument optionally.  */
00592             if (*nextchar != '\0')
00593               {
00594                 optarg = nextchar;
00595                 optind++;
00596               }
00597             else
00598               optarg = 0;
00599             nextchar = NULL;
00600           }
00601         else
00602           {
00603             /* This is an option that requires an argument.  */
00604             if (*nextchar != '\0')
00605               {
00606                 optarg = nextchar;
00607                 /* If we end this ARGV-element by taking the rest as an arg,
00608                    we must advance to the next element now.  */
00609                 optind++;
00610               }
00611             else if (optind == argc)
00612               {
00613                 if (opterr)
00614                   {
00615 #if 0
00616                     fprintf (stderr, "%s: option `-%c' requires an argument\n",
00617                              exec_name, c);
00618 #else
00619                     /* 1003.2 specifies the format of this message.  */
00620                     fprintf (stderr, _("%s: option requires an argument -- %c\n"),
00621                              exec_name, c);
00622 #endif
00623                   }
00624                 optopt = c;
00625                 if (optstring[0] == ':')
00626                   c = ':';
00627                 else
00628                   c = '?';
00629               }
00630             else
00631               /* We already incremented `optind' once;
00632                  increment it again when taking next ARGV-elt as argument.  */
00633               optarg = argv[optind++];
00634             nextchar = NULL;
00635           }
00636       }
00637     return c;
00638   }
00639 }
00640 
00641 /* Calls internal getopt function to enable long option names.  */
00642 int
00643 getopt_long (int argc, char *const *argv, const char *shortopts,
00644              const struct option *longopts, int *longind)
00645 {
00646   return _getopt_internal (argc, argv, shortopts, longopts, longind, 0);
00647 }
00648 
00649 int
00650 getopt (int argc, char *const *argv, const char *optstring)
00651 {
00652   return _getopt_internal (argc, argv, optstring,
00653                            (const struct option *) 0,
00654                            (int *) 0,
00655                            0);
00656 }
00657 
00658 #endif        /* _LIBC or not __GNU_LIBRARY__.  */
00659 
00660 #ifdef TEST
00661 
00662 /* Compile with -DTEST to make an executable for use in testing
00663    the above definition of `getopt'.  */
00664 
00665 int
00666 main (argc, argv)
00667      int argc;
00668      char **argv;
00669 {
00670   int c;
00671   int digit_optind = 0;
00672 
00673   while (1)
00674     {
00675       int this_option_optind = optind ? optind : 1;
00676 
00677       c = getopt (argc, argv, "abc:d:0123456789");
00678       if (c == EOF)
00679         break;
00680 
00681       switch (c)
00682         {
00683         case '0':
00684         case '1':
00685         case '2':
00686         case '3':
00687         case '4':
00688         case '5':
00689         case '6':
00690         case '7':
00691         case '8':
00692         case '9':
00693           if (digit_optind != 0 && digit_optind != this_option_optind)
00694             printf ("digits occur in two different argv-elements.\n");
00695           digit_optind = this_option_optind;
00696           printf ("option %c\n", c);
00697           break;
00698 
00699         case 'a':
00700           printf ("option a\n");
00701           break;
00702 
00703         case 'b':
00704           printf ("option b\n");
00705           break;
00706 
00707         case 'c':
00708           printf ("option c with value `%s'\n", optarg);
00709           break;
00710 
00711         case '?':
00712           break;
00713 
00714         default:
00715           printf ("?? getopt returned character code 0%o ??\n", c);
00716         }
00717     }
00718 
00719   if (optind < argc)
00720     {
00721       printf ("non-option ARGV-elements: ");
00722       while (optind < argc)
00723         printf ("%s ", argv[optind++]);
00724       printf ("\n");
00725     }
00726 
00727   exit (0);
00728 }
00729 
00730 #endif /* TEST */


shape_reconstruction
Author(s): Roberto Martín-Martín
autogenerated on Sat Jun 8 2019 18:31:24