Pārlūkot izejas kodu

libdpkg: Move package formatting support to a new pkg-format module

Move declarations from dpkg-db.h to a new pkg-format.h, and rename
showpkg.c to pkg-format.c.
Guillem Jover 16 gadi atpakaļ
vecāks
revīzija
6ada98fe52
7 mainītis faili ar 44 papildinājumiem un 12 dzēšanām
  1. 1 0
      dpkg-deb/info.c
  2. 1 1
      lib/dpkg/Makefile.am
  3. 0 9
      lib/dpkg/dpkg-db.h
  4. 2 1
      lib/dpkg/showpkg.c
  5. 38 0
      lib/dpkg/pkg-format.h
  6. 1 1
      po/POTFILES.in
  7. 1 0
      src/query.c

+ 1 - 0
dpkg-deb/info.c

@@ -39,6 +39,7 @@
 #include <dpkg/i18n.h>
 #include <dpkg/dpkg.h>
 #include <dpkg/dpkg-db.h>
+#include <dpkg/pkg-format.h>
 #include <dpkg/buffer.h>
 #include <dpkg/subproc.h>
 #include <dpkg/myopt.h>

+ 1 - 1
lib/dpkg/Makefile.am

@@ -45,9 +45,9 @@ libdpkg_a_SOURCES = \
 	path.c path.h \
 	pkg.c pkg.h \
 	pkg-array.c pkg-array.h \
+	pkg-format.c pkg-format.h \
 	pkg-list.c pkg-list.h \
 	progress.c progress.h \
-	showpkg.c \
 	string.c string.h \
 	subproc.c subproc.h \
 	tarfn.c tarfn.h \

+ 0 - 9
lib/dpkg/dpkg-db.h

@@ -401,15 +401,6 @@ char *nfstrsave(const char*);
 char *nfstrnsave(const char*, size_t);
 void nffreeall(void);
 
-/*** from showpkg.c ***/
-
-struct lstitem;
-
-struct lstitem* parseformat(const char* fmt);
-void freeformat(struct lstitem* head);
-void show1package(const struct lstitem* head,
-                  struct pkginfo *pkg, struct pkginfoperfile *pif);
-
 DPKG_END_DECLS
 
 #endif /* LIBDPKG_DPKG_DB_H */

+ 2 - 1
lib/dpkg/showpkg.c

@@ -1,6 +1,6 @@
 /*
  * libdpkg - Debian packaging suite library routines
- * showpkg.c - customizable package listing
+ * pkg-format.c - customizable package formatting
  *
  * Copyright © 2001 Wichert Akkerman <wakkerma@debian.org>
  *
@@ -29,6 +29,7 @@
 #include <dpkg/dpkg.h>
 #include <dpkg/dpkg-db.h>
 #include <dpkg/parsedump.h>
+#include <dpkg/pkg-format.h>
 
 typedef enum {
 	invalid,

+ 38 - 0
lib/dpkg/pkg-format.h

@@ -0,0 +1,38 @@
+/*
+ * libdpkg - Debian packaging suite library routines
+ * pkg-format.c - customizable package formatting
+ *
+ * Copyright © 2001 Wichert Akkerman <wakkerma@debian.org>
+ *
+ * This is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef LIBDPKG_PKG_FORMAT_H
+#define LIBDPKG_PKG_FORMAT_H
+
+#include <dpkg/macros.h>
+#include <dpkg/dpkg-db.h>
+
+DPKG_BEGIN_DECLS
+
+struct lstitem;
+
+struct lstitem *parseformat(const char *fmt);
+void freeformat(struct lstitem *head);
+void show1package(const struct lstitem *head,
+                  struct pkginfo *pkg, struct pkginfoperfile *pif);
+
+DPKG_END_DECLS
+
+#endif /* LIBDPKG_PKG_FORMAT_H */

+ 1 - 1
po/POTFILES.in

@@ -23,9 +23,9 @@ lib/dpkg/parsehelp.c
 lib/dpkg/path.c
 lib/dpkg/pkg.c
 lib/dpkg/pkg-array.c
+lib/dpkg/pkg-format.c
 lib/dpkg/pkg-list.c
 lib/dpkg/progress.c
-lib/dpkg/showpkg.c
 lib/dpkg/string.c
 lib/dpkg/subproc.c
 lib/dpkg/tarfn.c

+ 1 - 0
src/query.c

@@ -43,6 +43,7 @@
 #include <dpkg/dpkg.h>
 #include <dpkg/dpkg-db.h>
 #include <dpkg/pkg-array.h>
+#include <dpkg/pkg-format.h>
 #include <dpkg/path.h>
 #include <dpkg/myopt.h>