RPM Community Forums

Mailing List Message of <rpm-cvs>

[CVS] RPM: rpm/rpmio/ tmire.c

From: Jeff Johnson <jbj@rpm5.org>
Date: Mon 04 Feb 2008 - 22:24:23 CET
Message-Id: <20080204212423.6CF37348458@rpm5.org>
  RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  ____________________________________________________________________________

  Server: rpm5.org                         Name:   Jeff Johnson
  Root:   /v/rpm/cvs                       Email:  jbj@rpm5.org
  Module: rpm                              Date:   04-Feb-2008 22:24:23
  Branch: HEAD                             Handle: 2008020421242300

  Added files:
    rpm/rpmio               tmire.c

  Log:
    - add on HEAd too.

  Summary:
    Revision    Changes     Path
    1.2         +79 -0      rpm/rpmio/tmire.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/rpmio/tmire.c
  ============================================================================
  $ cvs diff -u -r0 -r1.2 tmire.c
  --- /dev/null	2008-02-04 22:22:00 +0100
  +++ tmire.c	2008-02-04 22:24:23 +0100
  @@ -0,0 +1,79 @@
  +#include "system.h"
  +
  +#define _MIRE_INTERNAL
  +#include <rpmio.h>
  +#include <rpmcb.h>
  +#include <argv.h>
  +#include <mire.h>
  +#include <popt.h>
  +
  +#include "debug.h"
  +
  +static int _debug = 0;
  +
  +static struct poptOption optionsTable[] = {
  + { "debug", 'd', POPT_ARG_VAL,	&_debug, -1,		NULL, NULL },
  +  POPT_AUTOHELP
  +  POPT_TABLEEND
  +};
  +
  +int
  +main(int argc, char *argv[])
  +{
  +    poptContext optCon = poptGetContext(argv[0], argc, argv, optionsTable, 0);
  +    miRE mire = NULL;
  +    ARGV_t av = NULL;
  +    int ac = 0;
  +    int rc;
  +    int xx;
  +    int i;
  +
  +    while ((rc = poptGetNextOpt(optCon)) > 0) {
  +        const char * optArg = poptGetOptArg(optCon);
  +        optArg = _free(optArg);
  +	switch (rc) {
  +	case 'v':
  +	    rpmIncreaseVerbosity();
  +	    /*@switchbreak@*/ break;
  +	default:
  +	    poptPrintUsage(optCon, stderr, 0);
  +	    goto exit;
  +            /*@switchbreak@*/ break;
  +	}
  +    }
  +
  +    if (_debug) {
  +	rpmIncreaseVerbosity();
  +	rpmIncreaseVerbosity();
  +_mire_debug = 1;
  +    }
  +
  +    av = poptGetArgs(optCon);
  +    ac = argvCount(av);
  +    if (ac != 1) {
  +	poptPrintUsage(optCon, stderr, 0);
  +	goto exit;
  +    }
  +
  +    mire = mireNew(RPMMIRE_REGEX, 0);
  +    if ((xx = mireRegcomp(mire, argv[1])) != 0)
  +	goto exit;
  +    
  +    xx = argvFgets(&av, NULL);
  +    ac = argvCount(av);
  +
  +    for (i = 0; i < ac; i++) {
  +	xx = mireRegexec(mire, av[i]);
  +	if (xx == 0)
  +	    fprintf(stdout, "%s\n", av[i]);
  +    }
  +
  +exit:
  +    mire = mireFree(mire);
  +
  +    av = argvFree(av);
  +
  +    optCon = poptFreeContext(optCon);
  +
  +    return 0;
  +}
  @@ .
Received on Mon Feb 4 22:24:23 2008
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.