RPM Community Forums

Mailing List Message of <rpm-cvs>

[CVS] RPM: rpm/ CHANGES rpm/rpmio/ tdir.c

From: Jeff Johnson <jbj@rpm5.org>
Date: Fri 08 Feb 2008 - 00:50:09 CET
Message-Id: <20080207235009.59C1D348479@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:   08-Feb-2008 00:50:09
  Branch: HEAD                             Handle: 2008020723500801

  Modified files:
    rpm                     CHANGES
    rpm/rpmio               tdir.c

  Log:
    - jbj: rpmio: rescuscitate tdir.c.

  Summary:
    Revision    Changes     Path
    1.2145      +1  -0      rpm/CHANGES
    2.8         +31 -13     rpm/rpmio/tdir.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.2144 -r1.2145 CHANGES
  --- rpm/CHANGES	7 Feb 2008 23:36:32 -0000	1.2144
  +++ rpm/CHANGES	7 Feb 2008 23:50:08 -0000	1.2145
  @@ -1,4 +1,5 @@
   5.0.0 -> 5.1a1:
  +    - jbj: rpmio: rescuscitate tdir.c.
       - jbj: rpmio: fix: cvtfmode access beyond end-of-string with "r" fmode.
       - jbj: rpmio: rescuscitate tget.c.
       - jbj: fix: (again) rpmtsCheck() needs to return 1 when problems exist.
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/tdir.c
  ============================================================================
  $ cvs diff -u -r2.7 -r2.8 tdir.c
  --- rpm/rpmio/tdir.c	2 Feb 2008 01:46:05 -0000	2.7
  +++ rpm/rpmio/tdir.c	7 Feb 2008 23:50:09 -0000	2.8
  @@ -3,19 +3,13 @@
   #include <rpmio_internal.h>
   #include <rpmmacro.h>
   #include <rpmcb.h>
  +#include <argv.h>
   #include <popt.h>
   
   #include "debug.h"
   
   static int _debug = 0;
   
  -#define	HTTPPATH	"https://wellfleet.jbj.org/rawhide/test/"
  -#define	FTPPATH		"ftp://wellfleet.jbj.org/pub/rawhide/packages/test/"
  -#define	DIRPATH		"/var/ftp/pub/rawhide/packages/test"
  -static char * httppath = HTTPPATH;
  -static char * ftppath = FTPPATH;
  -static char * dirpath = DIRPATH;
  -
   static void printDir(const char * path)
   {
       struct dirent * dp;
  @@ -44,6 +38,11 @@
   
   static struct poptOption optionsTable[] = {
    { "debug", 'd', POPT_ARG_VAL,	&_debug, -1,		NULL, NULL },
  +
  + { "avdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_av_debug, -1,
  +	N_("debug protocol data stream"), NULL},
  + { "davdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_dav_debug, -1,
  +	N_("debug protocol data stream"), NULL},
    { "ftpdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_ftp_debug, -1,
   	N_("debug protocol data stream"), NULL},
    { "rpmiodebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmio_debug, -1,
  @@ -59,9 +58,14 @@
   main(int argc, char *argv[])
   {
       poptContext optCon = poptGetContext(argv[0], argc, argv, optionsTable, 0);
  +    ARGV_t av = NULL;
  +    int ac;
  +    const char * dn;
  +
       int rc;
   
       while ((rc = poptGetNextOpt(optCon)) > 0) {
  +	const char * optArg = poptGetOptArg(optCon);
   	switch (rc) {
   	case 'v':
   	    rpmIncreaseVerbosity();
  @@ -69,21 +73,35 @@
   	default:
               /*@switchbreak@*/ break;
   	}
  +	optArg = _free(optArg);
       }
   
       if (_debug) {
   	rpmIncreaseVerbosity();
   	rpmIncreaseVerbosity();
  -    }
  -
   _av_debug = -1;
  -_ftp_debug = -1;
   _dav_debug = -1;
  -    printDir(dirpath);
  -    printDir(ftppath);
  -    printDir(httppath);
  +_ftp_debug = -1;
  +    }
  +
  +    av = poptGetArgs(optCon);
  +    ac = argvCount(av);
  +    if (ac < 1) {
  +	poptPrintUsage(optCon, stderr, 0);
  +	goto exit;
  +    }
  +
  +    while ((dn = *av++) != NULL) {
  +	dn = rpmGetPath(dn, "/", NULL);
  +	printDir(dn);
  +	dn = _free(dn);
  +    }
  +
  +exit:
   
   /*@i@*/ urlFreeCache();
   
  +    optCon = poptFreeContext(optCon);
  +
       return 0;
   }
  @@ .
Received on Fri Feb 8 00:50:09 2008
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.