RPM Package Manager, CVS Repository http://rpm5.org/cvs/ ____________________________________________________________________________
Server: rpm5.org Name: Jeff Johnson Root: /v/rpm/cvs Email: j...@rpm5.org Module: rpm Date: 11-Apr-2009 16:51:01 Branch: rpm-5_1 Handle: 2009041114505902 Modified files: (Branch: rpm-5_1) rpm CHANGES rpm/lib poptALL.c poptI.c poptQV.c rpm/rpmio rpmdigest.c rpmmtree.c rpmrepo.c rpm/tools rpmgrep.c rpmmtree.c rpmrepo.c Log: - popt: remove retrofits for popt < 1.14. use popt internal if needed. Summary: Revision Changes Path 1.2288.2.291+1 -1 rpm/CHANGES 2.90.2.22 +0 -4 rpm/lib/poptALL.c 2.41.2.4 +0 -4 rpm/lib/poptI.c 2.51.2.4 +0 -87 rpm/lib/poptQV.c 2.10.2.1 +0 -60 rpm/rpmio/rpmdigest.c 1.40.2.1 +0 -33 rpm/rpmio/rpmmtree.c 1.44.2.6 +0 -53 rpm/rpmio/rpmrepo.c 2.1.2.4 +0 -67 rpm/tools/rpmgrep.c 2.1.2.6 +0 -33 rpm/tools/rpmmtree.c 2.1.2.9 +0 -135 rpm/tools/rpmrepo.c ____________________________________________________________________________ patch -p0 <<'@@ .' Index: rpm/CHANGES ============================================================================ $ cvs diff -u -r1.2288.2.290 -r1.2288.2.291 CHANGES --- rpm/CHANGES 11 Apr 2009 09:52:23 -0000 1.2288.2.290 +++ rpm/CHANGES 11 Apr 2009 14:50:59 -0000 1.2288.2.291 @@ -1,5 +1,5 @@ 5.1.7 -> 5.1.8: - - rse: upgrade devtool.conf and INSTALL to the latest tools from HEAD + - jbj: popt: remove retrofits for popt < 1.14. use popt internal if needed. - jbj: mire: teardown for platpat on exit needs to be done in order. - jbj: rpmwget: move to tools. - jbj: rpmio: more random line noise reduction, diff'ing against HEAD. @@ . patch -p0 <<'@@ .' Index: rpm/lib/poptALL.c ============================================================================ $ cvs diff -u -r2.90.2.21 -r2.90.2.22 poptALL.c --- rpm/lib/poptALL.c 6 Apr 2009 15:27:17 -0000 2.90.2.21 +++ rpm/lib/poptALL.c 11 Apr 2009 14:51:00 -0000 2.90.2.22 @@ -30,10 +30,6 @@ /*...@unchecked@*/ /*...@only@*/ /*...@null@*/ extern unsigned int * keyids; -#if !defined(POPT_ARGFLAG_TOGGLE) /* XXX compat with popt < 1.15 */ -#define POPT_ARGFLAG_TOGGLE 0 -#endif - #define POPT_SHOWVERSION -999 #define POPT_SHOWRC -998 #define POPT_QUERYTAGS -997 @@ . patch -p0 <<'@@ .' Index: rpm/lib/poptI.c ============================================================================ $ cvs diff -u -r2.41.2.3 -r2.41.2.4 poptI.c --- rpm/lib/poptI.c 5 Apr 2009 18:03:08 -0000 2.41.2.3 +++ rpm/lib/poptI.c 11 Apr 2009 14:51:00 -0000 2.41.2.4 @@ -21,10 +21,6 @@ }; /*...@=fullinitblock@*/ -#if !defined(POPT_ARGFLAG_TOGGLE) /* XXX compat with popt < 1.15 */ -#define POPT_ARGFLAG_TOGGLE 0 -#endif - #define POPT_RELOCATE -1021 #define POPT_EXCLUDEPATH -1022 #define POPT_ROLLBACK -1023 @@ . patch -p0 <<'@@ .' Index: rpm/lib/poptQV.c ============================================================================ $ cvs diff -u -r2.51.2.3 -r2.51.2.4 poptQV.c --- rpm/lib/poptQV.c 5 Apr 2009 14:35:08 -0000 2.51.2.3 +++ rpm/lib/poptQV.c 11 Apr 2009 14:51:00 -0000 2.51.2.4 @@ -19,10 +19,6 @@ /*...@unchecked@*/ int specedit = 0; -#if !defined(POPT_ARGFLAG_TOGGLE) /* XXX compat with popt < 1.15 */ -#define POPT_ARGFLAG_TOGGLE 0 -#endif - #define POPT_QUERYFORMAT -1000 #define POPT_WHATREQUIRES -1001 #define POPT_WHATPROVIDES -1002 @@ -194,89 +190,6 @@ POPT_TABLEEND }; -#if !defined(POPT_READFILE_TRIMNEWLINES) /* XXX popt < 1.15 */ -#define POPT_READFILE_TRIMNEWLINES 1 - -/** - * Read a file into a buffer. - * @param fn file name - * @retval *bp buffer (malloc'd) - * @retval *nbp no. of bytes in buffer (including final NUL) - * @param flags 1 to trim escaped newlines - * return 0 on success - */ -static int poptReadFile(const char * fn, char ** bp, size_t * nbp, int flags) - /*...@globals errno @*/ - /*...@modifies *bp, *nbp, errno @*/ -{ - int fdno; - char * b = NULL; - off_t nb = 0; - char * s, * t, * se; - int rc = POPT_ERROR_ERRNO; /* assume failure */ - - fdno = open(fn, O_RDONLY); - if (fdno < 0) - goto exit; - - if ((nb = lseek(fdno, 0, SEEK_END)) == (off_t)-1 - || lseek(fdno, 0, SEEK_SET) == (off_t)-1 - || (b = calloc(sizeof(*b), (size_t)nb + 1)) == NULL - || read(fdno, (char *)b, (size_t)nb) != (ssize_t)nb) - { - int oerrno = errno; - (void) close(fdno); - errno = oerrno; - goto exit; - } - if (close(fdno) == -1) - goto exit; - if (b == NULL) { - rc = POPT_ERROR_MALLOC; - goto exit; - } - rc = 0; - - /* Trim out escaped newlines. */ -/*...@-bitwisesigned@*/ - if (flags & POPT_READFILE_TRIMNEWLINES) -/*...@=bitwisesigned@*/ - { - for (t = b, s = b, se = b + nb; *s && s < se; s++) { - switch (*s) { - case '\\': - if (s[1] == '\n') { - s++; - continue; - } - /*...@fallthrough@*/ - default: - *t++ = *s; - /*...@switchbreak@*/ break; - } - } - *t++ = '\0'; - nb = (off_t)(t - b); - } - -exit: - if (rc == 0) { - *bp = b; - *nbp = (size_t) nb; - } else { -/*...@-usedef@*/ - if (b) - free(b); -/*...@=usedef@*/ - *bp = NULL; - *nbp = 0; - } -/*...@-compdef -nullstate @*/ /* XXX cannot annotate char ** correctly */ - return rc; -/*...@=compdef =nullstate @*/ -} -#endif /* !defined(POPT_READFILE_TRIMNEWLINES) */ - /* ========== Query specific popt args */ static void queryArgCallback(poptContext con, @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/rpmdigest.c ============================================================================ $ cvs diff -u -r2.10 -r2.10.2.1 rpmdigest.c --- rpm/rpmio/rpmdigest.c 10 Mar 2008 04:46:19 -0000 2.10 +++ rpm/rpmio/rpmdigest.c 11 Apr 2009 14:51:00 -0000 2.10.2.1 @@ -257,74 +257,14 @@ return rc; } -#if !defined(POPT_ARG_ARGV) -static int _poptSaveString(const char ***argvp, unsigned int argInfo, const char * val) - /*...@*/ -{ - ARGV_t argv; - int argc = 0; - if (argvp == NULL) - return -1; - if (*argvp) - while ((*argvp)[argc] != NULL) - argc++; - *argvp = xrealloc(*argvp, (argc + 1 + 1) * sizeof(**argvp)); - if ((argv = *argvp) != NULL) { - argv[argc++] = xstrdup(val); - argv[argc ] = NULL; - } - return 0; -} - -/** - */ -static void rpmdcArgCallback(poptContext con, - /*...@unused@*/ enum poptCallbackReason reason, - const struct poptOption * opt, /*...@unused@*/ const char * arg, - /*...@unused@*/ void * data) - /*...@globals fileSystem @*/ - /*...@modifies fileSystem @*/ -{ - /* XXX avoid accidental collisions with POPT_BIT_SET for flags */ - if (opt->arg == NULL) - switch (opt->val) { - int xx; - case 'c': -assert(arg != NULL); - xx = _poptSaveString(&_dc.manifests, opt->argInfo, arg); - break; - - default: - fprintf(stderr, _("%s: Unknown option -%c\n"), __progname, opt->val); - poptPrintUsage(con, stderr, 0); -/*...@-exitarg@*/ - exit(2); -/*...@=exitarg@*/ - /*...@notreached@*/ break; - } -} -#endif /* POPT_ARG_ARGV */ - static struct poptOption optionsTable[] = { -#if !defined(POPT_ARG_ARGV) -/*...@-type@*/ /* FIX: cast? */ - { NULL, '\0', POPT_ARG_CALLBACK | POPT_CBFLAG_INC_DATA | POPT_CBFLAG_CONTINUE, - rpmdcArgCallback, 0, NULL, NULL }, -/*...@=type@*/ -#endif /* POPT_ARG_ARGV */ { "binary", 'b', POPT_BIT_SET, &_dc.flags, RPMDC_FLAGS_BINARY, N_("read in binary mode"), NULL }, -#if !defined(POPT_ARG_ARGV) - { "check", 'c', POPT_ARG_STRING, NULL, 'c', - N_("read digests from MANIFEST file and verify (may be used more than once)"), - N_("MANIFEST") }, -#else { "check", 'c', POPT_ARG_ARGV, &_dc.manifests, 0, N_("read digests from MANIFEST file and verify (may be used more than once)"), N_("MANIFEST") }, -#endif { "text", 't', POPT_BIT_CLR, &_dc.flags, RPMDC_FLAGS_BINARY, N_("read in text mode (default)"), NULL }, @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/rpmmtree.c ============================================================================ $ cvs diff -u -r1.40 -r1.40.2.1 rpmmtree.c --- rpm/rpmio/rpmmtree.c 25 Mar 2008 09:20:44 -0000 1.40 +++ rpm/rpmio/rpmmtree.c 11 Apr 2009 14:51:00 -0000 1.40.2.1 @@ -286,28 +286,6 @@ /*==============================================================*/ -#if !defined(POPT_ARG_ARGV) -static int _poptSaveString(const char ***argvp, unsigned int argInfo, const char * val) - /*...@*/ -{ - ARGV_t argv; - int argc = 0; - if (argvp == NULL) - return -1; - if (*argvp) - while ((*argvp)[argc] != NULL) - argc++; - *argvp = xrealloc(*argvp, (argc + 1 + 1) * sizeof(**argvp)); - if ((argv = *argvp) != NULL) { - argv[argc++] = xstrdup(val); - argv[argc ] = NULL; - } - return 0; -} -#endif - -/*==============================================================*/ - /*...@exits@*/ static void mtree_error(const char *fmt, ...) @@ -3509,12 +3487,6 @@ } /*...@=unrecog@*/ break; -#if !defined(POPT_ARG_ARGV) - case 'p': -assert(arg != NULL); - (void) _poptSaveString(&_rpmfts->paths, opt->argInfo, arg); - break; -#endif /* XXX redundant with --logical. */ case 'L': @@ -3573,13 +3545,8 @@ N_("Loose permissions check"), NULL }, { "nocomment",'n', POPT_BIT_SET, &mtreeFlags, MTREE_FLAGS_NOCOMMENT, N_("Don't include sub-directory comments"), NULL }, -#if defined(POPT_ARG_ARGV) { "path",'p', POPT_ARG_ARGV, &__rpmfts.paths, 0, N_("Use <path> rather than current directory"), N_("<path>") }, -#else - { "path",'p', POPT_ARG_STRING, NULL, 'p', - N_("Use <path> rather than current directory"), N_("<path>") }, -#endif /* XXX --quiet collides w poptIO */ { "quiet",'q', POPT_BIT_SET, &mtreeFlags, MTREE_FLAGS_QUIET, N_("Quiet mode"), NULL }, @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/rpmrepo.c ============================================================================ $ cvs diff -u -r1.44.2.5 -r1.44.2.6 rpmrepo.c --- rpm/rpmio/rpmrepo.c 3 Jun 2008 20:43:17 -0000 1.44.2.5 +++ rpm/rpmio/rpmrepo.c 11 Apr 2009 14:51:00 -0000 1.44.2.6 @@ -1863,28 +1863,6 @@ /*==============================================================*/ -#if !defined(POPT_ARG_ARGV) -/** - */ -static int _poptSaveString(const char ***argvp, unsigned int argInfo, const char * val) - /*...@*/ -{ - ARGV_t argv; - int argc = 0; - if (argvp == NULL) - return -1; - if (*argvp) - while ((*argvp)[argc] != NULL) - argc++; - *argvp = xrealloc(*argvp, (argc + 1 + 1) * sizeof(**argvp)); - if ((argv = *argvp) != NULL) { - argv[argc++] = xstrdup(val); - argv[argc ] = NULL; - } - return 0; -} -#endif - /** */ static void repoArgCallback(poptContext con, @@ -1899,22 +1877,6 @@ /* XXX avoid accidental collisions with POPT_BIT_SET for flags */ if (opt->arg == NULL) switch (opt->val) { -#if !defined(POPT_ARG_ARGV) - int xx; - case 'x': /* --excludes */ -assert(arg != NULL); - xx = _poptSaveString(&repo->exclude_patterns, opt->argInfo, arg); - break; - case 'i': /* --includes */ -assert(arg != NULL); - xx = _poptSaveString(&repo->include_patterns, opt->argInfo, arg); - break; - case 'l': /* --pkglist */ -assert(arg != NULL); - xx = _poptSaveString(&repo->manifests, opt->argInfo, arg); - break; -#endif - case 'v': /* --verbose */ repo->verbose++; break; @@ -1959,20 +1921,10 @@ N_("output more debugging info."), NULL }, { "dryrun", '\0', POPT_ARG_VAL, &__rpmrepo.dryrun, 1, N_("sanity check arguments, don't create metadata"), NULL }, -#if defined(POPT_ARG_ARGV) { "excludes", 'x', POPT_ARG_ARGV, &__rpmrepo.exclude_patterns, 0, N_("glob PATTERN(s) to exclude"), N_("PATTERN") }, -#else - { "excludes", 'x', POPT_ARG_STRING, NULL, 'x', - N_("glob PATTERN(s) to exclude"), N_("PATTERN") }, -#endif -#if defined(POPT_ARG_ARGV) { "includes", 'i', POPT_ARG_ARGV, &__rpmrepo.include_patterns, 0, N_("glob PATTERN(s) to include"), N_("PATTERN") }, -#else - { "includes", 'i', POPT_ARG_STRING, NULL, 'i', - N_("glob PATTERN(s) to include"), N_("PATTERN") }, -#endif { "basedir", '\0', POPT_ARG_STRING|POPT_ARGFLAG_DOC_HIDDEN, &__rpmrepo.basedir, 0, N_("top level directory"), N_("DIR") }, { "baseurl", 'u', POPT_ARG_STRING|POPT_ARGFLAG_DOC_HIDDEN, &__rpmrepo.baseurl, 0, @@ -1991,13 +1943,8 @@ #endif { "split", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &__rpmrepo.split, 1, N_("generate split media"), NULL }, -#if defined(POPT_ARG_ARGV) { "pkglist", 'l', POPT_ARG_ARGV|POPT_ARGFLAG_DOC_HIDDEN, &__rpmrepo.manifests, 0, N_("use only the files listed in this file from the directory specified"), N_("FILE") }, -#else - { "pkglist", 'l', POPT_ARG_STRING|POPT_ARGFLAG_DOC_HIDDEN, NULL, 'l', - N_("use only the files listed in this file from the directory specified"), N_("FILE") }, -#endif { "outputdir", 'o', POPT_ARG_STRING, &__rpmrepo.outputdir, 0, N_("<dir> = optional directory to output to"), N_("DIR") }, { "skip-symlinks", 'S', POPT_ARG_VAL, &__rpmrepo.nofollow, 1, @@ . patch -p0 <<'@@ .' Index: rpm/tools/rpmgrep.c ============================================================================ $ cvs diff -u -r2.1.2.3 -r2.1.2.4 rpmgrep.c --- rpm/tools/rpmgrep.c 16 Mar 2009 01:09:30 -0000 2.1.2.3 +++ rpm/tools/rpmgrep.c 11 Apr 2009 14:51:01 -0000 2.1.2.4 @@ -59,26 +59,6 @@ #define MBUFTHIRD 8192 #endif -#if !defined(POPT_ARG_ARGV) -static int _poptSaveString(const char ***argvp, unsigned int argInfo, const char * val) - /*...@*/ -{ - ARGV_t argv; - int argc = 0; - if (argvp == NULL) - return -1; - if (*argvp) - while ((*argvp)[argc] != NULL) - argc++; - *argvp = xrealloc(*argvp, (argc + 1 + 1) * sizeof(**argvp)); - if ((argv = *argvp) != NULL) { - argv[argc++] = xstrdup(val); - argv[argc ] = NULL; - } - return 0; -} -#endif - /************************************************* * Global variables * *************************************************/ @@ -1222,10 +1202,6 @@ /* Options without a single-letter equivalent get a negative value. This can be used to identify them. */ -#if !defined(POPT_ARG_ARGV) -#define POPT_EXCLUDE (-2) -#define POPT_INCLUDE (-4) -#endif /** */ @@ -1239,25 +1215,6 @@ /* XXX avoid accidental collisions with POPT_BIT_SET for flags */ if (opt->arg == NULL) switch (opt->val) { -#if !defined(POPT_ARG_ARGV) - int xx; - case 'f': -assert(arg != NULL); - xx = _poptSaveString(&pattern_filenames, opt->argInfo, arg); - break; - case POPT_INCLUDE: -assert(arg != NULL); - xx = _poptSaveString(&include_patterns, opt->argInfo, arg); - break; - case POPT_EXCLUDE: -assert(arg != NULL); - xx = _poptSaveString(&exclude_patterns, opt->argInfo, arg); - break; - case 'e': -assert(arg != NULL); - xx = _poptSaveString(&patterns, opt->argInfo, arg); - break; -#endif case 'd': if (!strcmp(arg, "read")) dee_action = dee_READ; @@ -1349,24 +1306,13 @@ N_("device, FIFO, or socket action (read|skip)"), N_("=action") }, { "directories", 'd', POPT_ARG_STRING, NULL, (int)'d', N_("directory action (read|skip|recurse)"), N_("=action") }, -#if defined(POPT_ARG_ARGV) { "regex", 'e', POPT_ARG_ARGV, &patterns, 0, N_("specify pattern (may be used more than once)"), N_("(p)") }, -#else - { "regex", 'e', POPT_ARG_STRING, NULL, 'e', - N_("specify pattern (may be used more than once)"), N_("(p)") }, -#endif { "fixed_strings", 'F', POPT_BIT_SET, &grepFlags, GREP_FLAGS_FIXED_STRINGS, N_("patterns are sets of newline-separated strings"), NULL }, -#if defined(POPT_ARG_ARGV) { "file", 'f', POPT_ARG_ARGV, &pattern_filenames, 0, N_("read patterns from file (may be used more than once)"), N_("=path") }, -#else - { "file", 'f', POPT_ARG_STRING, NULL, 'f', - N_("read patterns from file (may be used more than once)"), - N_("=path") }, -#endif { "file-offsets", '\0', POPT_BIT_SET, &grepFlags, GREP_FLAGS_FOFFSETS, N_("output file offsets, not text"), NULL }, { "with-filename", 'H', POPT_ARG_VAL, &filenames, FN_FORCE, @@ -1399,21 +1345,12 @@ N_("suppress output, just set return code"), NULL }, { "recursive", 'r', POPT_ARG_VAL, &dee_action, dee_RECURSE, N_("recursively scan sub-directories"), NULL }, -#if defined(POPT_ARG_ARGV) { "exclude", '\0', POPT_ARG_ARGV, &exclude_patterns, 0, N_("exclude matching files when recursing (may be used more than once)"), N_("=pattern") }, { "include", '\0', POPT_ARG_ARGV, &include_patterns, 0, N_("include matching files when recursing (may be used more than once)"), N_("=pattern") }, -#else - { "exclude", '\0', POPT_ARG_STRING, NULL, POPT_EXCLUDE, - N_("exclude matching files when recursing (may be used more than once)"), - N_("=pattern") }, - { "include", '\0', POPT_ARG_STRING, NULL, POPT_INCLUDE, - N_("include matching files when recursing (may be used more than once)"), - N_("=pattern") }, -#endif { "no-messages", 's', POPT_BIT_SET, &grepFlags, GREP_FLAGS_SILENT, N_("suppress error messages"), NULL }, { "silent", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, &grepFlags, GREP_FLAGS_SILENT, @@ -1560,11 +1497,7 @@ poptPrintUsage(optCon, stderr, 0); goto errxit; } -#if defined(POPT_ARG_ARGV) xx = poptSaveString(&patterns, POPT_ARG_ARGV, av[i]); -#else - xx = _poptSaveString(&patterns, 0, av[i]); -#endif i++; } @@ . patch -p0 <<'@@ .' Index: rpm/tools/rpmmtree.c ============================================================================ $ cvs diff -u -r2.1.2.5 -r2.1.2.6 rpmmtree.c --- rpm/tools/rpmmtree.c 26 Mar 2009 20:10:04 -0000 2.1.2.5 +++ rpm/tools/rpmmtree.c 11 Apr 2009 14:51:01 -0000 2.1.2.6 @@ -313,28 +313,6 @@ /*==============================================================*/ -#if !defined(POPT_ARG_ARGV) -static int _poptSaveString(const char ***argvp, unsigned int argInfo, const char * val) - /*...@*/ -{ - ARGV_t argv; - int argc = 0; - if (argvp == NULL) - return -1; - if (*argvp) - while ((*argvp)[argc] != NULL) - argc++; - *argvp = xrealloc(*argvp, (argc + 1 + 1) * sizeof(**argvp)); - if ((argv = *argvp) != NULL) { - argv[argc++] = xstrdup(val); - argv[argc ] = NULL; - } - return 0; -} -#endif - -/*==============================================================*/ - /*...@exits@*/ static void mtree_error(const char *fmt, ...) @@ -3538,12 +3516,6 @@ } /*...@=unrecog@*/ break; -#if !defined(POPT_ARG_ARGV) - case 'p': -assert(arg != NULL); - (void) _poptSaveString(&_rpmfts->paths, opt->argInfo, arg); - break; -#endif /* XXX redundant with --logical. */ case 'L': @@ -3602,13 +3574,8 @@ N_("Loose permissions check"), NULL }, { "nocomment",'n', POPT_BIT_SET, &mtreeFlags, MTREE_FLAGS_NOCOMMENT, N_("Don't include sub-directory comments"), NULL }, -#if defined(POPT_ARG_ARGV) { "path",'p', POPT_ARG_ARGV, &__rpmfts.paths, 0, N_("Use <path> rather than current directory"), N_("<path>") }, -#else - { "path",'p', POPT_ARG_STRING, NULL, 'p', - N_("Use <path> rather than current directory"), N_("<path>") }, -#endif /* XXX --quiet collides w poptIO */ { "quiet",'q', POPT_BIT_SET, &mtreeFlags, MTREE_FLAGS_QUIET, N_("Quiet mode"), NULL }, @@ . patch -p0 <<'@@ .' Index: rpm/tools/rpmrepo.c ============================================================================ $ cvs diff -u -r2.1.2.8 -r2.1.2.9 rpmrepo.c --- rpm/tools/rpmrepo.c 5 Apr 2009 15:21:38 -0000 2.1.2.8 +++ rpm/tools/rpmrepo.c 11 Apr 2009 14:51:01 -0000 2.1.2.9 @@ -1825,110 +1825,6 @@ /*==============================================================*/ -#if 0 -#if !defined(POPT_READFILE_TRIMNEWLINES) /* XXX popt < 1.15 */ -#define POPT_READFILE_TRIMNEWLINES 1 -/** - * Read a file into a buffer. - * @param fn file name - * @retval *bp buffer (malloc'd) - * @retval *nbp no. of bytes in buffer (including final NUL) - * @param flags 1 to trim escaped newlines - * return 0 on success - */ -static int poptReadFile(const char * fn, char ** bp, size_t * nbp, int flags) -{ - int fdno; - char * b = NULL; - off_t nb = 0; - char * s, * t, * se; - int rc = POPT_ERROR_ERRNO; /* assume failure */ - - fdno = open(fn, O_RDONLY); - if (fdno < 0) - goto exit; - - if ((nb = lseek(fdno, 0, SEEK_END)) == (off_t)-1 - || lseek(fdno, 0, SEEK_SET) == (off_t)-1 - || (b = calloc(sizeof(*b), (size_t)nb + 1)) == NULL - || read(fdno, (char *)b, (size_t)nb) != (ssize_t)nb) - { - int oerrno = errno; - (void) close(fdno); - errno = oerrno; - goto exit; - } - if (close(fdno) == -1) - goto exit; - if (b == NULL) { - rc = POPT_ERROR_MALLOC; - goto exit; - } - rc = 0; - - /* Trim out escaped newlines. */ -/*...@-bitwisesigned@*/ - if (flags & POPT_READFILE_TRIMNEWLINES) -/*...@=bitwisesigned@*/ - { - for (t = b, s = b, se = b + nb; *s && s < se; s++) { - switch (*s) { - case '\\': - if (s[1] == '\n') { - s++; - continue; - } - /*...@fallthrough@*/ - default: - *t++ = *s; - /*...@switchbreak@*/ break; - } - } - *t++ = '\0'; - nb = (off_t)(t - b); - } - -exit: - if (rc == 0) { - *bp = b; - *nbp = (size_t) nb; - } else { -/*...@-usedef@*/ - if (b) - free(b); -/*...@=usedef@*/ - *bp = NULL; - *nbp = 0; - } -/*...@-compdef -nullstate @*/ /* XXX cannot annotate char ** correctly */ - return rc; -/*...@=compdef =nullstate @*/ -} -#endif /* !defined(POPT_READFILE_TRIMNEWLINES) */ -#endif - -#if !defined(POPT_ARG_ARGV) /* XXX popt < 1.14 */ -/** - */ -static int _poptSaveString(const char ***argvp, unsigned int argInfo, const char * val) - /*...@*/ -{ - ARGV_t argv; - int argc = 0; - if (argvp == NULL) - return -1; - if (*argvp) - while ((*argvp)[argc] != NULL) - argc++; - *argvp = xrealloc(*argvp, (argc + 1 + 1) * sizeof(**argvp)); - if ((argv = *argvp) != NULL) { - argv[argc++] = xstrdup(val); - argv[argc ] = NULL; - } - return 0; -} -#endif - /** */ static void repoArgCallback(poptContext con, @@ -1943,22 +1839,6 @@ /* XXX avoid accidental collisions with POPT_BIT_SET for flags */ if (opt->arg == NULL) switch (opt->val) { -#if !defined(POPT_ARG_ARGV) - int xx; - case 'x': /* --excludes */ -assert(arg != NULL); - xx = _poptSaveString(&repo->exclude_patterns, opt->argInfo, arg); - break; - case 'i': /* --includes */ -assert(arg != NULL); - xx = _poptSaveString(&repo->include_patterns, opt->argInfo, arg); - break; - case 'l': /* --pkglist */ -assert(arg != NULL); - xx = _poptSaveString(&repo->manifests, opt->argInfo, arg); - break; -#endif - case 'v': /* --verbose */ repo->verbose++; break; @@ -2005,20 +1885,10 @@ N_("output more debugging info."), NULL }, { "dryrun", '\0', POPT_ARG_VAL, &__rpmrepo.dryrun, 1, N_("sanity check arguments, don't create metadata"), NULL }, -#if defined(POPT_ARG_ARGV) { "excludes", 'x', POPT_ARG_ARGV, &__rpmrepo.exclude_patterns, 0, N_("glob PATTERN(s) to exclude"), N_("PATTERN") }, -#else - { "excludes", 'x', POPT_ARG_STRING, NULL, 'x', - N_("glob PATTERN(s) to exclude"), N_("PATTERN") }, -#endif -#if defined(POPT_ARG_ARGV) { "includes", 'i', POPT_ARG_ARGV, &__rpmrepo.include_patterns, 0, N_("glob PATTERN(s) to include"), N_("PATTERN") }, -#else - { "includes", 'i', POPT_ARG_STRING, NULL, 'i', - N_("glob PATTERN(s) to include"), N_("PATTERN") }, -#endif { "basedir", '\0', POPT_ARG_STRING|POPT_ARGFLAG_DOC_HIDDEN, &__rpmrepo.basedir, 0, N_("top level directory"), N_("DIR") }, { "baseurl", 'u', POPT_ARG_STRING|POPT_ARGFLAG_DOC_HIDDEN, &__rpmrepo.baseurl, 0, @@ -2037,13 +1907,8 @@ #endif { "split", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &__rpmrepo.split, 1, N_("generate split media"), NULL }, -#if defined(POPT_ARG_ARGV) { "pkglist", 'l', POPT_ARG_ARGV|POPT_ARGFLAG_DOC_HIDDEN, &__rpmrepo.manifests, 0, N_("use only the files listed in this file from the directory specified"), N_("FILE") }, -#else - { "pkglist", 'l', POPT_ARG_STRING|POPT_ARGFLAG_DOC_HIDDEN, NULL, 'l', - N_("use only the files listed in this file from the directory specified"), N_("FILE") }, -#endif { "outputdir", 'o', POPT_ARG_STRING, &__rpmrepo.outputdir, 0, N_("<dir> = optional directory to output to"), N_("DIR") }, { "skip-symlinks", 'S', POPT_ARG_VAL, &__rpmrepo.nofollow, 1, @@ . ______________________________________________________________________ RPM Package Manager http://rpm5.org CVS Sources Repository rpm-cvs@rpm5.org