Kaynağa Gözat

libdpkg: Move gettext related definitions to a new dpkg-i18n.h

Guillem Jover 18 yıl önce
ebeveyn
işleme
df834c918b
64 değiştirilmiş dosya ile 224 ekleme ve 5 silme
  1. 66 0
      ChangeLog
  2. 2 0
      dpkg-deb/build.c
  3. 2 0
      dpkg-deb/extract.c
  4. 2 0
      dpkg-deb/info.c
  5. 2 0
      dpkg-deb/main.c
  6. 2 0
      dpkg-split/info.c
  7. 2 0
      dpkg-split/join.c
  8. 2 0
      dpkg-split/main.c
  9. 2 0
      dpkg-split/queue.c
  10. 2 0
      dpkg-split/split.c
  11. 2 0
      dselect/basecmds.cc
  12. 2 0
      dselect/baselist.cc
  13. 2 0
      dselect/bindings.cc
  14. 2 0
      dselect/helpmsgs.cc
  15. 2 0
      dselect/main.cc
  16. 2 0
      dselect/methlist.cc
  17. 2 0
      dselect/method.cc
  18. 2 0
      dselect/methparse.cc
  19. 2 0
      dselect/pkgdisplay.cc
  20. 2 0
      dselect/pkginfo.cc
  21. 2 0
      dselect/pkglist.cc
  22. 2 0
      dselect/pkgsublist.cc
  23. 2 0
      dselect/pkgtop.cc
  24. 1 0
      lib/Makefile.am
  25. 3 0
      lib/compat.c
  26. 2 0
      lib/compression.c
  27. 2 0
      lib/database.c
  28. 2 0
      lib/dbmodify.c
  29. 36 0
      lib/dpkg-i18n.h
  30. 0 5
      lib/dpkg.h
  31. 2 0
      lib/dump.c
  32. 2 0
      lib/ehandle.c
  33. 2 0
      lib/fields.c
  34. 2 0
      lib/lock.c
  35. 2 0
      lib/log.c
  36. 2 0
      lib/mlib.c
  37. 2 0
      lib/myopt-util.c
  38. 2 0
      lib/myopt.c
  39. 2 0
      lib/nfmalloc.c
  40. 2 0
      lib/parse.c
  41. 2 0
      lib/parsehelp.c
  42. 2 0
      lib/showpkg.c
  43. 2 0
      lib/subproc.c
  44. 2 0
      lib/trigdeferred.l
  45. 2 0
      lib/triglib.c
  46. 2 0
      lib/utils.c
  47. 2 0
      src/archives.c
  48. 2 0
      src/cleanup.c
  49. 2 0
      src/configure.c
  50. 2 0
      src/depcon.c
  51. 2 0
      src/enquiry.c
  52. 2 0
      src/errors.c
  53. 2 0
      src/filesdb.c
  54. 2 0
      src/help.c
  55. 2 0
      src/main.c
  56. 2 0
      src/packages.c
  57. 2 0
      src/pkg-show.c
  58. 2 0
      src/processarc.c
  59. 2 0
      src/query.c
  60. 2 0
      src/remove.c
  61. 2 0
      src/select.c
  62. 2 0
      src/trigcmd.c
  63. 2 0
      src/trigproc.c
  64. 2 0
      src/update.c

+ 66 - 0
ChangeLog

@@ -1,3 +1,69 @@
+2008-09-14  Guillem Jover  <guillem@debian.org>
+
+	* lib/Makefile.am (libdpkg_a_SOURCES): Add 'dpkg-i18n.h'.
+	* lib/dpkg.h: Move <gettext.h> inclusion and ...
+	(_, N_): ... macros to ...
+	* lib/dpkg-i18n.h: ... here. New file.
+	* dpkg-deb/build.c: Include <dpkg-i18n.h>.
+	* dpkg-deb/extract.c: Likewise.
+	* dpkg-deb/info.c: Likewise.
+	* dpkg-deb/main.c: Likewise.
+	* dpkg-split/info.c: Likewise.
+	* dpkg-split/join.c: Likewise.
+	* dpkg-split/main.c: Likewise.
+	* dpkg-split/queue.c: Likewise.
+	* dpkg-split/split.c: Likewise.
+	* dselect/basecmds.cc: Likewise.
+	* dselect/baselist.cc: Likewise.
+	* dselect/bindings.cc: Likewise.
+	* dselect/helpmsgs.cc: Likewise.
+	* dselect/main.cc: Likewise.
+	* dselect/methlist.cc: Likewise.
+	* dselect/method.cc: Likewise.
+	* dselect/methparse.cc: Likewise.
+	* dselect/pkgdisplay.cc: Likewise.
+	* dselect/pkginfo.cc: Likewise.
+	* dselect/pkglist.cc: Likewise.
+	* dselect/pkgsublist.cc: Likewise.
+	* dselect/pkgtop.cc: Likewise.
+	* lib/compression.c: Likewise.
+	* lib/database.c: Likewise.
+	* lib/dbmodify.c: Likewise.
+	* lib/dump.c: Likewise.
+	* lib/ehandle.c: Likewise.
+	* lib/fields.c: Likewise.
+	* lib/lock.c: Likewise.
+	* lib/log.c: Likewise.
+	* lib/mlib.c: Likewise.
+	* lib/myopt-util.c: Likewise.
+	* lib/myopt.c: Likewise.
+	* lib/nfmalloc.c: Likewise.
+	* lib/parse.c: Likewise.
+	* lib/parsehelp.c: Likewise.
+	* lib/showpkg.c: Likewise.
+	* lib/subproc.c: Likewise.
+	* lib/trigdeferred.l: Likewise.
+	* lib/triglib.c: Likewise.
+	* lib/utils.c: Likewise.
+	* src/archives.c: Likewise.
+	* src/cleanup.c: Likewise.
+	* src/configure.c: Likewise.
+	* src/depcon.c: Likewise.
+	* src/enquiry.c: Likewise.
+	* src/errors.c: Likewise.
+	* src/filesdb.c: Likewise.
+	* src/help.c: Likewise.
+	* src/main.c: Likewise.
+	* src/packages.c: Likewise.
+	* src/pkg-show.c: Likewise.
+	* src/processarc.c: Likewise.
+	* src/query.c: Likewise.
+	* src/remove.c: Likewise.
+	* src/select.c: Likewise.
+	* src/trigcmd.c: Likewise.
+	* src/trigproc.c: Likewise.
+	* src/update.c: Likewise
+
 2008-09-14  Guillem Jover  <guillem@debian.org>
 
 	* dselect/baselist.cc (baselist::startdisplay): Unmark debug message

+ 2 - 0
dpkg-deb/build.c

@@ -22,6 +22,8 @@
 
 #include <config.h>
 
+#include <dpkg-i18n.h>
+
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>

+ 2 - 0
dpkg-deb/extract.c

@@ -20,6 +20,8 @@
  */
 #include <config.h>
 
+#include <dpkg-i18n.h>
+
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>

+ 2 - 0
dpkg-deb/info.c

@@ -21,6 +21,8 @@
  */
 #include <config.h>
 
+#include <dpkg-i18n.h>
+
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>

+ 2 - 0
dpkg-deb/main.c

@@ -20,6 +20,8 @@
  */
 #include <config.h>
 
+#include <dpkg-i18n.h>
+
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>

+ 2 - 0
dpkg-split/info.c

@@ -20,6 +20,8 @@
  */
 #include <config.h>
 
+#include <dpkg-i18n.h>
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <limits.h>

+ 2 - 0
dpkg-split/join.c

@@ -20,6 +20,8 @@
  */
 #include <config.h>
 
+#include <dpkg-i18n.h>
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <limits.h>

+ 2 - 0
dpkg-split/main.c

@@ -20,6 +20,8 @@
  */
 #include <config.h>
 
+#include <dpkg-i18n.h>
+
 #include <string.h>
 #include <stdio.h>
 #include <stdlib.h>

+ 2 - 0
dpkg-split/queue.c

@@ -29,6 +29,8 @@
  */
 #include <config.h>
 
+#include <dpkg-i18n.h>
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <limits.h>

+ 2 - 0
dpkg-split/split.c

@@ -20,6 +20,8 @@
  */
 #include <config.h>
 
+#include <dpkg-i18n.h>
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <limits.h>

+ 2 - 0
dselect/basecmds.cc

@@ -22,6 +22,8 @@
 
 #include <config.h>
 
+#include <dpkg-i18n.h>
+
 #include <stdio.h>
 #include <string.h>
 #include <assert.h>

+ 2 - 0
dselect/baselist.cc

@@ -22,6 +22,8 @@
 
 #include <config.h>
 
+#include <dpkg-i18n.h>
+
 #include <stdio.h>
 #include <string.h>
 #include <assert.h>

+ 2 - 0
dselect/bindings.cc

@@ -21,6 +21,8 @@
 
 #include <config.h>
 
+#include <dpkg-i18n.h>
+
 #include <stdio.h>
 #include <string.h>
 #include <assert.h>

+ 2 - 0
dselect/helpmsgs.cc

@@ -21,6 +21,8 @@
 
 #include <config.h>
 
+#include <dpkg-i18n.h>
+
 #include "helpmsgs.h"
 
 const struct helpmessage hlp_listkeys = {

+ 2 - 0
dselect/main.cc

@@ -22,6 +22,8 @@
 
 #include <config.h>
 
+#include <dpkg-i18n.h>
+
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>

+ 2 - 0
dselect/methlist.cc

@@ -22,6 +22,8 @@
 
 #include <config.h>
 
+#include <dpkg-i18n.h>
+
 #include <stdio.h>
 #include <string.h>
 #include <assert.h>

+ 2 - 0
dselect/method.cc

@@ -22,6 +22,8 @@
 
 #include <config.h>
 
+#include <dpkg-i18n.h>
+
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>

+ 2 - 0
dselect/methparse.cc

@@ -21,6 +21,8 @@
 
 #include <config.h>
 
+#include <dpkg-i18n.h>
+
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>

+ 2 - 0
dselect/pkgdisplay.cc

@@ -21,6 +21,8 @@
 
 #include <config.h>
 
+#include <dpkg-i18n.h>
+
 #include <stdio.h>
 #include <string.h>
 #include <assert.h>

+ 2 - 0
dselect/pkginfo.cc

@@ -21,6 +21,8 @@
 
 #include <config.h>
 
+#include <dpkg-i18n.h>
+
 #include <stdio.h>
 #include <string.h>
 #include <assert.h>

+ 2 - 0
dselect/pkglist.cc

@@ -22,6 +22,8 @@
 
 #include <config.h>
 
+#include <dpkg-i18n.h>
+
 #include <stdio.h>
 #include <string.h>
 #include <assert.h>

+ 2 - 0
dselect/pkgsublist.cc

@@ -21,6 +21,8 @@
 
 #include <config.h>
 
+#include <dpkg-i18n.h>
+
 #include <stdio.h>
 #include <string.h>
 #include <assert.h>

+ 2 - 0
dselect/pkgtop.cc

@@ -21,6 +21,8 @@
 
 #include <config.h>
 
+#include <dpkg-i18n.h>
+
 #include <stdio.h>
 #include <string.h>
 #include <assert.h>

+ 1 - 0
lib/Makefile.am

@@ -14,6 +14,7 @@ noinst_LIBRARIES = libdpkg.a
 libdpkg_a_SOURCES = \
 	dpkg-def.h \
 	dpkg.h \
+	dpkg-i18n.h \
 	dpkg-db.h \
 	dpkg-priv.h \
 	dlist.h \

+ 3 - 0
lib/compat.c

@@ -32,6 +32,9 @@
 #include <unistd.h>
 
 #include <dpkg.h>
+#include <gettext.h>
+
+#define _(str) gettext(str)
 
 #ifndef HAVE_VSNPRINTF
 int vsnprintf (char *buf, size_t maxsize, const char *fmt, va_list al) {

+ 2 - 0
lib/compression.c

@@ -1,5 +1,7 @@
 #include <config.h>
 
+#include <dpkg-i18n.h>
+
 #include <stdlib.h>
 #include <unistd.h>
 #include <string.h>

+ 2 - 0
lib/database.c

@@ -20,6 +20,8 @@
  */
 #include <config.h>
 
+#include <dpkg-i18n.h>
+
 #include <ctype.h>
 #include <string.h>
 

+ 2 - 0
lib/dbmodify.c

@@ -21,6 +21,8 @@
  */
 #include <config.h>
 
+#include <dpkg-i18n.h>
+
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>

+ 36 - 0
lib/dpkg-i18n.h

@@ -0,0 +1,36 @@
+/*
+ * libdpkg - Debian packaging suite library routines
+ * dpkg-i18n.h - private i18n support
+ *
+ * Copyright © 2008 Guillem Jover <guillem@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,
+ * 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 dpkg; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef DPKG_I18N_H
+#define DPKG_I18N_H
+
+#include <dpkg-def.h>
+
+DPKG_BEGIN_DECLS
+
+#include <gettext.h>
+
+#define _(str) gettext(str)
+#define N_(str) gettext_noop(str)
+
+DPKG_END_DECLS
+
+#endif /* DPKG_I18N_H */

+ 0 - 5
lib/dpkg.h

@@ -453,15 +453,10 @@ void unsetenv(const char *x);
 
 /* Take care of NLS matters.  */
 
-#include <gettext.h>
 #if HAVE_LOCALE_H
 # include <locale.h>
 #endif
 
-/* Make gettext a little friendlier */
-#define _(String) gettext (String)
-#define N_(String) gettext_noop (String)
-
 DPKG_END_DECLS
 
 #endif /* DPKG_H */

+ 2 - 0
lib/dump.c

@@ -23,6 +23,8 @@
 /* FIXME: don't write uninteresting packages */
 #include <config.h>
 
+#include <dpkg-i18n.h>
+
 #include <stdio.h>
 #include <string.h>
 #include <errno.h>

+ 2 - 0
lib/ehandle.c

@@ -20,6 +20,8 @@
  */
 #include <config.h>
 
+#include <dpkg-i18n.h>
+
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>

+ 2 - 0
lib/fields.c

@@ -21,6 +21,8 @@
  */
 #include <config.h>
 
+#include <dpkg-i18n.h>
+
 #include <stdio.h>
 #include <ctype.h>
 #include <string.h>

+ 2 - 0
lib/lock.c

@@ -20,6 +20,8 @@
  */
 #include <config.h>
 
+#include <dpkg-i18n.h>
+
 #include <unistd.h>
 #include <stdlib.h>
 #include <string.h>

+ 2 - 0
lib/log.c

@@ -21,6 +21,8 @@
 
 #include <config.h>
 
+#include <dpkg-i18n.h>
+
 #include <assert.h>
 #include <stdarg.h>
 #include <stdio.h>

+ 2 - 0
lib/mlib.c

@@ -21,6 +21,8 @@
 
 #include <config.h>
 
+#include <dpkg-i18n.h>
+
 #include <unistd.h>
 #include <stdio.h>
 #include <stdlib.h>

+ 2 - 0
lib/myopt-util.c

@@ -20,6 +20,8 @@
  */
 #include <config.h>
 
+#include <dpkg-i18n.h>
+
 #include <stdlib.h>
 #include <unistd.h>
 #include <fcntl.h>

+ 2 - 0
lib/myopt.c

@@ -21,6 +21,8 @@
  */
 #include <config.h>
 
+#include <dpkg-i18n.h>
+
 #include <string.h>
 #include <errno.h>
 #include <ctype.h>

+ 2 - 0
lib/nfmalloc.c

@@ -20,6 +20,8 @@
  */
 #include <config.h>
 
+#include <dpkg-i18n.h>
+
 #include <stdlib.h>
 #include <string.h>
 

+ 2 - 0
lib/parse.c

@@ -20,6 +20,8 @@
  */
 #include <config.h>
 
+#include <dpkg-i18n.h>
+
 #include <stdio.h>
 #include <string.h>
 #include <ctype.h>

+ 2 - 0
lib/parsehelp.c

@@ -20,6 +20,8 @@
  */
 #include <config.h>
 
+#include <dpkg-i18n.h>
+
 #include <stdio.h>
 #include <ctype.h>
 #include <string.h>

+ 2 - 0
lib/showpkg.c

@@ -19,6 +19,8 @@
  */
 #include <config.h>
 
+#include <dpkg-i18n.h>
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>

+ 2 - 0
lib/subproc.c

@@ -21,6 +21,8 @@
 
 #include <config.h>
 
+#include <dpkg-i18n.h>
+
 #include <errno.h>
 #include <stdio.h>
 #include <string.h>

+ 2 - 0
lib/trigdeferred.l

@@ -37,6 +37,8 @@
 
 #include <config.h>
 
+#include <dpkg-i18n.h>
+
 #include <sys/stat.h>
 #include <sys/fcntl.h>
 

+ 2 - 0
lib/triglib.c

@@ -22,6 +22,8 @@
 
 #include <config.h>
 
+#include <dpkg-i18n.h>
+
 #include <assert.h>
 #include <unistd.h>
 #include <errno.h>

+ 2 - 0
lib/utils.c

@@ -19,6 +19,8 @@
  */
 
 #include <config.h>
+
+#include <dpkg-i18n.h>
 #include <dpkg.h>
 #include <string.h>
 

+ 2 - 0
src/archives.c

@@ -21,6 +21,8 @@
  */
 #include <config.h>
 
+#include <dpkg-i18n.h>
+
 #include <errno.h>
 #include <stdio.h>
 #include <string.h>

+ 2 - 0
src/cleanup.c

@@ -20,6 +20,8 @@
  */
 #include <config.h>
 
+#include <dpkg-i18n.h>
+
 #include <errno.h>
 #include <stdio.h>
 #include <string.h>

+ 2 - 0
src/configure.c

@@ -21,6 +21,8 @@
  */
 #include <config.h>
 
+#include <dpkg-i18n.h>
+
 #include <errno.h>
 #include <signal.h>
 #include <stdio.h>

+ 2 - 0
src/depcon.c

@@ -20,6 +20,8 @@
  */
 #include <config.h>
 
+#include <dpkg-i18n.h>
+
 #include <errno.h>
 #include <unistd.h>
 #include <sys/stat.h>

+ 2 - 0
src/enquiry.c

@@ -22,6 +22,8 @@
 /* FIXME: per-package audit */
 #include <config.h>
 
+#include <dpkg-i18n.h>
+
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>

+ 2 - 0
src/errors.c

@@ -20,6 +20,8 @@
  */
 #include <config.h>
 
+#include <dpkg-i18n.h>
+
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>

+ 2 - 0
src/filesdb.c

@@ -21,6 +21,8 @@
  */
 #include <config.h>
 
+#include <dpkg-i18n.h>
+
 #include <assert.h>
 #include <unistd.h>
 #include <fcntl.h>

+ 2 - 0
src/help.c

@@ -20,6 +20,8 @@
  */
 #include <config.h>
 
+#include <dpkg-i18n.h>
+
 #include <errno.h>
 #include <unistd.h>
 #include <dirent.h>

+ 2 - 0
src/main.c

@@ -20,6 +20,8 @@
  */
 #include <config.h>
 
+#include <dpkg-i18n.h>
+
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>

+ 2 - 0
src/packages.c

@@ -20,6 +20,8 @@
  */
 #include <config.h>
 
+#include <dpkg-i18n.h>
+
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>

+ 2 - 0
src/pkg-show.c

@@ -21,6 +21,8 @@
 
 #include <config.h>
 
+#include <dpkg-i18n.h>
+
 #include <string.h>
 
 #include <dpkg.h>

+ 2 - 0
src/processarc.c

@@ -20,6 +20,8 @@
  */
 #include <config.h>
 
+#include <dpkg-i18n.h>
+
 #include <errno.h>
 #include <stdio.h>
 #include <string.h>

+ 2 - 0
src/query.c

@@ -21,6 +21,8 @@
  */
 #include <config.h>
 
+#include <dpkg-i18n.h>
+
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>

+ 2 - 0
src/remove.c

@@ -20,6 +20,8 @@
  */
 #include <config.h>
 
+#include <dpkg-i18n.h>
+
 #include <errno.h>
 #include <stdio.h>
 #include <string.h>

+ 2 - 0
src/select.c

@@ -20,6 +20,8 @@
  */
 #include <config.h>
 
+#include <dpkg-i18n.h>
+
 #include <stdio.h>
 #include <string.h>
 #include <assert.h>

+ 2 - 0
src/trigcmd.c

@@ -21,6 +21,8 @@
 
 #include <config.h>
 
+#include <dpkg-i18n.h>
+
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>

+ 2 - 0
src/trigproc.c

@@ -22,6 +22,8 @@
 
 #include <config.h>
 
+#include <dpkg-i18n.h>
+
 #include <assert.h>
 #include <sys/stat.h>
 #include <sys/fcntl.h>

+ 2 - 0
src/update.c

@@ -20,6 +20,8 @@
  */
 #include <config.h>
 
+#include <dpkg-i18n.h>
+
 #include <errno.h>
 #include <stdio.h>
 #include <string.h>