home *** CD-ROM | disk | FTP | other *** search
/ ftp.mactech.com 2010 / ftp.mactech.com.tar / ftp.mactech.com / online / source / c / compilers / Bison.sit.hqx / Bison / Source / getopt.c < prev    next >
Text File  |  1992-08-22  |  20KB  |  701 lines

  1. /***********************************************************
  2.  *
  3.  * Macintosh/MPW version of GNU Bison 1.18
  4.  * Please read the README_MPW file for more information
  5.  *
  6.  ***********************************************************/
  7.  
  8. /* Getopt for GNU.
  9.    NOTE: getopt is now part of the C library, so if you don't know what
  10.    "Keep this file name-space clean" means, talk to roland@gnu.ai.mit.edu
  11.    before changing it!
  12.  
  13.    Copyright (C) 1987, 88, 89, 90, 91, 1992 Free Software Foundation, Inc.
  14.  
  15.    This program is free software; you can redistribute it and/or modify
  16.    it under the terms of the GNU General Public License as published by
  17.    the Free Software Foundation; either version 2, or (at your option)
  18.    any later version.
  19.  
  20.    This program is distributed in the hope that it will be useful,
  21.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  22.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  23.    GNU General Public License for more details.
  24.  
  25.    You should have received a copy of the GNU General Public License
  26.    along with this program; if not, write to the Free Software
  27.    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  28.  
  29. /* AIX requires this to be the first thing in the file. */
  30. #ifdef __GNUC__
  31. #define alloca __builtin_alloca
  32. #else /* not __GNUC__ */
  33. #ifdef macintosh
  34. #define alloca malloc
  35. void *malloc();
  36. void free();
  37. #else
  38. #if defined(sparc) && !defined(USG) && !defined(SVR4) && !defined(__svr4__)
  39. #include <alloca.h>
  40. #else
  41. #ifdef _AIX
  42.  #pragma alloca
  43. #else
  44. char *alloca ();
  45. #endif
  46. #endif /* sparc */
  47. #endif /* not macintosh */
  48. #endif /* not __GNUC__ */
  49.  
  50. #ifdef    LIBC
  51. /* For when compiled as part of the GNU C library.  */
  52. #include <ansidecl.h>
  53. #endif
  54.  
  55. #include <stdio.h>
  56.  
  57. /* This needs to come after some library #include
  58.    to get __GNU_LIBRARY__ defined.  */
  59. #ifdef    __GNU_LIBRARY__
  60. #undef    alloca
  61. #include <stdlib.h>
  62. #include <string.h>
  63. #else    /* Not GNU C library.  */
  64. #define    __alloca    alloca
  65. #endif    /* GNU C library.  */
  66.  
  67.  
  68. #if !defined( __STDC__ ) && !defined( macintosh )
  69. #define const
  70. #endif
  71.  
  72. /* If GETOPT_COMPAT is defined, `+' as well as `--' can introduce a
  73.    long-named option.  Because this is not POSIX.2 compliant, it is
  74.    being phased out. */
  75. #define GETOPT_COMPAT
  76.  
  77. /* This version of `getopt' appears to the caller like standard Unix `getopt'
  78.    but it behaves differently for the user, since it allows the user
  79.    to intersperse the options with the other arguments.
  80.  
  81.    As `getopt' works, it permutes the elements of ARGV so that,
  82.    when it is done, all the options precede everything else.  Thus
  83.    all application programs are extended to handle flexible argument order.
  84.  
  85.    Setting the environment variable POSIXLY_CORRECT disables permutation.
  86.    Then the behavior is completely standard.
  87.  
  88.    GNU application programs can use a third alternative mode in which
  89.    they can distinguish the relative order of options and other arguments.  */
  90.  
  91. #include "getopt.h"
  92.  
  93. /* For communication from `getopt' to the caller.
  94.    When `getopt' finds an option that takes an argument,
  95.    the argument value is returned here.
  96.    Also, when `ordering' is RETURN_IN_ORDER,
  97.    each non-option ARGV-element is returned here.  */
  98.  
  99. char *optarg = 0;
  100.  
  101. /* Index in ARGV of the next element to be scanned.
  102.    This is used for communication to and from the caller
  103.    and for communication between successive calls to `getopt'.
  104.  
  105.    On entry to `getopt', zero means this is the first call; initialize.
  106.  
  107.    When `getopt' returns EOF, this is the index of the first of the
  108.    non-option elements that the caller should itself scan.
  109.  
  110.    Otherwise, `optind' communicates from one call to the next
  111.    how much of ARGV has been scanned so far.  */
  112.  
  113. int optind = 0;
  114.  
  115. /* The next char to be scanned in the option-element
  116.    in which the last option character we returned was found.
  117.    This allows us to pick up the scan where we left off.
  118.  
  119.    If this is zero, or a null string, it means resume the scan
  120.    by advancing to the next ARGV-element.  */
  121.  
  122. static char *nextchar;
  123.  
  124. /* Callers store zero here to inhibit the error message
  125.    for unrecognized options.  */
  126.  
  127. int opterr = 1;
  128.  
  129. /* Describe how to deal with options that follow non-option ARGV-elements.
  130.  
  131.    If the caller did not specify anything,
  132.    the default is REQUIRE_ORDER if the environment variable
  133.    POSIXLY_CORRECT is defined, PERMUTE otherwise.
  134.  
  135.    REQUIRE_ORDER means don't recognize them as options;
  136.    stop option processing when the first non-option is seen.
  137.    This is what Unix does.
  138.    This mode of operation is selected by either setting the environment
  139.    variable POSIXLY_CORRECT, or using `+' as the first character
  140.    of the list of option characters.
  141.  
  142.    PERMUTE is the default.  We permute the contents of ARGV as we scan,
  143.    so that eventually all the non-options are at the end.  This allows options
  144.    to be given in any order, even with programs that were not written to
  145.    expect this.
  146.  
  147.    RETURN_IN_ORDER is an option available to programs that were written
  148.    to expect options and other ARGV-elements in any order and that care about
  149.    the ordering of the two.  We describe each non-option ARGV-element
  150.    as if it were the argument of an option with character code 1.
  151.    Using `-' as the first character of the list of option characters
  152.    selects this mode of operation.
  153.  
  154.    The special argument `--' forces an end of option-scanning regardless
  155.    of the value of `ordering'.  In the case of RETURN_IN_ORDER, only
  156.    `--' can cause `getopt' to return EOF with `optind' != ARGC.  */
  157.  
  158. static enum
  159. {
  160.   REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
  161. } ordering;
  162.  
  163. #if defined( __GNU_LIBRARY__ ) || defined( macintosh )
  164. #include <string.h>
  165. #define    my_index    strchr
  166. #define    my_bcopy(src, dst, n)    memcpy ((dst), (src), (n))
  167. #else
  168.  
  169. /* Avoid depending on library functions or files
  170.    whose names are inconsistent.  */
  171.  
  172. char *getenv ();
  173.  
  174. static char *
  175. my_index (string, chr)
  176.      char *string;
  177.      int chr;
  178. {
  179.   while (*string)
  180.     {
  181.       if (*string == chr)
  182.     return string;
  183.       string++;
  184.     }
  185.   return 0;
  186. }
  187.  
  188. static void
  189. my_bcopy (from, to, size)
  190.      char *from, *to;
  191.      int size;
  192. {
  193.   int i;
  194.   for (i = 0; i < size; i++)
  195.     to[i] = from[i];
  196. }
  197. #endif                /* GNU C library.  */
  198.  
  199. /* Handle permutation of arguments.  */
  200.  
  201. /* Describe the part of ARGV that contains non-options that have
  202.    been skipped.  `first_nonopt' is the index in ARGV of the first of them;
  203.    `last_nonopt' is the index after the last of them.  */
  204.  
  205. static int first_nonopt;
  206. static int last_nonopt;
  207.  
  208. /* Exchange two adjacent subsequences of ARGV.
  209.    One subsequence is elements [first_nonopt,last_nonopt)
  210.    which contains all the non-options that have been skipped so far.
  211.    The other is elements [last_nonopt,optind), which contains all
  212.    the options processed since those non-options were skipped.
  213.  
  214.    `first_nonopt' and `last_nonopt' are relocated so that they describe
  215.    the new indices of the non-options in ARGV after they are moved.  */
  216.  
  217. static void
  218. exchange (argv)
  219.      char **argv;
  220. {
  221.   int nonopts_size = (last_nonopt - first_nonopt) * sizeof (char *);
  222. #ifdef macintosh
  223.   char *temp = (char *) malloc(nonopts_size);
  224. #else
  225.   char **temp = (char **) __alloca (nonopts_size);
  226. #endif
  227.  
  228.   /* Interchange the two blocks of data in ARGV.  */
  229.  
  230.   my_bcopy (&argv[first_nonopt], temp, nonopts_size);
  231.   my_bcopy (&argv[last_nonopt], &argv[first_nonopt],
  232.         (optind - last_nonopt) * sizeof (char *));
  233.   my_bcopy (temp, &argv[first_nonopt + optind - last_nonopt], nonopts_size);
  234.  
  235.   /* Update records for the slots the non-options now occupy.  */
  236.  
  237.   first_nonopt += (optind - last_nonopt);
  238.   last_nonopt = optind;
  239. #ifdef macintosh
  240.   free( temp);
  241. #endif
  242. }
  243.  
  244. /* Scan elements of ARGV (whose length is ARGC) for option characters
  245.    given in OPTSTRING.
  246.  
  247.    If an element of ARGV starts with '-', and is not exactly "-" or "--",
  248.    then it is an option element.  The characters of this element
  249.    (aside from the initial '-') are option characters.  If `getopt'
  250.    is called repeatedly, it returns successively each of the option characters
  251.    from each of the option elements.
  252.  
  253.    If `getopt' finds another option character, it returns that character,
  254.    updating `optind' and `nextchar' so that the next call to `getopt' can
  255.    resume the scan with the following option character or ARGV-element.
  256.  
  257.    If there are no more option characters, `getopt' returns `EOF'.
  258.    Then `optind' is the index in ARGV of the first ARGV-element
  259.    that is not an option.  (The ARGV-elements have been permuted
  260.    so that those that are not options now come last.)
  261.  
  262.    OPTSTRING is a string containing the legitimate option characters.
  263.    If an option character is seen that is not listed in OPTSTRING,
  264.    return '?' after printing an error message.  If you set `opterr' to
  265.    zero, the error message is suppressed but we still return '?'.
  266.  
  267.    If a char in OPTSTRING is followed by a colon, that means it wants an arg,
  268.    so the following text in the same ARGV-element, or the text of the following
  269.    ARGV-element, is returned in `optarg'.  Two colons mean an option that
  270.    wants an optional arg; if there is text in the current ARGV-element,
  271.    it is returned in `optarg', otherwise `optarg' is set to zero.
  272.  
  273.    If OPTSTRING starts with `-' or `+', it requests different methods of
  274.    handling the non-option ARGV-elements.
  275.    See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above.
  276.  
  277.    Long-named options begin with `--' instead of `-'.
  278.    Their names may be abbreviated as long as the abbreviation is unique
  279.    or is an exact match for some defined option.  If they have an
  280.    argument, it follows the option name in the same ARGV-element, separated
  281.    from the option name by a `=', or else the in next ARGV-element.
  282.    When `getopt' finds a long-named option, it returns 0 if that option's
  283.    `flag' field is nonzero, the value of the option's `val' field
  284.    if the `flag' field is zero.
  285.  
  286.    The elements of ARGV aren't really const, because we permute them.
  287.    But we pretend they're const in the prototype to be compatible
  288.    with other systems.
  289.  
  290.    LONGOPTS is a vector of `struct option' terminated by an
  291.    element containing a name which is zero.
  292.  
  293.    LONGIND returns the index in LONGOPT of the long-named option found.
  294.    It is only valid when a long-named option has been found by the most
  295.    recent call.
  296.  
  297.    If LONG_ONLY is nonzero, '-' as well as '--' can introduce
  298.    long-named options.  */
  299.  
  300. int
  301. _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
  302.      int argc;
  303.      char *const *argv;
  304.      const char *optstring;
  305.      const struct option *longopts;
  306.      int *longind;
  307.      int long_only;
  308. {
  309.   int option_index;
  310.  
  311.   optarg = 0;
  312.  
  313.   /* Initialize the internal data when the first call is made.
  314.      Start processing options with ARGV-element 1 (since ARGV-element 0
  315.      is the program name); the sequence of previously skipped
  316.      non-option ARGV-elements is empty.  */
  317.  
  318.   if (optind == 0)
  319.     {
  320.       first_nonopt = last_nonopt = optind = 1;
  321.  
  322.       nextchar = NULL;
  323.  
  324.       /* Determine how to handle the ordering of options and nonoptions.  */
  325.  
  326.       if (optstring[0] == '-')
  327.     {
  328.       ordering = RETURN_IN_ORDER;
  329.       ++optstring;
  330.     }
  331.       else if (optstring[0] == '+')
  332.     {
  333.       ordering = REQUIRE_ORDER;
  334.       ++optstring;
  335.     }
  336. #ifndef macintosh
  337.       else if (getenv ("POSIXLY_CORRECT") != NULL)
  338.     ordering = REQUIRE_ORDER;
  339. #endif
  340.       else
  341.     ordering = PERMUTE;
  342.     }
  343.  
  344.   if (nextchar == NULL || *nextchar == '\0')
  345.     {
  346.       if (ordering == PERMUTE)
  347.     {
  348.       /* If we have just processed some options following some non-options,
  349.          exchange them so that the options come first.  */
  350.  
  351.       if (first_nonopt != last_nonopt && last_nonopt != optind)
  352.         exchange ((char **) argv);
  353.       else if (last_nonopt != optind)
  354.         first_nonopt = optind;
  355.  
  356.       /* Now skip any additional non-options
  357.          and extend the range of non-options previously skipped.  */
  358.  
  359.       while (optind < argc
  360.          && (argv[optind][0] != '-' || argv[optind][1] == '\0')
  361. #ifdef GETOPT_COMPAT
  362.          && (longopts == NULL
  363.              || argv[optind][0] != '+' || argv[optind][1] == '\0')
  364. #endif                /* GETOPT_COMPAT */
  365.          )
  366.         optind++;
  367.       last_nonopt = optind;
  368.     }
  369.  
  370.       /* Special ARGV-element `--' means premature end of options.
  371.      Skip it like a null option,
  372.      then exchange with previous non-options as if it were an option,
  373.      then skip everything else like a non-option.  */
  374.  
  375.       if (optind != argc && !strcmp (argv[optind], "--"))
  376.     {
  377.       optind++;
  378.  
  379.       if (first_nonopt != last_nonopt && last_nonopt != optind)
  380.         exchange ((char **) argv);
  381.       else if (first_nonopt == last_nonopt)
  382.         first_nonopt = optind;
  383.       last_nonopt = argc;
  384.  
  385.       optind = argc;
  386.     }
  387.  
  388.       /* If we have done all the ARGV-elements, stop the scan
  389.      and back over any non-options that we skipped and permuted.  */
  390.  
  391.       if (optind == argc)
  392.     {
  393.       /* Set the next-arg-index to point at the non-options
  394.          that we previously skipped, so the caller will digest them.  */
  395.       if (first_nonopt != last_nonopt)
  396.         optind = first_nonopt;
  397.       return EOF;
  398.     }
  399.  
  400.       /* If we have come to a non-option and did not permute it,
  401.      either stop the scan or describe it to the caller and pass it by.  */
  402.  
  403.       if ((argv[optind][0] != '-' || argv[optind][1] == '\0')
  404. #ifdef GETOPT_COMPAT
  405.       && (longopts == NULL
  406.           || argv[optind][0] != '+' || argv[optind][1] == '\0')
  407. #endif                /* GETOPT_COMPAT */
  408.       )
  409.     {
  410.       if (ordering == REQUIRE_ORDER)
  411.         return EOF;
  412.       optarg = argv[optind++];
  413.       return 1;
  414.     }
  415.  
  416.       /* We have found another option-ARGV-element.
  417.      Start decoding its characters.  */
  418.  
  419.       nextchar = (argv[optind] + 1
  420.           + (longopts != NULL && argv[optind][1] == '-'));
  421.     }
  422.  
  423.   if (longopts != NULL
  424.       && ((argv[optind][0] == '-'
  425.        && (argv[optind][1] == '-' || long_only))
  426. #ifdef GETOPT_COMPAT
  427.       || argv[optind][0] == '+'
  428. #endif                /* GETOPT_COMPAT */
  429.       ))
  430.     {
  431.       const struct option *p;
  432.       char *s = nextchar;
  433.       int exact = 0;
  434.       int ambig = 0;
  435.       const struct option *pfound = NULL;
  436.       int indfound;
  437.  
  438.       while (*s && *s != '=')
  439.     s++;
  440.  
  441.       /* Test all options for either exact match or abbreviated matches.  */
  442.       for (p = longopts, option_index = 0; p->name;
  443.        p++, option_index++)
  444.     if (!strncmp (p->name, nextchar, s - nextchar))
  445.       {
  446.         if (s - nextchar == strlen (p->name))
  447.           {
  448.         /* Exact match found.  */
  449.         pfound = p;
  450.         indfound = option_index;
  451.         exact = 1;
  452.         break;
  453.           }
  454.         else if (pfound == NULL)
  455.           {
  456.         /* First nonexact match found.  */
  457.         pfound = p;
  458.         indfound = option_index;
  459.           }
  460.         else
  461.           /* Second nonexact match found.  */
  462.           ambig = 1;
  463.       }
  464.  
  465.       if (ambig && !exact)
  466.     {
  467.       if (opterr)
  468.         fprintf (stderr, "%s: option `%s' is ambiguous\n",
  469.              argv[0], argv[optind]);
  470.       nextchar += strlen (nextchar);
  471.       optind++;
  472.       return '?';
  473.     }
  474.  
  475.       if (pfound != NULL)
  476.     {
  477.       option_index = indfound;
  478.       optind++;
  479.       if (*s)
  480.         {
  481.           /* Don't test has_arg with >, because some C compilers don't
  482.          allow it to be used on enums. */
  483.           if (pfound->has_arg)
  484.         optarg = s + 1;
  485.           else
  486.         {
  487.           if (opterr)
  488.             {
  489.               if (argv[optind - 1][1] == '-')
  490.             /* --option */
  491.             fprintf (stderr,
  492.                  "%s: option `--%s' doesn't allow an argument\n",
  493.                  argv[0], pfound->name);
  494.               else
  495.             /* +option or -option */
  496.             fprintf (stderr,
  497.                  "%s: option `%c%s' doesn't allow an argument\n",
  498.                  argv[0], argv[optind - 1][0], pfound->name);
  499.             }
  500.           nextchar += strlen (nextchar);
  501.           return '?';
  502.         }
  503.         }
  504.       else if (pfound->has_arg == 1)
  505.         {
  506.           if (optind < argc)
  507.         optarg = argv[optind++];
  508.           else
  509.         {
  510.           if (opterr)
  511.             fprintf (stderr, "%s: option `%s' requires an argument\n",
  512.                  argv[0], argv[optind - 1]);
  513.           nextchar += strlen (nextchar);
  514.           return '?';
  515.         }
  516.         }
  517.       nextchar += strlen (nextchar);
  518.       if (longind != NULL)
  519.         *longind = option_index;
  520.       if (pfound->flag)
  521.         {
  522.           *(pfound->flag) = pfound->val;
  523.           return 0;
  524.         }
  525.       return pfound->val;
  526.     }
  527.       /* Can't find it as a long option.  If this is not getopt_long_only,
  528.      or the option starts with '--' or is not a valid short
  529.      option, then it's an error.
  530.      Otherwise interpret it as a short option. */
  531.       if (!long_only || argv[optind][1] == '-'
  532. #ifdef GETOPT_COMPAT
  533.       || argv[optind][0] == '+'
  534. #endif                /* GETOPT_COMPAT */
  535.       || my_index (optstring, *nextchar) == NULL)
  536.     {
  537.       if (opterr)
  538.         {
  539.           if (argv[optind][1] == '-')
  540.         /* --option */
  541.         fprintf (stderr, "%s: unrecognized option `--%s'\n",
  542.              argv[0], nextchar);
  543.           else
  544.         /* +option or -option */
  545.         fprintf (stderr, "%s: unrecognized option `%c%s'\n",
  546.              argv[0], argv[optind][0], nextchar);
  547.         }
  548.       nextchar += strlen (nextchar);
  549.       optind++;
  550.       return '?';
  551.     }
  552.     }
  553.  
  554.   /* Look at and handle the next option-character.  */
  555.  
  556.   {
  557.     char c = *nextchar++;
  558.     char *temp = my_index (optstring, c);
  559.  
  560.     /* Increment `optind' when we start to process its last character.  */
  561.     if (*nextchar == '\0')
  562.       optind++;
  563.  
  564.     if (temp == NULL || c == ':')
  565.       {
  566.     if (opterr)
  567.       {
  568.         if (c < 040 || c >= 0177)
  569.           fprintf (stderr, "%s: unrecognized option, character code 0%o\n",
  570.                argv[0], c);
  571.         else
  572.           fprintf (stderr, "%s: unrecognized option `-%c'\n", argv[0], c);
  573.       }
  574.     return '?';
  575.       }
  576.     if (temp[1] == ':')
  577.       {
  578.     if (temp[2] == ':')
  579.       {
  580.         /* This is an option that accepts an argument optionally.  */
  581.         if (*nextchar != '\0')
  582.           {
  583.         optarg = nextchar;
  584.         optind++;
  585.           }
  586.         else
  587.           optarg = 0;
  588.         nextchar = NULL;
  589.       }
  590.     else
  591.       {
  592.         /* This is an option that requires an argument.  */
  593.         if (*nextchar != 0)
  594.           {
  595.         optarg = nextchar;
  596.         /* If we end this ARGV-element by taking the rest as an arg,
  597.            we must advance to the next element now.  */
  598.         optind++;
  599.           }
  600.         else if (optind == argc)
  601.           {
  602.         if (opterr)
  603.           fprintf (stderr, "%s: option `-%c' requires an argument\n",
  604.                argv[0], c);
  605.         c = '?';
  606.           }
  607.         else
  608.           /* We already incremented `optind' once;
  609.          increment it again when taking next ARGV-elt as argument.  */
  610.           optarg = argv[optind++];
  611.         nextchar = NULL;
  612.       }
  613.       }
  614.     return c;
  615.   }
  616. }
  617.  
  618. int
  619. getopt (argc, argv, optstring)
  620.      int argc;
  621.      char *const *argv;
  622.      const char *optstring;
  623. {
  624.   return _getopt_internal (argc, argv, optstring,
  625.                (const struct option *) 0,
  626.                (int *) 0,
  627.                0);
  628. }
  629.  
  630. #ifdef TEST
  631.  
  632. /* Compile with -DTEST to make an executable for use in testing
  633.    the above definition of `getopt'.  */
  634.  
  635. int
  636. main (argc, argv)
  637.      int argc;
  638.      char **argv;
  639. {
  640.   int c;
  641.   int digit_optind = 0;
  642.  
  643.   while (1)
  644.     {
  645.       int this_option_optind = optind ? optind : 1;
  646.  
  647.       c = getopt (argc, argv, "abc:d:0123456789");
  648.       if (c == EOF)
  649.     break;
  650.  
  651.       switch (c)
  652.     {
  653.     case '0':
  654.     case '1':
  655.     case '2':
  656.     case '3':
  657.     case '4':
  658.     case '5':
  659.     case '6':
  660.     case '7':
  661.     case '8':
  662.     case '9':
  663.       if (digit_optind != 0 && digit_optind != this_option_optind)
  664.         printf ("digits occur in two different argv-elements.\n");
  665.       digit_optind = this_option_optind;
  666.       printf ("option %c\n", c);
  667.       break;
  668.  
  669.     case 'a':
  670.       printf ("option a\n");
  671.       break;
  672.  
  673.     case 'b':
  674.       printf ("option b\n");
  675.       break;
  676.  
  677.     case 'c':
  678.       printf ("option c with value `%s'\n", optarg);
  679.       break;
  680.  
  681.     case '?':
  682.       break;
  683.  
  684.     default:
  685.       printf ("?? getopt returned character code 0%o ??\n", c);
  686.     }
  687.     }
  688.  
  689.   if (optind < argc)
  690.     {
  691.       printf ("non-option ARGV-elements: ");
  692.       while (optind < argc)
  693.     printf ("%s ", argv[optind++]);
  694.       printf ("\n");
  695.     }
  696.  
  697.   exit (0);
  698. }
  699.  
  700. #endif /* TEST */
  701.