[CVS] RPM: rpm/build/ files.c rpm/rpmio/ rpmsq.c
RPM Package Manager, CVS Repository http://rpm5.org/cvs/ Server: rpm5.org Name: Anders F. Björklund Root: /v/rpm/cvs Email: [EMAIL PROTECTED] Module: rpm Date: 11-Mar-2008 13:27:14 Branch: HEAD Handle: 2008031112271400 Modified files: rpm/build files.c rpm/rpmio rpmsq.c Log: avoid compiler warnings, unused/unsigned Summary: RevisionChanges Path 1.317 +5 -3 rpm/build/files.c 1.37+4 -0 rpm/rpmio/rpmsq.c patch -p0 '@@ .' Index: rpm/build/files.c $ cvs diff -u -r1.316 -r1.317 files.c --- rpm/build/files.c 10 Mar 2008 04:46:10 - 1.316 +++ rpm/build/files.c 11 Mar 2008 12:27:14 - 1.317 @@ -1588,14 +1588,16 @@ he-append = 0; /[EMAIL PROTECTED]@*//* observer nocon not modified. */ - if (scon != nocon) + if (scon != nocon) { freecon(scon); + } /[EMAIL PROTECTED]@*/ } } /[EMAIL PROTECTED] -noeffectuncon @*/ -if (sxfn != NULL *sxfn != '\0') +if (sxfn != NULL *sxfn != '\0') { matchpathcon_fini(); +} /[EMAIL PROTECTED] =noeffectuncon @*/ sxfn = _free(sxfn); @@ -1660,7 +1662,7 @@ /* Make the cpio list */ if (fi-dil != NULL) /* XXX can't happen */ -for (i = 0, flp = fl-fileList; i fi-fc; i++, flp++) { +for (i = 0, flp = fl-fileList; (unsigned)i fi-fc; i++, flp++) { char * b; /* Skip (possible) duplicate file entries, use last entry info. */ @@ . patch -p0 '@@ .' Index: rpm/rpmio/rpmsq.c $ cvs diff -u -r1.36 -r1.37 rpmsq.c --- rpm/rpmio/rpmsq.c 10 Mar 2008 04:46:20 - 1.36 +++ rpm/rpmio/rpmsq.c 11 Mar 2008 12:27:14 - 1.37 @@ -647,6 +647,8 @@ ret = pthread_create(pth, NULL, start, arg); return (ret == 0 ? (void *)pth : NULL); #else +(void) start; +(void) arg; return NULL; #endif } @@ -659,6 +661,7 @@ return EINVAL; return pthread_join(pth, NULL); #else +(void) thread; return EINVAL; #endif } @@ -670,6 +673,7 @@ pthread_t t2 = pthread_self(); return pthread_equal(t1, t2); #else +(void) thread; return 0; #endif } @@ . __ RPM Package Managerhttp://rpm5.org CVS Sources Repositoryrpm-cvs@rpm5.org
[CVS] RPM: rpm/lib/ transaction.c
RPM Package Manager, CVS Repository http://rpm5.org/cvs/ Server: rpm5.org Name: Anders F. Björklund Root: /v/rpm/cvs Email: [EMAIL PROTECTED] Module: rpm Date: 11-Mar-2008 13:28:10 Branch: HEAD Handle: 2008031112280900 Modified files: rpm/lib transaction.c Log: int - size_t, for strlen et al Summary: RevisionChanges Path 1.370 +1 -1 rpm/lib/transaction.c patch -p0 '@@ .' Index: rpm/lib/transaction.c $ cvs diff -u -r1.369 -r1.370 transaction.c --- rpm/lib/transaction.c 10 Mar 2008 04:46:13 - 1.369 +++ rpm/lib/transaction.c 11 Mar 2008 12:28:09 - 1.370 @@ -734,7 +734,7 @@ * they do need to take package relocations into account). */ for (nsp = netsharedPaths; nsp *nsp; nsp++) { - int len; + size_t len; len = strlen(*nsp); if (dnlen = len) { @@ . __ RPM Package Managerhttp://rpm5.org CVS Sources Repositoryrpm-cvs@rpm5.org
[CVS] RPM: rpm/rpmio/ rpmdav.c
RPM Package Manager, CVS Repository http://rpm5.org/cvs/ Server: rpm5.org Name: Jeff Johnson Root: /v/rpm/cvs Email: [EMAIL PROTECTED] Module: rpm Date: 11-Mar-2008 15:17:35 Branch: HEAD Handle: 2008031114173500 Modified files: rpm/rpmio rpmdav.c Log: - jbj: s/UNUSED/NOTUSED/ to avoid accidental __attribute__((__unused__)) marking enabling. Summary: RevisionChanges Path 2.69+1 -1 rpm/rpmio/rpmdav.c patch -p0 '@@ .' Index: rpm/rpmio/rpmdav.c $ cvs diff -u -r2.68 -r2.69 rpmdav.c --- rpm/rpmio/rpmdav.c10 Mar 2008 04:46:19 - 2.68 +++ rpm/rpmio/rpmdav.c11 Mar 2008 14:17:35 - 2.69 @@ -725,7 +725,7 @@ return NULL; } -#ifdef UNUSED +#ifdef NOTUSED /[EMAIL PROTECTED]@*/ static void *fetch_destroy_list(/[EMAIL PROTECTED]@*/ struct fetch_resource_s *res) /[EMAIL PROTECTED] res @*/ @@ . __ RPM Package Managerhttp://rpm5.org CVS Sources Repositoryrpm-cvs@rpm5.org
[CVS] RPM: rpm/ CHANGES rpm/lib/ .cvsignore Makefile.am getdate.y libr...
RPM Package Manager, CVS Repository http://rpm5.org/cvs/ Server: rpm5.org Name: Jeff Johnson Root: /v/rpm/cvs Email: [EMAIL PROTECTED] Module: rpm Date: 11-Mar-2008 15:49:53 Branch: HEAD Handle: 2008031114495102 Added files: rpm/rpmio getdate.y Modified files: rpm CHANGES rpm/lib .cvsignore Makefile.am librpm.vers rpm/rpmio .cvsignore Makefile.am librpmio.vers rpmtar.c Removed files: rpm/lib getdate.y Log: - jbj: rpmtar: add stoopid file suffix detector for gzip/bzip2/lzma detect. - jbj: rpmtar: abandon rpmtar -cvf for now, noop tar_mode_c(). - jbj: rpmtar: move getdate.y lib - rpmio for rpmtar linkage. Summary: RevisionChanges Path 1.2236 +3 -0 rpm/CHANGES 1.13+0 -1 rpm/lib/.cvsignore 2.177 +3 -34 rpm/lib/Makefile.am 1.7 +0 -1069 rpm/lib/getdate.y 1.38+0 -1 rpm/lib/librpm.vers 1.22+1 -0 rpm/rpmio/.cvsignore 1.150 +36 -2 rpm/rpmio/Makefile.am 2.1 +1069 -0rpm/rpmio/getdate.y 2.61+1 -0 rpm/rpmio/librpmio.vers 1.13+31 -8 rpm/rpmio/rpmtar.c patch -p0 '@@ .' Index: rpm/CHANGES $ cvs diff -u -r1.2235 -r1.2236 CHANGES --- rpm/CHANGES 11 Mar 2008 04:00:56 - 1.2235 +++ rpm/CHANGES 11 Mar 2008 14:49:51 - 1.2236 @@ -1,4 +1,7 @@ 5.0.0 - 5.1a1: +- jbj: rpmtar: add stoopid file suffix detector for gzip/bzip2/lzma detect. +- jbj: rpmtar: abandon rpmtar -cvf for now, noop tar_mode_c(). +- jbj: rpmtar: move getdate.y lib - rpmio for rpmtar linkage. - jbj: mark write padding for possible refactoring to common code. - jbj: ar: verify archive magic. - jbj: ar: arSetup is only needed when creating archives. read EOF is wonky. @@ . patch -p0 '@@ .' Index: rpm/lib/.cvsignore $ cvs diff -u -r1.12 -r1.13 .cvsignore --- rpm/lib/.cvsignore10 Feb 2008 10:47:39 - 1.12 +++ rpm/lib/.cvsignore11 Mar 2008 14:49:52 - 1.13 @@ -3,7 +3,6 @@ Makefile Makefile.in genpgp.h -getdate.c rpmversion.h tpgp tsbt @@ . patch -p0 '@@ .' Index: rpm/lib/Makefile.am $ cvs diff -u -r2.176 -r2.177 Makefile.am --- rpm/lib/Makefile.am 5 Mar 2008 18:32:35 - 2.176 +++ rpm/lib/Makefile.am 11 Mar 2008 14:49:52 - 2.177 @@ -26,7 +26,7 @@ $(top_builddir)/misc/librpmmisc.la \ @LTLIBINTL@ -EXTRA_DIST = genpgp.sh getdate.y librpm.vers tpgp.c +EXTRA_DIST = genpgp.sh librpm.vers tpgp.c EXTRA_PROGRAMS = tgi tpgp tsbt @@ -41,7 +41,7 @@ usrlibdir = $(libdir) usrlib_LTLIBRARIES = librpm.la librpm_la_SOURCES = \ - depends.c formats.c fs.c fsm.c getdate.c \ + depends.c formats.c fs.c fsm.c \ manifest.c misc.c package.c \ poptALL.c poptI.c poptQV.c psm.c query.c \ rpmal.c rpmchecksig.c rpmdpkg.c rpmds.c rpmevr.c rpmfc.c \ @@ -82,38 +82,7 @@ done endif -getdate.c: getdate.y - @echo expect 10 shift/reduce conflicts - $(YACC) $(srcdir)/getdate.y - [EMAIL PROTECTED] test -f y.tab.c; then \ - { echo /[EMAIL PROTECTED] -statictrans -unqualifiedtrans -noparams @*/;\ -echo /[EMAIL PROTECTED] -usedef -varuse -nullderef -nullassign @*/;\ -echo /[EMAIL PROTECTED] -modunconnomods -compdef -noeffectuncon @*/;\ -echo /[EMAIL PROTECTED] -evalorderuncon -modobserveruncon -modnomods @*/;\ -echo /[EMAIL PROTECTED] -branchstate -sizeoftype -usereleased @*/;\ -echo /[EMAIL PROTECTED]@*/;\ -sed -e 's,y.tab.c,getdate.c,' y.tab.c \ - -e 's,^YYSTYPE ,static ,' \ - -e 's,^short ,static ,' \ - -e 's,^const short ,static ,' \ - -e 's,^int yydebug,/[EMAIL PROTECTED]@*/ static ,' \ - -e 's,^int ,static ,' ;\ -echo /[EMAIL PROTECTED] =branchstate =sizeoftype =usereleased @*/;\ -echo /[EMAIL PROTECTED] =evalorderuncon =modobserveruncon =modnomods @*/;\ -echo /[EMAIL PROTECTED] =modunconnomods =compdef =noeffectuncon @*/;\ -echo /[EMAIL PROTECTED] =usedef =varuse =nullderef =nullassign @*/;\ -echo /[EMAIL PROTECTED] =statictrans =unqualifiedtrans =noparams @*/;\ - } getdate.c ;\ -rm
[CVS] RPM: rpm/ CHANGES rpm/rpmio/ rpmtar.c
RPM Package Manager, CVS Repository http://rpm5.org/cvs/ Server: rpm5.org Name: Jeff Johnson Root: /v/rpm/cvs Email: [EMAIL PROTECTED] Module: rpm Date: 11-Mar-2008 17:58:12 Branch: HEAD Handle: 2008031116581200 Modified files: rpm CHANGES rpm/rpmio rpmtar.c Log: - jbj: rpmtar: abuse --format {ar,cpio,tar,ustar} as a selector for now. Summary: RevisionChanges Path 1.2238 +1 -0 rpm/CHANGES 1.15+16 -1 rpm/rpmio/rpmtar.c patch -p0 '@@ .' Index: rpm/CHANGES $ cvs diff -u -r1.2237 -r1.2238 CHANGES --- rpm/CHANGES 11 Mar 2008 15:32:16 - 1.2237 +++ rpm/CHANGES 11 Mar 2008 16:58:12 - 1.2238 @@ -1,4 +1,5 @@ 5.0.0 - 5.1a1: +- jbj: rpmtar: abuse --format {ar,cpio,tar,ustar} as a selector for now. - jbj: rpmtar: lash in -z/-j/-y/-Z compression options using popt. - jbj: rpmtar: add stoopid file suffix detector for gzip/bzip2/lzma detect. - jbj: rpmtar: abandon rpmtar -cvf for now, noop tar_mode_c(). @@ . patch -p0 '@@ .' Index: rpm/rpmio/rpmtar.c $ cvs diff -u -r1.14 -r1.15 rpmtar.c --- rpm/rpmio/rpmtar.c11 Mar 2008 15:32:16 - 1.14 +++ rpm/rpmio/rpmtar.c11 Mar 2008 16:58:12 - 1.15 @@ -369,6 +369,19 @@ rpmpsm psm = rpmpsmNew(ts, NULL, fi); const char * fmode; char zmode = (char) bsdtar-create_compression; + const char * aformat = bsdtar-create_format; + + /* Identify the requested formt: { ar, tar/ustar, cpio } for now. */ + if (aformat != NULL) { + if (!(!strcmp(aformat, ar) || !strcmp(aformat, cpio) + || !strcmp(aformat, tar)|| !strcmp(aformat, ustar))) + { + bsdtar_errc(bsdtar, 1, 0, + _(Option %s %s is not permitted in mode -%c), + --format, aformat, bsdtar-mode); + } + } else + aformat = tar; /* Identify how to Fopen the file from the suffix. */ if (zmode == 'z' || zmode == 'Z' || chkSuffix(fn, .gz)) @@ -387,7 +400,7 @@ int xx; fi-mapflags |= mapflags; - rc = iosmSetup(fi-fsm, fsmmode, tar, ts, fi, + rc = iosmSetup(fi-fsm, fsmmode, aformat, ts, fi, psm-cfd, NULL, psm-failedFile); (void) rpmswAdd(rpmtsOp(ts, RPMTS_OP_UNCOMPRESS), fdstat_op(psm-cfd, FDSTAT_READ)); @@ -1139,8 +1152,10 @@ buff[1] = bsdtar-create_compression; only_mode(bsdtar, buff, cxt); } +#ifdef NOTYET if (bsdtar-create_format != NULL) only_mode(bsdtar, --format, c); +#endif if (bsdtar-symlink_mode != '\0') { strcpy(buff, -?); buff[1] = bsdtar-symlink_mode; @@ . __ RPM Package Managerhttp://rpm5.org CVS Sources Repositoryrpm-cvs@rpm5.org
[CVS] RPM: rpm/ devtool.conf
RPM Package Manager, CVS Repository http://rpm5.org/cvs/ Server: rpm5.org Name: Ralf S. Engelschall Root: /v/rpm/cvs Email: [EMAIL PROTECTED] Module: rpm Date: 11-Mar-2008 18:50:29 Branch: HEAD Handle: 2008031117502900 Modified files: rpm devtool.conf Log: step up to Libtool 1.5.26 (next will be 2.2) Summary: RevisionChanges Path 2.190 +1 -1 rpm/devtool.conf patch -p0 '@@ .' Index: rpm/devtool.conf $ cvs diff -u -r2.189 -r2.190 devtool.conf --- rpm/devtool.conf 6 Mar 2008 22:35:27 - 2.189 +++ rpm/devtool.conf 11 Mar 2008 17:50:29 - 2.190 @@ -211,7 +211,7 @@ v_m4=1.4.9 v_autoconf=2.61 v_automake=1.10 -v_libtool=1.5.24 +v_libtool=1.5.26 v_gettext=0.17 # third-party library distribution versions @@ . __ RPM Package Managerhttp://rpm5.org CVS Sources Repositoryrpm-cvs@rpm5.org
[CVS] RPM: rpm/ INSTALL
RPM Package Manager, CVS Repository http://rpm5.org/cvs/ Server: rpm5.org Name: Ralf S. Engelschall Root: /v/rpm/cvs Email: [EMAIL PROTECTED] Module: rpm Date: 11-Mar-2008 18:51:13 Branch: HEAD Handle: 2008031117511300 Modified files: rpm INSTALL Log: step up to Libtool 1.5.26 (next will be 2.2) Summary: RevisionChanges Path 2.81+1 -1 rpm/INSTALL patch -p0 '@@ .' Index: rpm/INSTALL $ cvs diff -u -r2.80 -r2.81 INSTALL --- rpm/INSTALL 10 Feb 2008 10:57:26 - 2.80 +++ rpm/INSTALL 11 Mar 2008 17:51:13 - 2.81 @@ -14,7 +14,7 @@ GNU m4 mandatory 1.4.0 1.4.9 http://www.gnu.org/software/m4/ GNU autoconfmandatory 2.59b 2.61 http://www.gnu.org/software/autoconf/ GNU automakemandatory 1.8 1.10 http://www.gnu.org/software/automake/ -GNU libtool mandatory 1.5 1.5.24 http://www.gnu.org/software/libtool/ +GNU libtool mandatory 1.5 1.5.26 http://www.gnu.org/software/libtool/ GNU gettext mandatory 0.160.17 http://www.gnu.org/software/gettext/ --- - --- --- - @@ . __ RPM Package Managerhttp://rpm5.org CVS Sources Repositoryrpm-cvs@rpm5.org
[CVS] RPM: rpm/ CHANGES rpm/rpmio/ .cvsignore .splintrc_rpmtar .splint...
RPM Package Manager, CVS Repository http://rpm5.org/cvs/ Server: rpm5.org Name: Jeff Johnson Root: /v/rpm/cvs Email: [EMAIL PROTECTED] Module: rpm Date: 11-Mar-2008 18:59:02 Branch: HEAD Handle: 2008031117590100 Added files: rpm/rpmio .splintrc_rpmtar Modified files: rpm CHANGES rpm/rpmio .cvsignore Makefile.am rpmtar.c Removed files: rpm/rpmio .splintrc_tdeb tdeb.c ttar.c Log: - jbj: rpmtar: splint annotations. - jbj: rpmtar: nuke ttar.c/tdeb.c prototypes for rpmtar. Summary: RevisionChanges Path 1.2239 +2 -0 rpm/CHANGES 1.23+1 -2 rpm/rpmio/.cvsignore 1.1 +72 -0 rpm/rpmio/.splintrc_rpmtar 1.2 +0 -66 rpm/rpmio/.splintrc_tdeb 1.151 +6 -12 rpm/rpmio/Makefile.am 1.16+91 -49 rpm/rpmio/rpmtar.c 1.8 +0 -191rpm/rpmio/tdeb.c 1.3 +0 -155rpm/rpmio/ttar.c patch -p0 '@@ .' Index: rpm/CHANGES $ cvs diff -u -r1.2238 -r1.2239 CHANGES --- rpm/CHANGES 11 Mar 2008 16:58:12 - 1.2238 +++ rpm/CHANGES 11 Mar 2008 17:59:01 - 1.2239 @@ -1,4 +1,6 @@ 5.0.0 - 5.1a1: +- jbj: rpmtar: splint annotations. +- jbj: rpmtar: nuke ttar.c/tdeb.c prototypes for rpmtar. - jbj: rpmtar: abuse --format {ar,cpio,tar,ustar} as a selector for now. - jbj: rpmtar: lash in -z/-j/-y/-Z compression options using popt. - jbj: rpmtar: add stoopid file suffix detector for gzip/bzip2/lzma detect. @@ . patch -p0 '@@ .' Index: rpm/rpmio/.cvsignore $ cvs diff -u -r1.22 -r1.23 .cvsignore --- rpm/rpmio/.cvsignore 11 Mar 2008 14:49:53 - 1.22 +++ rpm/rpmio/.cvsignore 11 Mar 2008 17:59:01 - 1.23 @@ -14,10 +14,10 @@ lookup3 rpmdigest rpmgrep +rpmtar teststderr testtry tdigest -tdeb tdir tfts tget @@ -33,4 +33,3 @@ tring trpmio tsw -ttar @@ . patch -p0 '@@ .' Index: rpm/rpmio/.splintrc_rpmtar $ cvs diff -u -r0 -r1.1 .splintrc_rpmtar --- /dev/null 2008-03-11 18:55:00 +0100 +++ .splintrc_rpmtar 2008-03-11 18:59:01 +0100 @@ -0,0 +1,72 @@ +-I. -I.. -I../file/src -I../xar/include -I/usr/include/neon -I../lua -I../lua/local -I/usr/include/beecrypt -I/usr/include/nss3 -I/usr/include/nspr4 -I../zlib -DHAVE_CONFIG_H -D_GNU_SOURCE -D__STDC__=1 -DHAVE_NEON_NE_GET_RESPONSE_HEADER + +#+partial ++forcehints + +-warnposix + ++unixlib + +-unrecogcomments # XXX ignore doxygen markings + ++strict # lclint level + +# --- in progress +-branchstate +-bufferoverflowhigh + +-boolops # 30 +-compdestroy # 5 +-exportheader +-globuse +-internalglobs +-mustmod # BUG +-predboolptr # 56 +-redef # 8 +-retalias +-whileempty + +-onlytrans # 2 +-temptrans + +-exportlocal + +-compdef # 3 +-globstate # 3 + +# --- +partial artifacts +-declundef # 515 + +-enummemuse # 574 +-fcnuse # 341 +-typeuse # 18 +-varuse # 15 + +# --- not-yet at strict level +-bitwisesigned # 65 +-elseifcomplete # 10 +-exportconst # 786 +-exportfcn # 462 +-exporttype # 120 +-exportvar # 74 +-fielduse# 247 +-forblock# tedious +-ifblock # tedious +-namechecks # 599 tedious ANSI compliance checks +-ptrarith# 37 + +-mustdefine # 3 +-sys-dir-errors + +-strictops # 21 +-whileblock # tedious + +# --- not-yet at checks level ++enumint # 11 +-mustfree# 18 +-usedef # 7 + +# --- not-yet at standard level ++boolint # 145 ++ignorequals # 27 ++matchanyintegral# 49 @@ . rm -f rpm/rpmio/.splintrc_tdeb '@@ .' Index: rpm/rpmio/.splintrc_tdeb [NO CHANGE SUMMARY BECAUSE FILE AS A WHOLE IS JUST REMOVED] @@ . patch -p0 '@@ .' Index: rpm/rpmio/Makefile.am $ cvs diff -u -r1.150 -r1.151 Makefile.am --- rpm/rpmio/Makefile.am 11 Mar 2008 14:49:53 -
[CVS] RPM: rpm/ devtool.conf
RPM Package Manager, CVS Repository http://rpm5.org/cvs/ Server: rpm5.org Name: Ralf S. Engelschall Root: /v/rpm/cvs Email: [EMAIL PROTECTED] Module: rpm Date: 11-Mar-2008 20:39:17 Branch: HEAD Handle: 2008031119391700 Modified files: rpm devtool.conf Log: use latest config.* scripts Summary: RevisionChanges Path 2.193 +1 -1 rpm/devtool.conf patch -p0 '@@ .' Index: rpm/devtool.conf $ cvs diff -u -r2.192 -r2.193 devtool.conf --- rpm/devtool.conf 11 Mar 2008 19:36:43 - 2.192 +++ rpm/devtool.conf 11 Mar 2008 19:39:17 - 2.193 @@ -230,7 +230,7 @@ v_xar=1.5.2 v_pcre=7.6 v_uuid=1.6.0 -v_config=20080105 +v_config=20080311 # third-party distribution files dist= @@ . __ RPM Package Managerhttp://rpm5.org CVS Sources Repositoryrpm-cvs@rpm5.org
[CVS] RPM: rpm/rpmio/ .splintrc_rpmtar rpmtar.c
RPM Package Manager, CVS Repository http://rpm5.org/cvs/ Server: rpm5.org Name: Jeff Johnson Root: /v/rpm/cvs Email: [EMAIL PROTECTED] Module: rpm Date: 11-Mar-2008 23:13:26 Branch: HEAD Handle: 2008031122132600 Modified files: rpm/rpmio .splintrc_rpmtar rpmtar.c Log: - jbj: rpmtar: stub in the pattern handling options. Summary: RevisionChanges Path 1.2 +1 -0 rpm/rpmio/.splintrc_rpmtar 1.18+137 -14rpm/rpmio/rpmtar.c patch -p0 '@@ .' Index: rpm/rpmio/.splintrc_rpmtar $ cvs diff -u -r1.1 -r1.2 .splintrc_rpmtar --- rpm/rpmio/.splintrc_rpmtar11 Mar 2008 17:59:01 - 1.1 +++ rpm/rpmio/.splintrc_rpmtar11 Mar 2008 22:13:26 - 1.2 @@ -21,6 +21,7 @@ -globuse -internalglobs -mustmod # BUG +-nullptrarith -predboolptr # 56 -redef # 8 -retalias @@ . patch -p0 '@@ .' Index: rpm/rpmio/rpmtar.c $ cvs diff -u -r1.17 -r1.18 rpmtar.c --- rpm/rpmio/rpmtar.c11 Mar 2008 18:44:49 - 1.17 +++ rpm/rpmio/rpmtar.c11 Mar 2008 22:13:26 - 1.18 @@ -229,6 +229,88 @@ exit(eval); } +/[EMAIL PROTECTED]@*/ +/* + * Read lines from file and do something with each one. If option_null + * is set, lines are terminated with zero bytes; otherwise, they're + * terminated with newlines. + * + * This uses a self-sizing buffer to handle arbitrarily-long lines. + * If the process function returns non-zero for any line, this + * function will return non-zero after attempting to process all + * remaining lines. + */ +int +process_lines(struct bsdtar *bsdtar, const char *pathname, +int (*process)(struct bsdtar *, const char *)) +{ +FILE *f; +char *buff, *buff_end, *line_start, *line_end, *p; +size_t buff_length, bytes_read, bytes_wanted; +int separator; +int ret; + +separator = (int) (bsdtar-option_null != (char)0 ? '\0' : '\n'); +ret = 0; + +if (strcmp(pathname, -) == 0) + f = stdin; +else + f = fopen(pathname, r); +if (f == NULL) + bsdtar_errc(bsdtar, 1, errno, Couldn't open %s, pathname); +assert(f != NULL); +buff_length = BUFSIZ; +buff = xmalloc(buff_length); +assert(buff != NULL); +line_start = line_end = buff_end = buff; +for (;;) { + /* Get some more data into the buffer. */ + bytes_wanted = buff + buff_length - buff_end; + bytes_read = fread(buff_end, 1, bytes_wanted, f); + buff_end += bytes_read; + /* Process all complete lines in the buffer. */ + while (line_end buff_end) { + if (*line_end == (char)separator) { + *line_end = '\0'; + if ((*process)(bsdtar, line_start) != 0) + ret = -1; + line_start = line_end + 1; + line_end = line_start; + } else + line_end++; + } + if (feof(f)) + break; + if (ferror(f)) + bsdtar_errc(bsdtar, 1, errno, Can't read %s, pathname); + if (line_start buff) { + /* Move a leftover fractional line to the beginning. */ + memmove(buff, line_start, buff_end - line_start); + buff_end -= line_start - buff; + line_end -= line_start - buff; + line_start = buff; + } else { + /* Line is too big; enlarge the buffer. */ + p = xrealloc(buff, buff_length *= 2); + buff_end = p + (buff_end - buff); + line_end = p + (line_end - buff); + line_start = buff = p; + } +} +/* At end-of-file, handle the final line. */ +if (line_end line_start) { + *line_end = '\0'; + if ((*process)(bsdtar, line_start) != 0) + ret = -1; +} +free(buff); +if (f != stdin) + (void) fclose(f); +return (ret); +} +/[EMAIL PROTECTED]@*/ + /*- * The logic here for -C DIR attempts to avoid * chdir() as long as possible. For example: @@ -269,6 +351,55 @@ } } +/*==*/ +struct match { + struct match *next; + int matches; + char pattern[1]; +}; + +struct matching { + struct match *exclusions; + int exclusions_count; + struct match *inclusions; + int inclusions_count; + int