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 20:52:14 GMT
> -----Original Message-----
> From: Jeff Trawick [mailto:trawickj@bellsouth.net]
> Sent: Wednesday, August 09, 2000 3:20 PM
> 
> > I guess the question is, are command line arguments mutable?
> 
> I think the answer is no, but that the follow-up question is more
> interesting: "can we express and enforce this immutability via the C
> language without it hindering the caller?"  I think the answer to this
> one may be no as well. 

With the caviat that MSVC is ignoring/not generating several types
of warnings.... here is the patch to make the stuff compile well on my 
machine:

Index: lib/apr/include/apr_getopt.h
===================================================================
RCS file: /home/cvs/apache-2.0/src/lib/apr/include/apr_getopt.h,v
retrieving revision 1.17
diff -u -r1.17 apr_getopt.h
--- lib/apr/include/apr_getopt.h	2000/08/09 18:00:15	1.17
+++ lib/apr/include/apr_getopt.h	2000/08/09 20:51:26
@@ -73,7 +73,7 @@
  * @param argc The number of arguments to parse
  * @param argv The array of arguments to parse
  * @tip Arguments 2 and 3 are most commonly argc and argv from main(argc, argv)
- * @deffunc apr_status_t apr_initopt( apr_getopt_t **os, apr_pool_t *cont,int argc, char
const* const* argv)
+ * @deffunc apr_status_t apr_initopt(apr_getopt_t **os, apr_pool_t *cont, int argc, char
const* const* argv)
  */
 APR_EXPORT(apr_status_t) apr_initopt(apr_getopt_t **os, apr_pool_t *cont,
                                      int argc, char const* const* argv);
@@ -93,10 +93,10 @@
  *             APR_BADARG   --  No argument followed @parameter:
  *             APR_SUCCESS  --  The next option was found.
  * </PRE>
- * @deffunc apr_status_t apr_getopt(apr_getopt_t *os, const char *opts, char *optch, char
const** optarg)
+ * @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, char const** optarg);
+                                    char *optch, const char **optarg);
 
 #endif  /* ! APR_GETOPT_H */
 
Index: lib/apr/misc/unix/getopt.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/lib/apr/misc/unix/getopt.c,v
retrieving revision 1.20
diff -u -r1.20 getopt.c
--- lib/apr/misc/unix/getopt.c	2000/08/09 17:46:21	1.20
+++ lib/apr/misc/unix/getopt.c	2000/08/09 20:51:26
@@ -49,7 +49,7 @@
 }
 
 APR_EXPORT(apr_status_t) apr_getopt(apr_getopt_t *os, const char *opts, 
-                                    char *optch, char const** optarg)
+                                    char *optch, const char **optarg)
 {
     const char *p;
     const char *oli;  /* option letter list index */
Index: support/ab.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/support/ab.c,v
retrieving revision 1.25
diff -u -r1.25 ab.c
--- support/ab.c	2000/08/09 15:01:59	1.25
+++ support/ab.c	2000/08/09 20:51:29
@@ -193,9 +193,9 @@
 time_t aprtimeout = 30 * APR_USEC_PER_SEC; /* timeout value */
 
 int use_html = 0;        	/* use html in the report */
-char *tablestring;
-char *trstring;
-char *tdstring;
+const char *tablestring;
+const char *trstring;
+const char *tdstring;
 
 int doclen = 0;        		/* the length the document should be */
 int totalread = 0;        	/* total number of bytes read */
@@ -937,7 +937,7 @@
 
 /* read data to POST from file, save contents and length */
 
-static int open_postfile(char *pfile)
+static int open_postfile(const char *pfile)
 {
     apr_file_t *postfd = NULL;
     apr_finfo_t finfo;
@@ -974,7 +974,7 @@
     char tmp[1024];
     apr_status_t status;
     apr_getopt_t *opt;
-    char *optarg;
+    const char *optarg;
     char c;
 
     /* table defaults  */


Mime
View raw message