[Pkg-clamav-commits] [SCM] Debian repository for ClamAV branch, debian/unstable, updated. debian/0.95+dfsg-1-167-g4319a8f

tkojm tkojm at 77e5149b-7576-45b1-b177-96237e5ba77b
Fri Jun 12 19:12:02 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit eb17384f96938dfea195feba9a13d4cdbbcbb1a4
Author: tkojm <tkojm at 77e5149b-7576-45b1-b177-96237e5ba77b>
Date:   Wed May 6 08:39:50 2009 +0000

    shared/getopt.[ch]: fix type conflict on Solaris (introduced in r5060)
    
    
    git-svn-id: http://svn.clamav.net/svn/clamav-devel/trunk@5064 77e5149b-7576-45b1-b177-96237e5ba77b

diff --git a/ChangeLog b/ChangeLog
index 57056fb..73bdd18 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Wed May  6 10:37:51 CEST 2009 (tk)
+----------------------------------
+ * shared/getopt.[ch]: fix type conflict on Solaris (introduced in r5060)
+
 Wed May  6 10:55:25 EEST 2009 (edwin)
 -------------------------------------
  * unit_tests/efence_tests.sh: set EF_ALIGNMENT=8 for non-x86
diff --git a/shared/getopt.c b/shared/getopt.c
index 1f0e9f7..df5f0f5 100644
--- a/shared/getopt.c
+++ b/shared/getopt.c
@@ -33,6 +33,7 @@ int optind=1, opterr=1, optopt=0;
 char *optarg=0;
 
 /* reset argument parser to start-up values */
+/*
 int getopt_reset(void)
 {
     optind = 1;
@@ -41,12 +42,13 @@ int getopt_reset(void)
     optarg = 0;
     return 0;
 }
+*/
 
 /* this is the plain old UNIX getopt, with GNU-style extensions. */
 /* if you're porting some piece of UNIX software, this is all you need. */
 /* this supports GNU-style permution and optional arguments */
 
-int getopt(int argc, char *argvc[], const char *opts)
+int my_getopt(int argc, char *argvc[], const char *opts)
 {
   char **argv = (char**)argvc;
   static int charind=0;
@@ -120,7 +122,7 @@ int getopt(int argc, char *argvc[], const char *opts)
       for(i=j=optind; i<argc; i++) if((argv[i][0] == '-') &&
                                         (argv[i][1] != '\0')) {
         optind=i;
-        opt=getopt(argc, argv, opts);
+        opt=my_getopt(argc, argv, opts);
         while(i > j) {
           tmp=argv[--i];
           for(k=i; k+1<optind; k++) argv[k]=argv[k+1];
@@ -132,7 +134,7 @@ int getopt(int argc, char *argvc[], const char *opts)
     }
   } else {
     charind++;
-    opt = getopt(argc, argv, opts);
+    opt = my_getopt(argc, argv, opts);
   }
   if (optind > argc) optind = argc;
   return opt;
@@ -143,7 +145,7 @@ int getopt(int argc, char *argvc[], const char *opts)
  * expecting GNU libc getopt call it.
  */
 
-int _getopt_internal(int argc, char * argv[], const char *shortopts,
+static int _getopt_internal(int argc, char * argv[], const char *shortopts,
                      const struct option *longopts, int *longind,
                      int long_only)
 {
@@ -192,7 +194,7 @@ int _getopt_internal(int argc, char * argv[], const char *shortopts,
       break;
     }
   } else if((!long_only) && (argv[optind][1] != '-'))
-    opt = getopt(argc, argv, shortopts);
+    opt = my_getopt(argc, argv, shortopts);
   else {
     int charind, offset;
     int found = 0, ind, hits = 0;
@@ -206,7 +208,7 @@ int _getopt_internal(int argc, char * argv[], const char *shortopts,
             ((c == 'W') && (shortopts[ind] == ';'))) &&
            (shortopts[++ind] == ':'))
           ind ++;
-        if(optopt == c) return getopt(argc, argv, shortopts);
+        if(optopt == c) return my_getopt(argc, argv, shortopts);
       }
     }
     offset = 2 - (argv[optind][1] != '-');
@@ -251,7 +253,7 @@ int _getopt_internal(int argc, char * argv[], const char *shortopts,
       }
       optind++;
     } else if(!hits) {
-      if(offset == 1) opt = getopt(argc, argv, shortopts);
+      if(offset == 1) opt = my_getopt(argc, argv, shortopts);
       else {
         opt = '?';
         if(opterr) fprintf(stderr,
@@ -269,13 +271,13 @@ int _getopt_internal(int argc, char * argv[], const char *shortopts,
   return opt;
 }
 
-int getopt_long(int argc, char * argv[], const char *shortopts,
+int my_getopt_long(int argc, char * argv[], const char *shortopts,
                 const struct option *longopts, int *longind)
 {
   return _getopt_internal(argc, argv, shortopts, longopts, longind, 0);
 }
 
-int getopt_long_only(int argc, char * argv[], const char *shortopts,
+int my_getopt_long_only(int argc, char * argv[], const char *shortopts,
                 const struct option *longopts, int *longind)
 {
   return _getopt_internal(argc, argv, shortopts, longopts, longind, 1);
diff --git a/shared/getopt.h b/shared/getopt.h
index b4a08f6..ae65257 100644
--- a/shared/getopt.h
+++ b/shared/getopt.h
@@ -30,11 +30,8 @@
 extern "C" {
 #endif
 
-/* reset argument parser to start-up values */
-extern int getopt_reset(void);
-
 /* UNIX-style short-argument parser */
-extern int getopt(int argc, char *argv[], const char *opts);
+extern int my_getopt(int argc, char *argv[], const char *opts);
 
 extern int optind, opterr, optopt;
 extern char *optarg;
@@ -55,16 +52,12 @@ struct option {
 #define optional_argument 2
 
 /* GNU-style long-argument parsers */
-extern int getopt_long(int argc, char * argv[], const char *shortopts,
+extern int my_getopt_long(int argc, char * argv[], const char *shortopts,
                        const struct option *longopts, int *longind);
 
-extern int getopt_long_only(int argc, char * argv[], const char *shortopts,
+extern int my_getopt_long_only(int argc, char * argv[], const char *shortopts,
                             const struct option *longopts, int *longind);
 
-extern int _getopt_internal(int argc, char * argv[], const char *shortopts,
-                            const struct option *longopts, int *longind,
-                            int long_only);
-
 #ifdef __cplusplus
 }
 #endif
diff --git a/shared/optparser.c b/shared/optparser.c
index f3d085f..7422c74 100644
--- a/shared/optparser.c
+++ b/shared/optparser.c
@@ -766,7 +766,7 @@ struct optstruct *optparse(const char *cfgfile, int argc, char **argv, int verbo
 
 	} else {
 	    opt_index = 0;
-	    ret = getopt_long(argc, argv, shortopts, longopts, &opt_index);
+	    ret = my_getopt_long(argc, argv, shortopts, longopts, &opt_index);
 	    if(ret == -1)
 		break;
 

-- 
Debian repository for ClamAV



More information about the Pkg-clamav-commits mailing list