apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kfo...@locus.apache.org
Subject cvs commit: apr/include apr_getopt.h
Date Sat, 25 Nov 2000 05:14:55 GMT
kfogel      00/11/24 21:14:54

  Modified:    include  apr_getopt.h
  Log:
  More changes from Greg Hudson <ghudson@mit.edu>, w/ small doc tweaks
  from Karl Fogel <kfogel@collab.net>:
  
  (apr_getopt_option_t): rename from apr_longopt_t, because more accurate.
  (apr_initopt, apr_getopt_long, reverse): take "char *const *argv", act
  on a copy instead of the original, since we may permute the array.
  
  This is a compromise.  The parameter must be compatible with the argv
  value passed to main, since that is the primary purpose of the
  function.  But as has been pointed out, people might want to use the
  function with arrays other than argv, and we shouldn't touch the
  caller's data.
  
  Revision  Changes    Path
  1.24      +11 -11    apr/include/apr_getopt.h
  
  Index: apr_getopt.h
  ===================================================================
  RCS file: /home/cvs/apr/include/apr_getopt.h,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- apr_getopt.h	2000/11/25 02:19:40	1.23
  +++ apr_getopt.h	2000/11/25 05:14:54	1.24
  @@ -77,7 +77,7 @@
       /** count of arguments */
       int argc;
       /** array of pointers to arguments */
  -    char **argv;
  +    const char **argv;
       /** argument associated with option */
       char const* place;
       /** set to nonzero to support interleaving */
  @@ -87,9 +87,9 @@
       int skip_end;
   };
   
  -typedef struct apr_longopt_t apr_longopt_t;
  +typedef struct apr_getopt_option_t apr_getopt_option_t;
   
  -struct apr_longopt_t {
  +struct apr_getopt_option_t {
       /** long option name, or NULL if option has no long name */
       const char *name;
       /** option letter, or a value greater than 255 if option has no letter */
  @@ -108,7 +108,7 @@
    * @deffunc apr_status_t apr_initopt(apr_getopt_t **os, apr_pool_t *cont,int argc, char
*const *argv)
    */
   APR_DECLARE(apr_status_t) apr_initopt(apr_getopt_t **os, apr_pool_t *cont,
  -                                      int argc, char **argv);
  +                                      int argc, char *const *argv);
   
   /**
    * Parse the options initialized by apr_initopt().
  @@ -135,12 +135,12 @@
    * options beginning with "--" in addition to single-character
    * options beginning with "-".
    * @param os     The apr_getopt_t structure created by apr_initopt()
  - * @param opts   A pointer to a list of apr_longopt_t structures, which can
  - *               be initialized with { "name", optch, has_args }.  has_args
  + * @param opts   A pointer to a list of apr_getopt_option_t structures, which
  + *               can be initialized with { "name", optch, has_args }.  has_args
    *               is nonzero if the option requires an argument.  A structure
    *               with an optch value of 0 terminates the list.
  - * @param optch  Receives the value of "optch" from the apr_longopt_t structure
  - *               corresponding to the next option matched.
  + * @param optch  Receives the value of "optch" from the apr_getopt_option_t
  + *               structure corresponding to the next option matched.
    * @param optarg Receives the argument following the option, if any.
    * @tip There are four potential status values on exit.   They are:
    * <PRE>
  @@ -153,10 +153,10 @@
    * non-option argument.  On error, a message will be printed to stdout unless
    * os->err is set to 0.  If os->interleave is set to nonzero, options can come
    * after arguments, and os->argv will be permuted to leave non-option arguments
  - * at the end.
  - * @deffunc apr_status_t apr_getopt_long(apr_getopt_t *os, const apr_longopt_t *opts, int
*optch, const char **optarg)
  + * at the end (the original argv is unaffected).
  + * @deffunc apr_status_t apr_getopt_long(apr_getopt_t *os, const apr_getopt_option_t *opts,
int *optch, const char **optarg)
    */
   APR_DECLARE(apr_status_t) apr_getopt_long(apr_getopt_t *os,
  -					  const apr_longopt_t *opts,
  +					  const apr_getopt_option_t *opts,
   					  int *optch, const char **optarg);
   #endif  /* ! APR_GETOPT_H */
  
  
  

Mime
View raw message