Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=pacman-g2.git;a=commitdiff;h=5f9170ab0d630d4c220a9d52910ea52cb7e40bc4

commit 5f9170ab0d630d4c220a9d52910ea52cb7e40bc4
Author: Michel Hermier <[email protected]>
Date:   Wed Oct 30 09:08:07 2013 +0100

libpacman: Move _pacman_logaction from util.h to log.h

diff --git a/lib/libpacman/util.c b/lib/libpacman/util.c
index 72eb971..4feee58 100644
--- a/lib/libpacman/util.c
+++ b/lib/libpacman/util.c
@@ -43,8 +43,6 @@
#include <fcntl.h>
#include <ctype.h>
#include <dirent.h>
-#include <time.h>
-#include <syslog.h>
#include <sys/wait.h>
#include <libintl.h>
#ifdef CYGWIN
@@ -409,37 +407,6 @@ int _pacman_rmrf(char *path)
return(0);
}

-int _pacman_logaction(unsigned char usesyslog, FILE *f, char *fmt, ...)
-{
-       char msg[1024];
-       int smsg = sizeof(msg)-1;
-       va_list args;
-
-       va_start(args, fmt);
-       vsnprintf(msg, smsg, fmt, args);
-       va_end(args);
-
-       if(usesyslog) {
-               syslog(LOG_WARNING, "%s", msg);
-       }
-
-       if(f) {
-               time_t t;
-               struct tm *tm;
-
-               t = time(NULL);
-               tm = localtime(&t);
-
-               fprintf(f, "[%02d/%02d/%02d %02d:%02d] %s\n",
-                       tm->tm_mon+1, tm->tm_mday, tm->tm_year-100,
-                       tm->tm_hour, tm->tm_min,
-                       _pacman_strtrim(msg));
-               fflush(f);
-       }
-
-       return(0);
-}
-
int _pacman_ldconfig(char *root)
{
char line[PATH_MAX];
diff --git a/lib/libpacman/util.h b/lib/libpacman/util.h
index aac1f78..4f810bb 100644
--- a/lib/libpacman/util.h
+++ b/lib/libpacman/util.h
@@ -67,7 +67,6 @@ int _pacman_lckmk(char *file);
int _pacman_lckrm(char *file);
int _pacman_unpack(const char *archive, const char *prefix, const char *fn);
int _pacman_rmrf(char *path);
-int _pacman_logaction(unsigned char usesyslog, FILE *f, char *fmt, ...);
int _pacman_ldconfig(char *root);
#ifdef _PACMAN_TRANS_H
int _pacman_runscriptlet(char *util, char *installfn, const char *script, char 
*ver, char *oldver, pmtrans_t *trans);
diff --git a/lib/libpacman/util/log.c b/lib/libpacman/util/log.c
index 6428f09..d38137e 100644
--- a/lib/libpacman/util/log.c
+++ b/lib/libpacman/util/log.c
@@ -22,6 +22,7 @@
#include "config.h"
#include <stdio.h>
#include <stdarg.h>
+#include <syslog.h>
#include <time.h>

/* pacman-g2 */
@@ -52,4 +53,36 @@ void _pacman_log(unsigned char flag, const char *fmt, ...)
}
}

+int _pacman_logaction(unsigned char usesyslog, FILE *f, char *fmt, ...)
+{
+       char msg[1024];
+       int smsg = sizeof(msg)-1;
+       va_list args;
+
+       va_start(args, fmt);
+       vsnprintf(msg, smsg, fmt, args);
+       va_end(args);
+
+       if(usesyslog) {
+               syslog(LOG_WARNING, "%s", msg);
+       }
+
+       if(f) {
+               time_t t;
+               struct tm *tm;
+
+               t = time(NULL);
+               tm = localtime(&t);
+
+               fprintf(f, "[%02d/%02d/%02d %02d:%02d] %s\n",
+                       tm->tm_mon+1, tm->tm_mday, tm->tm_year-100,
+                       tm->tm_hour, tm->tm_min,
+                       _pacman_strtrim(msg));
+               fflush(f);
+       }
+
+       return(0);
+}
+
+
/* vim: set ts=2 sw=2 noet: */
diff --git a/lib/libpacman/util/log.h b/lib/libpacman/util/log.h
index d5b1ab9..419cf1a 100644
--- a/lib/libpacman/util/log.h
+++ b/lib/libpacman/util/log.h
@@ -29,6 +29,7 @@ extern pacman_cb_log pm_logcb;
extern unsigned char pm_logmask;

void _pacman_log(unsigned char flag, const char *fmt, ...);
+int _pacman_logaction(unsigned char usesyslog, FILE *f, char *fmt, ...);

#endif /* _PACMAN_LOG_H */
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to