httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "William A. Rowe, Jr." <wr...@lnd.com>
Subject RE: cvs commit: apache-2.0/src/lib/apr/misc/unix getopt.c
Date Wed, 09 Aug 2000 17:53:53 GMT
Well,

I guess the question is, are command line arguments mutable?

If so, all the constness is mute.  If not, it may not be convienient,
but the types should hold up (note - const'ness is one of my several
weak points, should go back and read my K&R again, but constness of
type** always gives me a headache.)

My problem, I can't get MSVC to complain (even at max error level 
rejection), so I don't know when/if I've licked the problem.  Jeff, 
if you have a fix, please apply and make the doc consistant.

This might be the fix, again I can't be certain:

 * @deffunc apr_status_t apr_getopt(apr_getopt_t *os, const char *opts, char *optch, const
char **optarg)
 */
APR_EXPORT(apr_status_t) apr_getopt(apr_getopt_t *os, const char *opts, 
                                    char *optch, const char **optarg);

Bill

> -----Original Message-----
> From: Jeff Trawick [mailto:trawickj@bellsouth.net]
> Sent: Wednesday, August 09, 2000 11:44 AM
> To: new-httpd@apache.org
> Subject: Re: cvs commit: apache-2.0/src/lib/apr/misc/unix getopt.c
> 
> 
> wrowe@locus.apache.org writes:
> 
> > wrowe       00/08/09 07:54:04
> > 
> >   Modified:    src/lib/apr/include apr_getopt.h
> >                src/lib/apr/misc/unix getopt.c
> ...
> >   + * @deffunc apr_status_t apr_getopt(apr_getopt_t *os, 
> const char *opts, char *optch, char **optarg)
> 
> This doc doesn't match the current signature of apr_getopt() (but see
> note below)...
> 
> >     */
> >   -APR_EXPORT(apr_status_t) apr_getopt(apr_int32_t nargc, 
> char *const *nargv, 
> >   -                                  const char *ostr, 
> apr_int32_t *rv, 
> >   -                                  apr_pool_t *cont);
> >   +APR_EXPORT(apr_status_t) apr_getopt(apr_getopt_t *os, 
> const char *opts, 
> >   +                                    char *optch, char 
> const** optarg);
> >    
> >    #endif  /* ! APR_GETOPT_H */
> 
> About the signatures of apr_getopt() and apr_initopt()...  Are the
> types of the last parameter to each function convenient to the caller?
> We now get these warnings with gcc (-Wall -Wstrict-prototypes 
> and whatever
> else maintainer mode brings):
> 
> 2a3,4
> > http_main.c: In function `main':
> > http_main.c:321: warning: passing arg 4 of `apr_initopt' 
> from incompatible pointer type
> 4a7,9
> > ab.c: In function `main':
> > ab.c:1010: warning: passing arg 4 of `apr_initopt' from 
> incompatible pointer type
> > ab.c:1011: warning: passing arg 4 of `apr_getopt' from 
> incompatible pointer type
> 
> I could play around with argv and optarg in http_main.c and ab.c, but
> that seems to be missing the point since argv and optarg are already
> declared in the obvious way.
> 
> Have fun,
> 
> -- 
> Jeff Trawick | trawick@ibm.net | PGP public key at web site:
>      http://www.geocities.com/SiliconValley/Park/9289/
>           Born in Roswell... married an alien...
> 

Mime
View raw message