summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjbj <devnull@localhost>2001-04-17 19:29:12 +0000
committerjbj <devnull@localhost>2001-04-17 19:29:12 +0000
commit8b20f15fbf2b7c1fed46b228dca2fc8358414903 (patch)
treecb1e4f74543f9da914a63fe14b4efb31e92bc19c
parent63db1277013da1355d86ef5f3faf5dff26581c17 (diff)
downloadlibrpm-tizen-8b20f15fbf2b7c1fed46b228dca2fc8358414903.tar.gz
librpm-tizen-8b20f15fbf2b7c1fed46b228dca2fc8358414903.tar.bz2
librpm-tizen-8b20f15fbf2b7c1fed46b228dca2fc8358414903.zip
- portability: vsnprintf/snprintf wrappers for those without (#34657).
CVS patchset: 4686 CVS date: 2001/04/17 19:29:12
-rw-r--r--CHANGES1
-rw-r--r--configure.in2
-rw-r--r--lib/problems.c19
-rw-r--r--rpmio/rpmlog.c8
4 files changed, 30 insertions, 0 deletions
diff --git a/CHANGES b/CHANGES
index f2bb5a75e..24e29dcf4 100644
--- a/CHANGES
+++ b/CHANGES
@@ -26,6 +26,7 @@
- fix: --excludepath was broken (#24434).
- fix: s390 (and ppc?) could return CPIOERR_BAD_HEADER (#28645).
- fix: Fwrite's are optimized out by aggressive compiler(irix) (#34711).
+ - portability: vsnprintf/snprintf wrappers for those without (#34657).
4.0 -> 4.0.[12]
- add doxygen and lclint annotations most everywhere.
diff --git a/configure.in b/configure.in
index 062cb0ee3..bea687db0 100644
--- a/configure.in
+++ b/configure.in
@@ -295,6 +295,8 @@ AC_CHECK_FUNC(socket, [], [
dnl Better not use fchmod at all.
AC_CHECK_FUNC(fchmod)
+AC_CHECK_FUNCS(vsnprintf snprintf)
+
dnl Temporary hack for MiNT. Some functions (writev, snprintf) are
dnl not in the libc but in libport (for political reasons). This check
dnl can hopefully be removed soon. Please use the default action
diff --git a/lib/problems.c b/lib/problems.c
index c90cd1a89..5069304f4 100644
--- a/lib/problems.c
+++ b/lib/problems.c
@@ -86,6 +86,25 @@ void printDepProblems(FILE * fp, struct rpmDependencyConflict * conflicts,
}
}
+#if !defined(HAVE_VSNPRINTF)
+static inline int vsnprintf(char * buf, /*@unused@*/ int nb,
+ const char * fmt, va_list ap)
+{
+ return vsprintf(buf, fmt, ap);
+}
+#endif
+#if !defined(HAVE_SNPRINTF)
+static inline int snprintf(char * buf, int nb, const char * fmt, ...)
+{
+ va_list ap;
+ int rc;
+ va_start(ap, fmt);
+ rc = vsnprintf(buf, nb, fmt, ap);
+ va_end(ap);
+ return rc;
+}
+#endif
+
const char * rpmProblemString(rpmProblem prob) /*@*/
{
int nb = (prob->pkgNEVR ? strlen(prob->pkgNEVR) : 0) +
diff --git a/rpmio/rpmlog.c b/rpmio/rpmlog.c
index 1d5bdb5da..8e060d81c 100644
--- a/rpmio/rpmlog.c
+++ b/rpmio/rpmlog.c
@@ -98,6 +98,14 @@ static char *rpmlogMsgPrefix[] = {
"D: ", /*!< RPMLOG_DEBUG */
};
+#if !defined(HAVE_VSNPRINTF)
+static inline int vsnprintf(char * buf, /*@unused@*/ int nb,
+ const char * fmt, va_list ap)
+{
+ return vsprintf(buf, fmt, ap);
+}
+#endif
+
static void vrpmlog (unsigned code, const char *fmt, va_list ap)
{
int pri = RPMLOG_PRI(code);