- make librpmio standalone.

CVS patchset: 3824
CVS date: 2000/06/09 21:24:37
This commit is contained in:
jbj 2000-06-09 21:24:37 +00:00
parent 685d3e79b0
commit 4afe94756b
15 changed files with 1395 additions and 1340 deletions

View File

@ -55,6 +55,7 @@
- fix: segfault with legacy packages missing RPMTAG_FILEINODES.
- require db3 in default configuration.
- create rpmio directory for librpmio.
- make librpmio standalone.
3.0.3 -> 3.0.4
- use compressed filenames on install side.

View File

@ -27,7 +27,6 @@ librpm_la_SOURCES = \
rpmlead.c rpmrc.c signature.c stringbuf.c stubs.c \
tagName.c tagtable.c transaction.c uninstall.c verify.c
librpm_la_LDFLAGS = -L$(top_builddir)/rpmio/.libs -lrpmio
# -L$(top_builddir)/popt -lpopt
librpm_la_LIBADD = $(subst .c,.lo,$(DBLIBOBJS))
# XXX Drill out -L ldflags remnants until libtool-1.4 appears

View File

@ -6,6 +6,8 @@
/* and it shouldn't need these :-( */
#include "rpmio.h"
#include "rpmmessages.h"
#include "rpmerr.h"
#include "header.h"
#include "popt.h"
@ -320,26 +322,10 @@ void rpmSetMachine(const char * arch, const char * os);
void rpmGetMachine( /*@out@*/ const char **arch, /*@out@*/ const char **os);
void rpmFreeRpmrc(void);
/* ==================================================================== */
/** **/
typedef /*@abstract@*/ struct rpmdb_s * rpmdb;
typedef enum rpmCallbackType_e {
RPMCALLBACK_INST_PROGRESS, RPMCALLBACK_INST_START,
RPMCALLBACK_INST_OPEN_FILE, RPMCALLBACK_INST_CLOSE_FILE,
RPMCALLBACK_TRANS_PROGRESS, RPMCALLBACK_TRANS_START, RPMCALLBACK_TRANS_STOP,
RPMCALLBACK_UNINST_PROGRESS, RPMCALLBACK_UNINST_START, RPMCALLBACK_UNINST_STOP
} rpmCallbackType;
typedef void * (*rpmCallbackFunction)(const Header h,
const rpmCallbackType what,
const unsigned long amount,
const unsigned long total,
const void * pkgKey, void * data);
void urlSetCallback(rpmCallbackFunction notify, void *notifyData, int notifyCount);
/* ==================================================================== */
/**
* @param dbp address of rpm database
*/
@ -654,24 +640,6 @@ int rpmRunTransactions(rpmTransactionSet ts, rpmCallbackFunction notify,
#define RPMPROB_FILTER_OLDPACKAGE (1 << 6)
#define RPMPROB_FILTER_DISKSPACE (1 << 7)
/** messages.c **/
#define RPMMESS_DEBUG 1
#define RPMMESS_VERBOSE 2
#define RPMMESS_NORMAL 3
#define RPMMESS_WARNING 4
#define RPMMESS_ERROR 5
#define RPMMESS_FATALERROR 6
#define RPMMESS_QUIET (RPMMESS_NORMAL + 1)
void rpmIncreaseVerbosity(void);
void rpmSetVerbosity(int level);
int rpmGetVerbosity(void);
int rpmIsVerbose(void);
int rpmIsDebug(void);
void rpmMessage(int level, const char * format, ...);
/** rpmlead.c **/
#define RPMLEAD_BINARY 0
@ -708,80 +676,6 @@ struct oldrpmlead { /* for version 1 packages */
unsigned int archiveOffset;
} ;
/** rpmerr.c **/
typedef void (*rpmErrorCallBackType)(void);
#if defined(__GNUC__)
void rpmError(int code, char * format, ...) __attribute__ ((__format__ (__printf__, 2, 3)));
#else
void rpmError(int code, char * format, ...);
#endif
int rpmErrorCode(void);
char *rpmErrorCodeString(void);
char *rpmErrorString(void);
rpmErrorCallBackType rpmErrorSetCallback(rpmErrorCallBackType);
#define RPMERR_GDBMOPEN -2 /* gdbm open failed */
#define RPMERR_GDBMREAD -3 /* gdbm read failed */
#define RPMERR_GDBMWRITE -4 /* gdbm write failed */
#define RPMERR_INTERNAL -5 /* internal RPM error */
#define RPMERR_DBCORRUPT -6 /* rpm database is corrupt */
#define RPMERR_OLDDBCORRUPT -7 /* old style rpm database is corrupt */
#define RPMERR_OLDDBMISSING -8 /* old style rpm database is missing */
#define RPMERR_NOCREATEDB -9 /* cannot create new database */
#define RPMERR_DBOPEN -10 /* database open failed */
#define RPMERR_DBGETINDEX -11 /* database get from index failed */
#define RPMERR_DBPUTINDEX -12 /* database get from index failed */
#define RPMERR_NEWPACKAGE -13 /* package is too new to handle */
#define RPMERR_BADMAGIC -14 /* bad magic for an RPM */
#define RPMERR_RENAME -15 /* rename(2) failed */
#define RPMERR_UNLINK -16 /* unlink(2) failed */
#define RPMERR_RMDIR -17 /* rmdir(2) failed */
#define RPMERR_PKGINSTALLED -18 /* package already installed */
#define RPMERR_CHOWN -19 /* chown() call failed */
#define RPMERR_NOUSER -20 /* user does not exist */
#define RPMERR_NOGROUP -21 /* group does not exist */
#define RPMERR_MKDIR -22 /* mkdir() call failed */
#define RPMERR_FILECONFLICT -23 /* file being installed exists */
#define RPMERR_RPMRC -24 /* bad line in rpmrc */
#define RPMERR_NOSPEC -25 /* .spec file is missing */
#define RPMERR_NOTSRPM -26 /* a source rpm was expected */
#define RPMERR_FLOCK -27 /* locking the database failed */
#define RPMERR_OLDPACKAGE -28 /* trying upgrading to old version */
/*#define RPMERR_BADARCH -29 bad architecture or arch mismatch */
#define RPMERR_CREATE -30 /* failed to create a file */
#define RPMERR_NOSPACE -31 /* out of disk space */
#define RPMERR_NORELOCATE -32 /* tried to do improper relocatation */
/*#define RPMERR_BADOS -33 bad architecture or arch mismatch */
#define RPMMESS_BACKUP -34 /* backup made during [un]install */
#define RPMERR_MTAB -35 /* failed to read mount table */
#define RPMERR_STAT -36 /* failed to stat something */
#define RPMERR_BADDEV -37 /* file on device not listed in mtab */
#define RPMMESS_ALTNAME -38 /* file written as .rpmnew */
#define RPMMESS_PREREQLOOP -39 /* loop in prerequisites */
#define RPMERR_BADRELOCATE -40 /* bad relocation was specified */
#define RPMERR_OLDDB -41 /* old format database */
/* spec.c build.c pack.c */
#define RPMERR_UNMATCHEDIF -107 /* unclosed %ifarch or %ifos */
#define RPMERR_BADARG -109
#define RPMERR_SCRIPT -110 /* errors related to script exec */
#define RPMERR_READERROR -111
#define RPMERR_UNKNOWNOS -112
#define RPMERR_UNKNOWNARCH -113
#define RPMERR_EXEC -114
#define RPMERR_FORK -115
#define RPMERR_CPIO -116
#define RPMERR_GZIP -117
#define RPMERR_BADSPEC -118
#define RPMERR_LDD -119 /* couldn't understand ldd output */
#define RPMERR_BADFILENAME -120
#define RPMERR_BADSIGTYPE -200 /* Unknown signature type */
#define RPMERR_SIGGEN -201 /* Error generating signature */
/** signature.c **/
/**************************************************/

View File

@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2000-06-09 15:18-0400\n"
"POT-Creation-Date: 2000-06-09 17:03-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -2387,7 +2387,7 @@ msgstr ""
msgid "opening db file %s mode 0x%x\n"
msgstr ""
#: lib/db1.c:430 rpmio/url.c:444
#: lib/db1.c:430 rpmio/url.c:445
#, c-format
msgid "failed to open %s: %s\n"
msgstr ""
@ -3749,141 +3749,141 @@ msgstr ""
msgid "Unsatisfied dependencies for %s-%s-%s: "
msgstr ""
#: rpmio/rpmio.c:537
#: rpmio/rpmio.c:532
msgid "Success"
msgstr ""
#: rpmio/rpmio.c:540
#: rpmio/rpmio.c:535
msgid "Bad server response"
msgstr ""
#: rpmio/rpmio.c:543
#: rpmio/rpmio.c:538
msgid "Server IO error"
msgstr ""
#: rpmio/rpmio.c:546
#: rpmio/rpmio.c:541
msgid "Server timeout"
msgstr ""
#: rpmio/rpmio.c:549
#: rpmio/rpmio.c:544
msgid "Unable to lookup server host address"
msgstr ""
#: rpmio/rpmio.c:552
#: rpmio/rpmio.c:547
msgid "Unable to lookup server host name"
msgstr ""
#: rpmio/rpmio.c:555
#: rpmio/rpmio.c:550
msgid "Failed to connect to server"
msgstr ""
#: rpmio/rpmio.c:558
#: rpmio/rpmio.c:553
msgid "Failed to establish data connection to server"
msgstr ""
#: rpmio/rpmio.c:561
#: rpmio/rpmio.c:556
msgid "IO error to local file"
msgstr ""
#: rpmio/rpmio.c:564
#: rpmio/rpmio.c:559
msgid "Error setting remote server to passive mode"
msgstr ""
#: rpmio/rpmio.c:567
#: rpmio/rpmio.c:562
msgid "File not found on server"
msgstr ""
#: rpmio/rpmio.c:570
#: rpmio/rpmio.c:565
msgid "Abort in progress"
msgstr ""
#: rpmio/rpmio.c:574
#: rpmio/rpmio.c:569
msgid "Unknown or unexpected error"
msgstr ""
#: rpmio/rpmio.c:1107
#: rpmio/rpmio.c:1164
#, c-format
msgid "logging into %s as %s, pw %s\n"
msgstr ""
#: rpmio/macro.c:160
#: rpmio/macro.c:161
#, c-format
msgid "======================== active %d empty %d\n"
msgstr ""
#. XXX just in case
#: rpmio/macro.c:255
#: rpmio/macro.c:256
#, c-format
msgid "%3d>%*s(empty)"
msgstr ""
#: rpmio/macro.c:290
#: rpmio/macro.c:291
#, c-format
msgid "%3d<%*s(empty)\n"
msgstr ""
#: rpmio/macro.c:469
#: rpmio/macro.c:470
msgid "Macro %%%s has unterminated body"
msgstr ""
#: rpmio/macro.c:495
#: rpmio/macro.c:496
msgid "Macro %%%s has illegal name (%%define)"
msgstr ""
#: rpmio/macro.c:501
#: rpmio/macro.c:502
msgid "Macro %%%s has unterminated opts"
msgstr ""
#: rpmio/macro.c:506
#: rpmio/macro.c:507
msgid "Macro %%%s has empty body"
msgstr ""
#: rpmio/macro.c:511
#: rpmio/macro.c:512
msgid "Macro %%%s failed to expand"
msgstr ""
#: rpmio/macro.c:536
#: rpmio/macro.c:537
msgid "Macro %%%s has illegal name (%%undefine)"
msgstr ""
#: rpmio/macro.c:613
#: rpmio/macro.c:614
msgid "Macro %%%s (%s) was not used below level %d"
msgstr ""
#: rpmio/macro.c:710
#: rpmio/macro.c:711
#, c-format
msgid "Unknown option %c in %s(%s)"
msgstr ""
#: rpmio/macro.c:890
#: rpmio/macro.c:891
#, c-format
msgid "Recursion depth(%d) greater than max(%d)"
msgstr ""
#: rpmio/macro.c:956 rpmio/macro.c:972
#: rpmio/macro.c:957 rpmio/macro.c:973
#, c-format
msgid "Unterminated %c: %s"
msgstr ""
#: rpmio/macro.c:1012
#: rpmio/macro.c:1013
msgid "A %% is followed by an unparseable macro"
msgstr ""
#: rpmio/macro.c:1138
#: rpmio/macro.c:1139
msgid "Macro %%%.*s not found, skipping"
msgstr ""
#: rpmio/macro.c:1219
#: rpmio/macro.c:1220
msgid "Target buffer overflow"
msgstr ""
#. XXX Fstrerror
#: rpmio/macro.c:1399 rpmio/macro.c:1405
#: rpmio/macro.c:1400 rpmio/macro.c:1406
#, c-format
msgid "File %s: %s"
msgstr ""
#: rpmio/macro.c:1408
#: rpmio/macro.c:1409
#, c-format
msgid "File %s is smaller than %d bytes"
msgstr ""
@ -3909,37 +3909,37 @@ msgstr ""
msgid "memory alloc (%u bytes) returned NULL.\n"
msgstr ""
#: rpmio/url.c:87
#: rpmio/url.c:88
#, c-format
msgid "warning: u %p ctrl %p nrefs != 0 (%s %s)\n"
msgstr ""
#: rpmio/url.c:104
#: rpmio/url.c:105
#, c-format
msgid "warning: u %p data %p nrefs != 0 (%s %s)\n"
msgstr ""
#: rpmio/url.c:131
#: rpmio/url.c:132
#, c-format
msgid "warning: uCache[%d] %p nrefs(%d) != 1 (%s %s)\n"
msgstr ""
#: rpmio/url.c:217
#: rpmio/url.c:218
#, c-format
msgid "Password for %s@%s: "
msgstr ""
#: rpmio/url.c:242 rpmio/url.c:268
#: rpmio/url.c:243 rpmio/url.c:269
#, c-format
msgid "error: %sport must be a number\n"
msgstr ""
#: rpmio/url.c:404
#: rpmio/url.c:405
msgid "url port must be a number\n"
msgstr ""
#. XXX Fstrerror
#: rpmio/url.c:461
#: rpmio/url.c:462
#, c-format
msgid "failed to create %s: %s\n"
msgstr ""

View File

@ -5,7 +5,7 @@ Summary: The Red Hat package management system.
Name: rpm
%define version 4.0
Version: %{version}
Release: 0.34
Release: 0.35
Group: System Environment/Base
Source: ftp://ftp.rpm.org/pub/rpm/dist/rpm-3.0.x/rpm-%{version}.tar.gz
Copyright: GPL

View File

@ -6,11 +6,12 @@ INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/build -I$(top_srcdir)/lib \
-I$(top_srcdir)/popt @INCPATH@
pkgincdir = $(pkgincludedir)
pkginc_HEADERS = rpmio.h rpmurl.h rpmmacro.h
pkginc_HEADERS = rpmio.h rpmurl.h rpmmacro.h rpmmessages.h rpmerr.h
noinst_HEADERS = rpmio_internal.h ugid.h
lib_LTLIBRARIES = librpmio.la
librpmio_la_SOURCES = rpmio.c url.c macro.c ugid.c rpmmalloc.c rpmerr.c messages.c
librpmio_la_SOURCES = rpmrpc.c rpmio.c url.c macro.c \
ugid.c rpmmalloc.c rpmerr.c messages.c
librpmio_la_LDFLAGS = -L$(top_builddir)/popt/.libs -lpopt
librpmio_la_LIBADD = @LIBMISC@

View File

@ -39,8 +39,9 @@ typedef FILE * FD_t;
#else
#include <rpmlib.h>
#include <rpmio_internal.h>
#include <rpmmessages.h>
#include <rpmerr.h>
#endif

View File

@ -2,7 +2,7 @@
#include <stdarg.h>
#include <rpmlib.h>
#include <rpmmessages.h>
static int minLevel = RPMMESS_NORMAL;

View File

@ -2,7 +2,7 @@
#include <stdarg.h>
#include <rpmlib.h>
#include <rpmerr.h>
static struct err {
int code;

84
rpmio/rpmerr.h Normal file
View File

@ -0,0 +1,84 @@
#ifndef H_RPMERR
#define H_RPMERR
#define RPMERR_GDBMOPEN -2 /* gdbm open failed */
#define RPMERR_GDBMREAD -3 /* gdbm read failed */
#define RPMERR_GDBMWRITE -4 /* gdbm write failed */
#define RPMERR_INTERNAL -5 /* internal RPM error */
#define RPMERR_DBCORRUPT -6 /* rpm database is corrupt */
#define RPMERR_OLDDBCORRUPT -7 /* old style rpm database is corrupt */
#define RPMERR_OLDDBMISSING -8 /* old style rpm database is missing */
#define RPMERR_NOCREATEDB -9 /* cannot create new database */
#define RPMERR_DBOPEN -10 /* database open failed */
#define RPMERR_DBGETINDEX -11 /* database get from index failed */
#define RPMERR_DBPUTINDEX -12 /* database get from index failed */
#define RPMERR_NEWPACKAGE -13 /* package is too new to handle */
#define RPMERR_BADMAGIC -14 /* bad magic for an RPM */
#define RPMERR_RENAME -15 /* rename(2) failed */
#define RPMERR_UNLINK -16 /* unlink(2) failed */
#define RPMERR_RMDIR -17 /* rmdir(2) failed */
#define RPMERR_PKGINSTALLED -18 /* package already installed */
#define RPMERR_CHOWN -19 /* chown() call failed */
#define RPMERR_NOUSER -20 /* user does not exist */
#define RPMERR_NOGROUP -21 /* group does not exist */
#define RPMERR_MKDIR -22 /* mkdir() call failed */
#define RPMERR_FILECONFLICT -23 /* file being installed exists */
#define RPMERR_RPMRC -24 /* bad line in rpmrc */
#define RPMERR_NOSPEC -25 /* .spec file is missing */
#define RPMERR_NOTSRPM -26 /* a source rpm was expected */
#define RPMERR_FLOCK -27 /* locking the database failed */
#define RPMERR_OLDPACKAGE -28 /* trying upgrading to old version */
/*#define RPMERR_BADARCH -29 bad architecture or arch mismatch */
#define RPMERR_CREATE -30 /* failed to create a file */
#define RPMERR_NOSPACE -31 /* out of disk space */
#define RPMERR_NORELOCATE -32 /* tried to do improper relocatation */
/*#define RPMERR_BADOS -33 bad architecture or arch mismatch */
#define RPMMESS_BACKUP -34 /* backup made during [un]install */
#define RPMERR_MTAB -35 /* failed to read mount table */
#define RPMERR_STAT -36 /* failed to stat something */
#define RPMERR_BADDEV -37 /* file on device not listed in mtab */
#define RPMMESS_ALTNAME -38 /* file written as .rpmnew */
#define RPMMESS_PREREQLOOP -39 /* loop in prerequisites */
#define RPMERR_BADRELOCATE -40 /* bad relocation was specified */
#define RPMERR_OLDDB -41 /* old format database */
/* spec.c build.c pack.c */
#define RPMERR_UNMATCHEDIF -107 /* unclosed %ifarch or %ifos */
#define RPMERR_BADARG -109
#define RPMERR_SCRIPT -110 /* errors related to script exec */
#define RPMERR_READERROR -111
#define RPMERR_UNKNOWNOS -112
#define RPMERR_UNKNOWNARCH -113
#define RPMERR_EXEC -114
#define RPMERR_FORK -115
#define RPMERR_CPIO -116
#define RPMERR_GZIP -117
#define RPMERR_BADSPEC -118
#define RPMERR_LDD -119 /* couldn't understand ldd output */
#define RPMERR_BADFILENAME -120
#define RPMERR_BADSIGTYPE -200 /* Unknown signature type */
#define RPMERR_SIGGEN -201 /* Error generating signature */
#ifdef __cplusplus
extern "C" {
#endif
typedef void (*rpmErrorCallBackType)(void);
#if defined(__GNUC__)
void rpmError(int code, char * format, ...) __attribute__ ((__format__ (__printf__, 2, 3)));
#else
void rpmError(int code, char * format, ...);
#endif
int rpmErrorCode(void);
char *rpmErrorCodeString(void);
char *rpmErrorString(void);
rpmErrorCallBackType rpmErrorSetCallback(rpmErrorCallBackType);
#ifdef __cplusplus
}
#endif
#endif /* H_RPMERR */

File diff suppressed because it is too large Load Diff

View File

@ -3,6 +3,7 @@
#include <rpmio.h>
#include <rpmurl.h>
#include <assert.h>
typedef struct _FDSTACK_s {
FDIO_t io;
@ -56,9 +57,31 @@ struct _FD_s {
};
/*@access FD_t */
#include <assert.h>
#define FDSANE(fd) assert(fd && fd->magic == FDMAGIC)
extern int _rpmio_debug;
#define DBG(_f, _m, _x) \
if ((_rpmio_debug | ((_f) ? ((FD_t)(_f))->flags : 0)) & (_m)) fprintf _x
#define DBGIO(_f, _x) DBG((_f), RPMIO_DEBUG_IO, _x)
#define DBGREFS(_f, _x) DBG((_f), RPMIO_DEBUG_REFS, _x)
#define xfree(_p) free((void *)_p)
#ifdef __cplusplus
extern "C" {
#endif
int fdFgets(FD_t fd, char * buf, size_t len);
/*@null@*/ FD_t ftpOpen(const char *url, /*@unused@*/ int flags,
/*@unused@*/ mode_t mode, /*@out@*/ urlinfo *uret);
int ftpReq(FD_t data, const char * ftpCmd, const char * ftpArg);
int ftpCmd(const char * cmd, const char * url, const char * arg2);
int ufdClose( /*@only@*/ void * cookie);
static inline /*@null@*/ const FDIO_t fdGetIo(FD_t fd) {
FDSANE(fd);
return fd->fps[fd->nfps].io;
@ -241,4 +264,8 @@ static inline void fadSetFirstFree(FD_t fd, unsigned int firstFree) {
fd->firstFree = firstFree;
}
#ifdef __cplusplus
}
#endif
#endif /* H_RPMIO_INTERNAL */

43
rpmio/rpmmessages.h Normal file
View File

@ -0,0 +1,43 @@
#ifndef H_RPMMESSAGES
#define H_RPMMESSAGES
#define RPMMESS_DEBUG 1
#define RPMMESS_VERBOSE 2
#define RPMMESS_NORMAL 3
#define RPMMESS_WARNING 4
#define RPMMESS_ERROR 5
#define RPMMESS_FATALERROR 6
#define RPMMESS_QUIET (RPMMESS_NORMAL + 1)
typedef enum rpmCallbackType_e {
RPMCALLBACK_INST_PROGRESS, RPMCALLBACK_INST_START,
RPMCALLBACK_INST_OPEN_FILE, RPMCALLBACK_INST_CLOSE_FILE,
RPMCALLBACK_TRANS_PROGRESS, RPMCALLBACK_TRANS_START, RPMCALLBACK_TRANS_STOP,
RPMCALLBACK_UNINST_PROGRESS, RPMCALLBACK_UNINST_START, RPMCALLBACK_UNINST_STOP
} rpmCallbackType;
#ifdef __cplusplus
extern "C" {
#endif
typedef void * (*rpmCallbackFunction)(const void * h,
const rpmCallbackType what,
const unsigned long amount,
const unsigned long total,
const void * pkgKey, void * data);
void urlSetCallback(rpmCallbackFunction notify, void *notifyData, int notifyCount);
void rpmIncreaseVerbosity(void);
void rpmSetVerbosity(int level);
int rpmGetVerbosity(void);
int rpmIsVerbose(void);
int rpmIsDebug(void);
void rpmMessage(int level, const char * format, ...);
#ifdef __cplusplus
}
#endif
#endif /* H_RPMMESSAGES */

1120
rpmio/rpmrpc.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -9,7 +9,8 @@
#include <netinet/in.h>
#endif /* __LCLINT__ */
#include <rpmbuild.h>
#include <rpmmacro.h>
#include <rpmmessages.h>
#include <rpmio_internal.h>
#ifndef IPPORT_FTP
@ -28,10 +29,10 @@ int url_iobuf_size = URL_IOBUF_SIZE;
#define RPMURL_DEBUG_REFS 0x20000000
int _url_debug = 0;
#define DBG(_f, _m, _x) if ((_url_debug | (_f)) & (_m)) fprintf _x
#define URLDBG(_f, _m, _x) if ((_url_debug | (_f)) & (_m)) fprintf _x
#define DBGIO(_f, _x) DBG((_f), RPMURL_DEBUG_IO, _x)
#define DBGREFS(_f, _x) DBG((_f), RPMURL_DEBUG_REFS, _x)
#define URLDBGIO(_f, _x) URLDBG((_f), RPMURL_DEBUG_IO, _x)
#define URLDBGREFS(_f, _x) URLDBG((_f), RPMURL_DEBUG_REFS, _x)
/*@only@*/ /*@null@*/ static urlinfo *uCache = NULL;
static int uCount = 0;
@ -40,7 +41,7 @@ urlinfo XurlLink(urlinfo u, const char *msg, const char *file, unsigned line)
{
URLSANE(u);
u->nrefs++;
DBGREFS(0, (stderr, "--> url %p ++ %d %s at %s:%u\n", u, u->nrefs, msg, file, line));
URLDBGREFS(0, (stderr, "--> url %p ++ %d %s at %s:%u\n", u, u->nrefs, msg, file, line));
return u;
}
@ -67,7 +68,7 @@ urlinfo XurlNew(const char *msg, const char *file, unsigned line)
urlinfo XurlFree(urlinfo u, const char *msg, const char *file, unsigned line)
{
URLSANE(u);
DBGREFS(0, (stderr, "--> url %p -- %d %s at %s:%u\n", u, u->nrefs, msg, file, line));
URLDBGREFS(0, (stderr, "--> url %p -- %d %s at %s:%u\n", u, u->nrefs, msg, file, line));
if (--u->nrefs > 0)
return u;
if (u->ctrl) {
@ -108,16 +109,16 @@ DBGREFS(0, (stderr, "--> url %p -- %d %s at %s:%u\n", u, u->nrefs, msg, file, li
free(u->buf);
u->buf = NULL;
}
FREE(u->url);
FREE(u->service);
FREE(u->user);
FREE(u->password);
FREE(u->host);
FREE(u->portstr);
FREE(u->proxyu);
FREE(u->proxyh);
if (u->url) xfree(u->url);
if (u->service) xfree(u->service);
if (u->user) xfree(u->user);
if (u->password) xfree(u->password);
if (u->host) xfree(u->host);
if (u->portstr) xfree(u->portstr);
if (u->proxyu) xfree(u->proxyu);
if (u->proxyh) xfree(u->proxyh);
/*@-refcounttrans@*/ FREE(u); /*@-refcounttrans@*/
/*@-refcounttrans@*/ xfree(u); /*@-refcounttrans@*/
return NULL;
}
@ -206,7 +207,7 @@ static void urlFind(urlinfo *uret, int mustAsk)
/* Zap proxy host and port in case they have been reset */
u->proxyp = -1;
FREE(u->proxyh);
if (u->proxyh) xfree(u->proxyh);
/* Perform one-time FTP initialization */
if (u->urltype == URL_IS_FTP) {
@ -215,7 +216,7 @@ static void urlFind(urlinfo *uret, int mustAsk)
char * prompt;
prompt = alloca(strlen(u->host) + strlen(u->user) + 256);
sprintf(prompt, _("Password for %s@%s: "), u->user, u->host);
FREE(u->password);
if (u->password) xfree(u->password);
u->password = xstrdup( /*@-unrecog@*/ getpass(prompt) /*@=unrecog@*/ );
}