Update included popt to version 1.7

Max Bowsher maxb at ukf.net
Thu May 15 23:42:24 EST 2003


[Oops, accidentally pressed Ctrl+Enter last time]

jw schultz wrote:
> OK.  With that widespread a usage it cannot not be in the
> major dists and is confirmed to be in cygwin.  Lets drop
> popt source.  One less bit of foreign code to keep in sync
> and port patches for.

Rsync's popt has local modifications:

2003-01-18 19:00  wayned

 * popt.c (1.5): Define DBL_EPSILON if it doesn't exist.

2003-01-14 21:37  dwd

 * popthelp.c (1.3): Don't use the return value from sprintf because
 it doesn't work on Sunos4.

2003-01-12 21:49  wayned

 * system.h (1.3): Use the old kludge of using malloc() if alloca()
 is missing.

2003-01-11 19:01  dwd

 * poptconfig.c (1.4): Cast the return from alloca to work better on
 UNICOS.

2003-01-11 14:39  dwd

 * popt.c (1.4): Cast the return of alloca to remove a fatal error
 on Cray UNICOS.


Granted, these are mainly compilation fixes for popt itself, but they
presumably indicate systems which often do not have a system popt. Not that
I've ever seen any of these fairly obscure systems, but they should at least
be mentioned in the release notes.


Max.

--
Diff of changes against upstream popt:

Index: rsync/popt/popt.c
diff -u rsync/popt/popt.c:1.1.1.2 rsync/popt/popt.c:1.6
--- rsync/popt/popt.c:1.1.1.2 Wed May 14 17:21:03 2003
+++ rsync/popt/popt.c Wed May 14 17:24:18 2003
@@ -927,6 +927,9 @@
       if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_DOUBLE) {
    *((double *) opt->arg) = aDouble;
       } else {
+#ifndef DBL_EPSILON
+#define DBL_EPSILON 2.2204460492503131e-16
+#endif
 #define _ABS(a) ((((a) - 0.0) < DBL_EPSILON) ? -(a) : (a))
    if ((_ABS(aDouble) - FLT_MAX) > DBL_EPSILON)
        return POPT_ERROR_OVERFLOW;
@@ -1080,7 +1083,7 @@
 int poptAddAlias(poptContext con, struct poptAlias alias,
   /*@unused@*/ int flags)
 {
-    poptItem item = alloca(sizeof(*item));
+    poptItem item = (poptItem) alloca(sizeof(*item));
     memset(item, 0, sizeof(*item));
     item->option.longName = alias.longName;
     item->option.shortName = alias.shortName;
Index: rsync/popt/poptconfig.c
diff -u rsync/popt/poptconfig.c:1.1.1.2 rsync/popt/poptconfig.c:1.5
--- rsync/popt/poptconfig.c:1.1.1.2 Wed May 14 17:21:03 2003
+++ rsync/popt/poptconfig.c Wed May 14 17:24:19 2003
@@ -18,7 +18,7 @@
     /*@=type@*/
     const char * entryType;
     const char * opt;
-    poptItem item = alloca(sizeof(*item));
+    poptItem item = (poptItem) alloca(sizeof(*item));
     int i, j;

 /*@-boundswrite@*/
Index: rsync/popt/popthelp.c
diff -u rsync/popt/popthelp.c:1.1.1.2 rsync/popt/popthelp.c:1.4
--- rsync/popt/popthelp.c:1.1.1.2 Wed May 14 17:21:04 2003
+++ rsync/popt/popthelp.c Wed May 14 17:24:19 2003
@@ -146,19 +146,23 @@
     case POPT_ARG_VAL:
     case POPT_ARG_INT:
     { long aLong = *((int *)opt->arg);
- le += sprintf(le, "%ld", aLong);
+ sprintf(le, "%ld", aLong);
+ le += strlen(le);
     } break;
     case POPT_ARG_LONG:
     { long aLong = *((long *)opt->arg);
- le += sprintf(le, "%ld", aLong);
+ sprintf(le, "%ld", aLong);
+ le += strlen(le);
     } break;
     case POPT_ARG_FLOAT:
     { double aDouble = *((float *)opt->arg);
- le += sprintf(le, "%g", aDouble);
+ sprintf(le, "%g", aDouble);
+ le += strlen(le);
     } break;
     case POPT_ARG_DOUBLE:
     { double aDouble = *((double *)opt->arg);
- le += sprintf(le, "%g", aDouble);
+ sprintf(le, "%g", aDouble);
+ le += strlen(le);
     } break;
     case POPT_ARG_STRING:
     { const char * s = *(const char **)opt->arg;
@@ -289,7 +293,8 @@
   *le++ = '=';
   if (negate) *le++ = '~';
   /*@-formatconst@*/
-  le += sprintf(le, (ops ? "0x%lx" : "%ld"), aLong);
+  sprintf(le, (ops ? "0x%lx" : "%ld"), aLong);
+  le += strlen(le);
   /*@=formatconst@*/
   *le++ = ']';
      }
Index: rsync/popt/system.h
diff -u rsync/popt/system.h:1.1.1.2 rsync/popt/system.h:1.4
--- rsync/popt/system.h:1.1.1.2 Wed May 14 17:21:04 2003
+++ rsync/popt/system.h Wed May 14 17:24:19 2003
@@ -51,8 +51,15 @@
 #  ifdef _AIX
 #pragma alloca
 #  else
-#   ifndef alloca /* predefined by HP cc +Olibcalls */
+#   if HAVE_ALLOCA
+#    ifndef alloca /* predefined by HP cc +Olibcalls */
 char *alloca ();
+#    endif
+#   else
+#    ifdef alloca
+#     undef alloca
+#    endif
+#    define alloca(sz) malloc(sz) /* Kludge this for now */
 #   endif
 #  endif
 # endif




More information about the rsync mailing list