From f8c9788c7e70517da8ce58671700bf74b71ada67 Mon Sep 17 00:00:00 2001 From: jbj Date: Mon, 14 Jun 2004 03:23:12 +0000 Subject: [PATCH] Add rpmxp.c to rpmtool. CVS patchset: 7318 CVS date: 2004/06/14 03:23:12 --- tools/Makefile.am | 3 ++- tools/rpmtool.c | 16 +++------------- tools/rpmxp.c | 12 ++++++++++++ tools/rpmxp.h | 6 +++++- 4 files changed, 22 insertions(+), 15 deletions(-) diff --git a/tools/Makefile.am b/tools/Makefile.am index 209f692..a932b1b 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -66,8 +66,9 @@ rpminject_SOURCES = rpminject.c rpmsort_SOURCES = rpmsort.c #rpmsort_LDFLAGS = $(staticLDFLAGS) -rpmtool_SOURCES = rpmtool.c +rpmtool_SOURCES = rpmtool.c rpmxp.c #rpmtool_LDFLAGS = $(staticLDFLAGS) +rpmtool_LDADD = $(LDADD) -lxml2 rpmxml_SOURCES = rpmxml.c rpmxp.c rpmxml_LDADD = -lxml2 diff --git a/tools/rpmtool.c b/tools/rpmtool.c index 8089924..3f19eae 100644 --- a/tools/rpmtool.c +++ b/tools/rpmtool.c @@ -1,6 +1,7 @@ #include "system.h" #include +#include #include #include @@ -8,18 +9,6 @@ #include "misc.h" #include "debug.h" -static const char * rpmxpDTD = "\ -\n\ -\n\ -\n\ -\n\ -\n\ -\n\ -\n\ -]>\n\ -"; - typedef enum rpmtoolComponentBits_e { RPMTOOL_NONE = 0, RPMTOOL_LEAD = (1 << 0), @@ -233,7 +222,8 @@ fprintf(stderr, "*** Fopen(%s,w.ufdio)\n", (ofn != NULL ? ofn : "-")); t = headerSprintf(h, s, rpmTagTable, rpmHeaderFormats, &errstr); if (t != NULL) { - Fwrite(rpmxpDTD, strlen(rpmxpDTD), 1, fdo); + if (rpmxpDTD != NULL && *rpmxpDTD != '\0') + Fwrite(rpmxpDTD, strlen(rpmxpDTD), 1, fdo); Fwrite(t, strlen(t), 1, fdo); } t = _free(t); diff --git a/tools/rpmxp.c b/tools/rpmxp.c index fea2c21..ab5fde9 100644 --- a/tools/rpmxp.c +++ b/tools/rpmxp.c @@ -5,6 +5,18 @@ int _rpmxp_debug = 0; +const char * rpmxpDTD = "\ +\n\ +\n\ +\n\ +\n\ +\n\ +\n\ +\n\ +]>\n\ +"; + rpmxp rpmxpFree(rpmxp xp) { if (xp != NULL) { diff --git a/tools/rpmxp.h b/tools/rpmxp.h index c3b65e6..ad72768 100644 --- a/tools/rpmxp.h +++ b/tools/rpmxp.h @@ -17,8 +17,12 @@ extern int _rpmxp_debug; /** */ -typedef struct rpmxp_s * rpmxp; +/*@unchecked@*/ /*@observer@*/ +extern const char * rpmxpDTD; +/** + */ +typedef struct rpmxp_s * rpmxp; #if defined(_RPMXP_INTERNAL) /** -- 2.7.4