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: 10-Feb-2008 03:08:28 Branch: HEAD Handle: 2008021002082700 Modified files: rpm CHANGES rpm/rpmio Makefile.am mire.c tmire.c Log: - rpmio: use tmire.c, not -DSTANDALONE, so librpmio doesnt rebuild. Summary: Revision Changes Path 1.2171 +1 -0 rpm/CHANGES 1.128 +2 -4 rpm/rpmio/Makefile.am 1.12 +0 -76 rpm/rpmio/mire.c 1.4 +32 -14 rpm/rpmio/tmire.c ____________________________________________________________________________ patch -p0 <<'@@ .' Index: rpm/CHANGES ============================================================================ $ cvs diff -u -r1.2170 -r1.2171 CHANGES --- rpm/CHANGES 10 Feb 2008 01:30:57 -0000 1.2170 +++ rpm/CHANGES 10 Feb 2008 02:08:27 -0000 1.2171 @@ -1,4 +1,5 @@ 5.0.0 -> 5.1a1: + - jbj: rpmio: use tmire.c, not -DSTANDALONE, so librpmio doesnt rebuild. - jbj: rpmio: add tmire to noinst_PROGRAMS. - jbj: rpmio: add --regex/--pcre/--fnmatch/--strcmp tmire match options - jbj: mire: add RPMMIRE_PCRE for the pcre(3) inclined. @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/Makefile.am ============================================================================ $ cvs diff -u -r1.127 -r1.128 Makefile.am --- rpm/rpmio/Makefile.am 10 Feb 2008 01:30:57 -0000 1.127 +++ rpm/rpmio/Makefile.am 10 Feb 2008 02:08:27 -0000 1.128 @@ -140,10 +140,8 @@ tmagic_SOURCES = tmagic.c tmagic_LDADD = $(RPMIO_LDADD) -tmire_SOURCES = -tmire_LDADD = tmire.o $(RPMIO_LDADD) -tmire.o: mire.c - $(COMPILE) -DSTANDALONE -o $@ -c $< +tmire_SOURCES = tmire.c +tmire_LDADD = $(RPMIO_LDADD) tput_SOURCES = tput.c tput_LDADD = $(RPMIO_LDADD) @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/mire.c ============================================================================ $ cvs diff -u -r1.11 -r1.12 mire.c --- rpm/rpmio/mire.c 10 Feb 2008 01:30:57 -0000 1.11 +++ rpm/rpmio/mire.c 10 Feb 2008 02:08:27 -0000 1.12 @@ -211,79 +211,3 @@ /[EMAIL PROTECTED]@*/ return rc; } - -/* =============================================================== */ - -#if defined(STANDALONE) - -#include <poptIO.h> - -static rpmMireMode mireMode = RPMMIRE_REGEX; - -static struct poptOption optionsTable[] = { - - { "strcmp", '\0', POPT_ARG_VAL, &mireMode, RPMMIRE_STRCMP, - N_("use strcmp matching"), NULL}, - { "regex", '\0', POPT_ARG_VAL, &mireMode, RPMMIRE_REGEX, - N_("use regex matching"), NULL}, - { "fnmatch", '\0', POPT_ARG_VAL, &mireMode, RPMMIRE_GLOB, - N_("use fnmatch matching"), NULL}, - { "pcre", '\0', POPT_ARG_VAL, &mireMode, RPMMIRE_PCRE, - N_("use pcre matching"), NULL}, - - { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmioAllPoptTable, 0, - N_("Common options for all rpmio executables:"), - NULL }, - - POPT_AUTOHELP - POPT_TABLEEND -}; - -int -main(int argc, char *argv[]) -{ - poptContext optCon = rpmioInit(argc, argv, optionsTable); - miRE mire = NULL; - ARGV_t av = NULL; - int ac = 0; - int rc = 1; - int xx; - int i; - - if (__debug) { -_mire_debug = 1; - } - - av = poptGetArgs(optCon); - if ((ac = argvCount(av)) != 1) - goto exit; - - mire = mireNew(mireMode, 0); - if ((rc = mireRegcomp(mire, av[0])) != 0) - goto exit; - - av = NULL; - if ((rc = argvFgets(&av, NULL)) != 0) - goto exit; - - rc = 1; /* assume nomatch failure. */ - ac = argvCount(av); - if (av && *av) - for (i = 0; i < ac; i++) { - xx = mireRegexec(mire, av[i]); - if (xx == 0) { - fprintf(stdout, "%s\n", av[i]); - rc = 0; - } - } - av = argvFree(av); - -exit: - mire = mireFree(mire); - - optCon = rpmioFini(optCon); - - return rc; -} - -#endif /* STANDALONE */ @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/tmire.c ============================================================================ $ cvs diff -u -r1.3 -r1.4 tmire.c --- rpm/rpmio/tmire.c 9 Feb 2008 23:12:33 -0000 1.3 +++ rpm/rpmio/tmire.c 10 Feb 2008 02:08:27 -0000 1.4 @@ -5,8 +5,23 @@ #include "debug.h" +static rpmMireMode mireMode = RPMMIRE_REGEX; +static int invert = 0; + static struct poptOption optionsTable[] = { + { "strcmp", '\0', POPT_ARG_VAL, &mireMode, RPMMIRE_STRCMP, + N_("use strcmp matching"), NULL}, + { "regex", '\0', POPT_ARG_VAL, &mireMode, RPMMIRE_REGEX, + N_("use regex matching"), NULL}, + { "fnmatch", '\0', POPT_ARG_VAL, &mireMode, RPMMIRE_GLOB, + N_("use fnmatch matching"), NULL}, + { "pcre", '\0', POPT_ARG_VAL, &mireMode, RPMMIRE_PCRE, + N_("use pcre matching"), NULL}, + + { "invert-match", 'v', POPT_ARG_VAL|POPT_ARGFLAG_XOR, &invert, 1, + N_("select non-mtching lines"), NULL}, + { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmioAllPoptTable, 0, N_("Common options for all rpmio executables:"), NULL }, @@ -22,7 +37,7 @@ miRE mire = NULL; ARGV_t av = NULL; int ac = 0; - int rc; + int rc = 1; int xx; int i; @@ -31,31 +46,34 @@ } av = poptGetArgs(optCon); - ac = argvCount(av); - if (ac != 1) { - poptPrintUsage(optCon, stderr, 0); + if ((ac = argvCount(av)) != 1) goto exit; - } - mire = mireNew(RPMMIRE_REGEX, 0); - if ((xx = mireRegcomp(mire, argv[1])) != 0) + mire = mireNew(mireMode, 0); + if ((rc = mireRegcomp(mire, av[0])) != 0) goto exit; + mire->notmatch ^= invert; - xx = argvFgets(&av, NULL); - ac = argvCount(av); + av = NULL; + if ((rc = argvFgets(&av, NULL)) != 0) + goto exit; + rc = 1; /* assume nomatch failure. */ + ac = argvCount(av); + if (av && *av) for (i = 0; i < ac; i++) { xx = mireRegexec(mire, av[i]); - if (xx == 0) + if (xx == 0) { fprintf(stdout, "%s\n", av[i]); + rc = 0; + } } + av = argvFree(av); exit: mire = mireFree(mire); - av = argvFree(av); - - optCon = poptFreeContext(optCon); + optCon = rpmioFini(optCon); - return 0; + return rc; } @@ . ______________________________________________________________________ RPM Package Manager http://rpm5.org CVS Sources Repository rpm-cvs@rpm5.org