OSSP CVS Repository

ossp - Check-in [2016]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 2016
Date: 2002-Mar-15 09:49:48 (local)
2002-Mar-15 08:49:48 (UTC)
User:rse
Branch:
Comment: upgrade to POPT 1.6.4
Tickets:
Inspections:
Files:
ossp-pkg/popt/popt.c      1.1 -> 1.2     42 inserted, 11 deleted
ossp-pkg/popt/popt.h      1.1 -> 1.2     45 inserted, 40 deleted

ossp-pkg/popt/popt.c 1.1 -> 1.2

--- popt.c       2002/01/30 14:00:22     1.1
+++ popt.c       2002/03/15 08:49:48     1.2
@@ -25,7 +25,7 @@
  *
  *  NOTICE:
  *  This is an automatically generated, stripped down version of the
- *  POPT 1.6.3 library from Red Hat, Inc. This version is still
+ *  POPT 1.6.4 library from Red Hat, Inc. This version is still
  *  distributed under above Open Source license, but Red Hat is no longer
  *  responsible for this version. Contact The OSSP Project instead.
  */
@@ -60,6 +60,7 @@
 #elif defined(__GNUC__) && defined(__STRICT_ANSI__)
 #define alloca __builtin_alloca
 #endif
+
 #include "popt.h"
 
 #ifndef H_POPTINT
@@ -75,7 +76,7 @@
 typedef unsigned int __pbm_bits;
 #define __PBM_NBITS             (8 * sizeof (__pbm_bits))
 #define __PBM_IX(d)             ((d) / __PBM_NBITS)
-#define __PBM_MASK(d)           ((__pbm_bits) 1 << ((d) % __PBM_NBITS))
+#define __PBM_MASK(d)           ((__pbm_bits) 1 << (((unsigned)(d)) % __PBM_NBITS))
 typedef struct {
         __pbm_bits bits[1];
 } pbm_set;
@@ -166,6 +167,7 @@
         strcpy(pathbuf, path);
 
         chptr = NULL;
+
         do {
                 if ((chptr = strchr(start, ':')))
                         *chptr = '\0';
@@ -195,6 +197,8 @@
         con->execPath = _free(con->execPath);
         con->execPath = strdup(path);
         con->execAbsolute = allowAbsolute;
+        return;
+
 }
 
 static void invokeCallbacksPRE(popt_context con,
@@ -296,7 +300,7 @@
         if (!(flags & POPT_CONTEXT_KEEP_FIRST))
                 con->os->next = 1;
 
-        con->leftovers = calloc((argc + 1), sizeof (char *));
+        con->leftovers = calloc((argc + 1), sizeof (*con->leftovers));
         con->options = options;
 
         con->aliases = NULL;
@@ -624,6 +628,7 @@
                         break;
                 if (os->argv != NULL)
                         for (i = os->next; i < os->argc; i++) {
+
                                 if (os->argb && PBM_ISSET(i, os->argb))
                                         continue;
                                 if (*os->argv[i] == '-')
@@ -638,6 +643,7 @@
                                                 PBM_SET(i, os->argb);
                                 }
                                 break;
+
                         }
                 if (os > con->optionStack)
                         os--;
@@ -689,10 +695,14 @@
 
 static void poptStripArg(popt_context con, int which)
 {
+
         if (con->arg_strip == NULL)
                 con->arg_strip = PBM_ALLOC(con->optionStack[0].argc);
         if (con->arg_strip != NULL)
                 PBM_SET(which, con->arg_strip);
+
+        return;
+
 }
 
 static int poptSaveLong(const struct popt_option *opt, long aLong)
@@ -769,7 +779,9 @@
                         cleanOSE(con->os--);
                 }
                 if (!con->os->nextCharArg && con->os->next == con->os->argc) {
+
                         invokeCallbacksPOST(con, con->options);
+
                         if (con->doExec)
                                 return execCommand(con);
                         return -1;
@@ -783,6 +795,7 @@
                                 con->os->next++;
                                 continue;
                         }
+
                         thisopt = con->os->next;
                         if (con->os->argv != NULL)
                                 origOptString = con->os->argv[con->os->next++];
@@ -878,7 +891,6 @@
                         origOptString++;
                         if (*origOptString != '\0')
                                 con->os->nextCharArg = origOptString;
-
                 }
 
                 if (opt == NULL)
@@ -974,12 +986,14 @@
                                                         char *end;
 
                                                         if (con->os->nextArg) {
+
                                                                 int saveerrno = errno;
                                                                 errno = 0;
                                                                 aDouble = strtod(con->os->nextArg, &end);
                                                                 if (errno == ERANGE)
                                                                         return POPT_ERROR_OVERFLOW;
                                                                 errno = saveerrno;
+
                                                                 if (*end != '\0')
                                                                         return POPT_ERROR_BADNUMBER;
                                                         }
@@ -1003,12 +1017,16 @@
                                                                 ("option type (%d) not implemented in popt\n"),
                                                                 (opt->argInfo & POPT_ARG_MASK));
                                                 exit(EXIT_FAILURE);
+                                                break;
                                 }
                         }
                 }
 
-                if (cb)
+                if (cb) {
+
                         invokeCallbacksOPTION(con, con->options, opt, cbData, shorty);
+
+                }
                 else if (opt->val && ((opt->argInfo & POPT_ARG_MASK) != POPT_ARG_VAL))
                         done = 1;
 
@@ -1051,10 +1069,12 @@
 const char *popt_getoptarg(popt_context con)
 {
         const char *ret = NULL;
+
         if (con) {
                 ret = con->os->nextArg;
                 con->os->nextArg = NULL;
         }
+
         return ret;
 }
 
@@ -1133,19 +1153,19 @@
         return con;
 }
 
-int popt_addalias(popt_context con, struct popt_alias newAlias, int flags)
+int popt_addalias(popt_context con, struct popt_alias alias, int flags)
 {
         popt_item item = alloca(sizeof (*item));
         memset(item, 0, sizeof (*item));
-        item->option.longName = newAlias.longName;
-        item->option.shortName = newAlias.shortName;
+        item->option.longName = alias.longName;
+        item->option.shortName = alias.shortName;
         item->option.argInfo = POPT_ARGFLAG_DOC_HIDDEN;
         item->option.arg = 0;
         item->option.val = 0;
         item->option.descrip = NULL;
         item->option.argDescrip = NULL;
-        item->argc = newAlias.argc;
-        item->argv = newAlias.argv;
+        item->argc = alias.argc;
+        item->argv = alias.argv;
         return popt_additem(con, item, 0);
 }
 
@@ -1310,6 +1330,7 @@
                 argv2[i] = dst;
                 dst += strlen(strcpy(dst, argv[i])) + 1;
         }
+
         argv2[argc] = NULL;
 
         if (argvPtr) {
@@ -1400,7 +1421,9 @@
 
 static void configLine(popt_context con, char *line)
 {
+
         int nameLength = strlen(con->appName);
+
         const char *entryType;
         const char *opt;
         popt_item item = alloca(sizeof (*item));
@@ -1410,6 +1433,7 @@
 
         if (strncmp(line, con->appName, nameLength))
                 return;
+
         line += nameLength;
         if (*line == '\0' || !isspace(*line))
                 return;
@@ -1477,6 +1501,7 @@
                 (void)popt_additem(con, item, 0);
         else if (!strcmp(entryType, "exec"))
                 (void)popt_additem(con, item, 1);
+
 }
 
 int popt_readconfigfile(popt_context con, const char *fn)
@@ -1495,7 +1520,9 @@
         if (fileLength == -1 || lseek(fd, 0, 0) == -1) {
                 rc = errno;
                 (void)close(fd);
+
                 errno = rc;
+
                 return POPT_ERROR_ERRNO;
         }
 
@@ -1503,7 +1530,9 @@
         if (read(fd, (char *)file, fileLength) != fileLength) {
                 rc = errno;
                 (void)close(fd);
+
                 errno = rc;
+
                 return POPT_ERROR_ERRNO;
         }
         if (close(fd) == -1)
@@ -1645,7 +1674,7 @@
         char *le = malloc(4 * lineLength + 1);
         char *l = le;
 
-        if (l == NULL)
+        if (le == NULL)
                 return NULL;
         *le = '\0';
         *le++ = '(';
@@ -1873,7 +1902,9 @@
                 fprintf(fp, "%s\n", help);
 
   out:
+
         defs = _free(defs);
+
         left = _free(left);
 }
 


ossp-pkg/popt/popt.h 1.1 -> 1.2

--- popt.h       2002/01/30 14:00:22     1.1
+++ popt.h       2002/03/15 08:49:49     1.2
@@ -25,7 +25,7 @@
  *
  *  NOTICE:
  *  This is an automatically generated, stripped down version of the
- *  POPT 1.6.3 library from Red Hat, Inc. This version is still
+ *  POPT 1.6.4 library from Red Hat, Inc. This version is still
  *  distributed under above Open Source license, but Red Hat is no longer
  *  responsible for this version. Contact The OSSP Project instead.
  */
@@ -33,10 +33,6 @@
 #ifndef __POPT_H__
 #define __POPT_H__
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 #include <stdio.h>
 
 #define POPT_OPTION_DEPTH       10
@@ -98,51 +94,55 @@
 #define POPT_CONTEXT_POSIXMEHARDER (1 << 2)
 #define POPT_CONTEXT_ARG_OPTS   (1 << 4)
 
-        struct popt_option {
-                const char *longName;
-                char shortName;
-                int argInfo;
-                void *arg;
-                int val;
-                const char *descrip;
-                const char *argDescrip;
-        };
-
-        struct popt_alias {
-                const char *longName;
-                char shortName;
-                int argc;
-                const char **argv;
-        };
-
-        typedef struct popt_item_s {
-                struct popt_option option;
-                int argc;
-                const char **argv;
-        }  *popt_item;
+struct popt_option {
+        const char *longName;
+        char shortName;
+        int argInfo;
+        void *arg;
+        int val;
+        const char *descrip;
+        const char *argDescrip;
+};
+
+struct popt_alias {
+        const char *longName;
+        char shortName;
+        int argc;
+        const char **argv;
+};
+
+typedef struct popt_item_s {
+        struct popt_option option;
+        int argc;
+        const char **argv;
+}  *popt_item;
 
-        extern struct popt_option popt_aliasOptions[];
+extern struct popt_option popt_aliasOptions[];
 #define POPT_AUTOALIAS { NULL, '\0', POPT_ARG_INCLUDE_TABLE, popt_aliasOptions, \
                         0, "Options implemented via popt alias/exec:", NULL },
 
-        extern struct popt_option popt_helpoptions[];
+extern struct popt_option popt_helpoptions[];
 #define POPT_AUTOHELP { NULL, '\0', POPT_ARG_INCLUDE_TABLE, popt_helpoptions, \
                         0, "Help options:", NULL },
 
 #define POPT_TABLEEND { NULL, '\0', 0, 0, 0, NULL, NULL }
 
-        typedef struct popt_context_s *popt_context;
+typedef struct popt_context_s *popt_context;
 
 #ifndef __cplusplus
 
-        typedef struct popt_option *popt_option;
+typedef struct popt_option *popt_option;
 
 #endif
 
-        enum popt_callbackreason { POPT_CALLBACK_REASON_PRE,
-                POPT_CALLBACK_REASON_POST,
-                POPT_CALLBACK_REASON_OPTION
-        };
+enum popt_callbackreason { POPT_CALLBACK_REASON_PRE,
+        POPT_CALLBACK_REASON_POST,
+        POPT_CALLBACK_REASON_OPTION
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif
 
         typedef void (*popt_callbacktype) (popt_context con,
                                                                            enum popt_callbackreason reason,
@@ -156,7 +156,8 @@
 
         void popt_resetcontext(popt_context con);
 
-        int popt_getnextopt(popt_context con);
+        int popt_getnextopt(popt_context con)
+           ;
 
         const char *popt_getoptarg(popt_context con);
 
@@ -176,9 +177,11 @@
 
         int popt_additem(popt_context con, popt_item newItem, int flags);
 
-        int popt_readconfigfile(popt_context con, const char *fn);
+        int popt_readconfigfile(popt_context con, const char *fn)
+           ;
 
-        int popt_readdefaultconfig(popt_context con, int useEnv);
+        int popt_readdefaultconfig(popt_context con, int useEnv)
+           ;
 
         int popt_dupargv(int argc, const char **argv,
                                          int *argcPtr, const char ***argvPtr);
@@ -191,9 +194,11 @@
         void popt_setexecpath(popt_context con, const char *path,
                                                   int allowAbsolute);
 
-        void popt_printhelp(popt_context con, FILE * fp, int flags);
+        void popt_printhelp(popt_context con, FILE * fp, int flags)
+           ;
 
-        void popt_printusage(popt_context con, FILE * fp, int flags);
+        void popt_printusage(popt_context con, FILE * fp, int flags)
+           ;
 
         void popt_setotheroptionhelp(popt_context con, const char *text);
 

CVSTrac 2.0.1