]> err.no Git - dpkg/commitdiff
Move showpkg.c to lib/ so multiple tools can use it
authorWichert Akkerman <wakkerma@debian.org>
Wed, 12 Sep 2001 14:58:13 +0000 (14:58 +0000)
committerWichert Akkerman <wakkerma@debian.org>
Wed, 12 Sep 2001 14:58:13 +0000 (14:58 +0000)
lib/Makefile.in
lib/showpkg.c [moved from main/showpkg.c with 92% similarity]
main/Makefile.in
po/POTFILES.in

index fa966c21f74e7d73b85a7a4b5e7c09d818b20b0b..8d7d0e9d9bb9a28093fdb8270de55a414f22f2ba 100644 (file)
@@ -7,7 +7,7 @@ include ../Makefile.conf
 
 SOURCES                = compat.c database.c dbmodify.c dump.c ehandle.c fields.c \
                    lock.c mlib.c myopt.c nfmalloc.c parse.c parsehelp.c \
-                   showcright.c tarfn.c varbuf.c vercmp.c md5.c
+                   showcright.c showpkg.c tarfn.c varbuf.c vercmp.c md5.c
 
 OBJECTS                = $(patsubst %.c, %.o, $(SOURCES))
 GENFILES       = $(OBJECTS) libdpkg.a
similarity index 92%
rename from main/showpkg.c
rename to lib/showpkg.c
index cc3fc0843f3cca6ceea67cbcce0e21653b2bcb12..ab26776114f5476cd0118fefc2aaf43f6d3d01d9 100644 (file)
@@ -229,21 +229,11 @@ void show1package(const struct lstitem* head, struct pkginfo *pkg) {
 
                        for (fip=fieldinfos; fip->name; fip++) 
                                if (strcasecmp(head->data, fip->name)==0)  {
-                                       size_t len;
-                                       char* i;
-
-                                       fip->wcall(&wb,pkg,&pkg->installed,fip);
+                                       fip->wcall(&wb,pkg,&pkg->installed,0,fip);
                                        if (!wb.used)
                                                break;
-                                       /* Bugger, wcall adds the fieldname and a trailing newline we
-                                        * do not need. We should probably improve wcall to only do that
-                                        * optionally, but this will do for now (ie this is a TODO)
-                                        */
-                                       wb.buf[wb.used-1]='\0';
-                                       i=strchr(wb.buf, ':')+2;
-                                       len=strlen(i)+1;
-                                       memmove(wb.buf, i, len);
 
+                                       varbufaddc(&wb, '\0');
                                        varbufprintf(&fb, fmt, wb.buf);
                                        varbufreset(&wb);
                                        ok=1;
index f17a67bf481fb655b7533698e37a04940d771de3..0c691c5b3d3bb5ac8d29dc9fff368ff7a0c590e8 100644 (file)
@@ -14,7 +14,7 @@ MAN8PAGES     = dpkg.8 dpkg-query.8
 OBJECTS                = $(patsubst %.c, %.o, $(SOURCES))
 GENFILES       = $(OBJECTS) archtable.h dpkg dpkg-static
 
-QUERY_SOURCES  = query.c showpkg.c filesdb.c errors.c 
+QUERY_SOURCES  = query.c filesdb.c errors.c 
 QUERY_OBJECTS  = $(patsubst %.c, %.o, $(QUERY_SOURCES))
 QUERY_GENFILES = $(QUERY_OBJECTS) dpkg-query
 
index 124925e5c4fa0d2c015c47d84cf7d30b2e848ecd..b7032b84121434f8f332593bf656d0db56867cca 100644 (file)
@@ -12,6 +12,7 @@ lib/myopt.c
 lib/parse.c
 lib/parsehelp.c
 lib/showcright.c
+lib/showpkg.c
 lib/varbuf.c
 
 main/archives.c
@@ -30,7 +31,6 @@ main/select.c
 main/update.c
 
 main/query.c
-main/showpkg.c
 
 dpkg-deb/build.c
 dpkg-deb/extract.c