rpmio/tdir.c

Go to the documentation of this file.
00001 #include "system.h"
00002 
00003 #include <rpmio_internal.h>
00004 #include <rpmmacro.h>
00005 #include <rpmmessages.h>
00006 #include <popt.h>
00007 
00008 #include "debug.h"
00009 
00010 static int _debug = 0;
00011 
00012 #define HTTPPATH        "https://wellfleet.jbj.org/rawhide/test/"
00013 #define FTPPATH         "ftp://wellfleet.jbj.org/pub/rawhide/packages/test/"
00014 #define DIRPATH         "/var/ftp/pub/rawhide/packages/test"
00015 static char * httppath = HTTPPATH;
00016 static char * ftppath = FTPPATH;
00017 static char * dirpath = DIRPATH;
00018 
00019 static void printDir(const char * path)
00020 {
00021     struct dirent * dp;
00022     DIR * dir;
00023     int xx;
00024     int i;
00025 
00026 fprintf(stderr, "===== %s\n", path);
00027     dir = Opendir(path);
00028     i = 0;
00029     while ((dp = Readdir(dir)) != NULL) {
00030 fprintf(stderr, "%5d (%x,%x) %x %x %s\n", i++,
00031 (unsigned) dp->d_ino,
00032 (unsigned) dp->d_off,
00033 (unsigned) dp->d_reclen,
00034 (unsigned) dp->d_type,
00035 dp->d_name);
00036     }
00037     xx = Closedir(dir);
00038 }
00039 
00040 static struct poptOption optionsTable[] = {
00041  { "debug", 'd', POPT_ARG_VAL,  &_debug, -1,            NULL, NULL },
00042  { "ftpdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_ftp_debug, -1,
00043         N_("debug protocol data stream"), NULL},
00044  { "rpmiodebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmio_debug, -1,
00045         N_("debug rpmio I/O"), NULL},
00046  { "urldebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_url_debug, -1,
00047         N_("debug URL cache handling"), NULL},
00048  { "verbose", 'v', 0, 0, 'v',                           NULL, NULL },
00049   POPT_AUTOHELP
00050   POPT_TABLEEND
00051 };
00052 
00053 int
00054 main(int argc, const char *argv[])
00055 {
00056     poptContext optCon = poptGetContext(argv[0], argc, argv, optionsTable, 0);
00057     int rc;
00058 
00059     while ((rc = poptGetNextOpt(optCon)) > 0) {
00060         switch (rc) {
00061         case 'v':
00062             rpmIncreaseVerbosity();
00063             /*@switchbreak@*/ break;
00064         default:
00065             /*@switchbreak@*/ break;
00066         }
00067     }
00068 
00069     if (_debug) {
00070         rpmIncreaseVerbosity();
00071         rpmIncreaseVerbosity();
00072     }
00073 
00074 _av_debug = -1;
00075 _ftp_debug = -1;
00076 _dav_debug = -1;
00077     printDir(dirpath);
00078     printDir(ftppath);
00079     printDir(httppath);
00080 
00081 /*@i@*/ urlFreeCache();
00082 
00083     return 0;
00084 }

Generated on Mon Mar 5 13:30:29 2007 for rpm by  doxygen 1.5.1