summaryrefslogtreecommitdiff
path: root/rpmio
diff options
context:
space:
mode:
authorjbj <devnull@localhost>2003-01-28 17:17:26 +0000
committerjbj <devnull@localhost>2003-01-28 17:17:26 +0000
commitc63f257a7ebd1d41a3caf38172251bdb2e6c0b20 (patch)
treeb915754e18cb70148686f0c3f75d4f7bfcf9121c /rpmio
parentb4352eaa31f458d0eee5bf9b319982ded7fb246f (diff)
downloadlibrpm-tizen-c63f257a7ebd1d41a3caf38172251bdb2e6c0b20.tar.gz
librpm-tizen-c63f257a7ebd1d41a3caf38172251bdb2e6c0b20.tar.bz2
librpm-tizen-c63f257a7ebd1d41a3caf38172251bdb2e6c0b20.zip
- fix: clean relocation path for --prefix=/.
- python: permit stdout/stderr to be remapped to install.log. CVS patchset: 6031 CVS date: 2003/01/28 17:17:26
Diffstat (limited to 'rpmio')
-rw-r--r--rpmio/rpmlog.c16
-rw-r--r--rpmio/rpmlog.h28
2 files changed, 37 insertions, 7 deletions
diff --git a/rpmio/rpmlog.c b/rpmio/rpmlog.c
index 13abea8c6..4d8e8d9c0 100644
--- a/rpmio/rpmlog.c
+++ b/rpmio/rpmlog.c
@@ -124,6 +124,18 @@ rpmlogCallback rpmlogSetCallback(rpmlogCallback cb)
return ocb;
}
+/*@unchecked@*/ /*@null@*/
+static FILE * _stdlog = NULL;
+
+FILE * rpmlogSetFile(FILE * fp)
+ /*@globals _stdlog @*/
+ /*@modifies _stdlog @*/
+{
+ FILE * ofp = _stdlog;
+ _stdlog = fp;
+ return ofp;
+}
+
/*@-readonlytrans@*/ /* FIX: double indirection. */
/*@observer@*/ /*@unchecked@*/
static char *rpmlogMsgPrefix[] = {
@@ -158,7 +170,7 @@ static void vrpmlog (unsigned code, const char *fmt, va_list ap)
/*@unused@*/ unsigned fac = RPMLOG_FAC(code);
char *msgbuf, *msg;
int msgnb = BUFSIZ, nb;
- FILE * msgout = stderr;
+ FILE * msgout = (_stdlog ? _stdlog : stderr);
if ((mask & rpmlogMask) == 0)
return;
@@ -216,7 +228,7 @@ static void vrpmlog (unsigned code, const char *fmt, va_list ap)
switch (pri) {
case RPMLOG_INFO:
case RPMLOG_NOTICE:
- msgout = stdout;
+ msgout = (_stdlog ? _stdlog : stdout);
break;
case RPMLOG_EMERG:
diff --git a/rpmio/rpmlog.h b/rpmio/rpmlog.h
index 3a5460c33..6cbd01b39 100644
--- a/rpmio/rpmlog.h
+++ b/rpmio/rpmlog.h
@@ -102,7 +102,7 @@ typedef enum rpmlogFac_e {
#ifdef RPMLOG_NAMES
-CODE facilitynames[] =
+RPMCODE facilitynames[] =
{
{ "auth", RPMLOG_AUTH },
{ "authpriv",RPMLOG_AUTHPRIV },
@@ -158,7 +158,8 @@ typedef void (*rpmlogCallback) (void);
*/
typedef /*@abstract@*/ struct rpmlogRec_s {
int code;
-/*@owned@*/ /*@null@*/ const char * message;
+/*@owned@*/ /*@null@*/
+ const char * message;
} * rpmlogRec;
#ifdef __cplusplus
@@ -198,6 +199,8 @@ void rpmlogOpen (const char * ident, int option, int facility)
/**
* Set the log mask level.
+ * @param mask log mask (0 is no operation)
+ * @return previous log mask
*/
int rpmlogSetMask (int mask)
/*@globals internalState@*/
@@ -215,7 +218,8 @@ int rpmlogSetMask (int mask)
* @return text of last message
*/
/*@-redecl@*/
-/*@observer@*/ /*@null@*/ const char * rpmlogMessage(void) /*@*/;
+/*@observer@*/ /*@null@*/ const char * rpmlogMessage(void)
+ /*@*/;
/*@=redecl@*/
/**
@@ -225,14 +229,27 @@ int rpmlogSetMask (int mask)
* and parsed IMHO.
* @return code from last message
*/
-int rpmlogCode(void) /*@*/;
+int rpmlogCode(void)
+ /*@*/;
/**
* Set rpmlog callback function.
+ * @param cb rpmlog callback function
+ * @return previous rpmlog callback function
*/
rpmlogCallback rpmlogSetCallback(rpmlogCallback cb)
/*@globals internalState@*/
/*@modifies internalState @*/;
+
+/**
+ * Set rpmlog file handle.
+ * @param fp rpmlog file handle (NULL uses stdout/stderr)
+ * @return previous rpmlog file handle
+ */
+/*@null@*/
+FILE * rpmlogSetFile(/*@null@*/ FILE * fp)
+ /*@globals internalState@*/
+ /*@modifies internalState @*/;
/*@=exportlocal@*/
/**
@@ -248,7 +265,8 @@ extern rpmlogCallback rpmErrorSetCallback(rpmlogCallback cb)
* @deprecated Perl-RPM needs, use rpmlogCode() instead.
* @return code from last message
*/
-extern int rpmErrorCode(void) /*@*/;
+extern int rpmErrorCode(void)
+ /*@*/;
/**
* Return text of last rpmError() message.