Przeglądaj źródła

libdpkg: Move myopt from standard_startup to each program main

Guillem Jover 18 lat temu
rodzic
commit
405accb785
13 zmienionych plików z 39 dodań i 9 usunięć
  1. 17 0
      ChangeLog
  2. 1 0
      dpkg-deb/build.c
  3. 3 1
      dpkg-deb/main.c
  4. 1 0
      dpkg-split/info.c
  5. 1 0
      dpkg-split/join.c
  6. 3 1
      dpkg-split/main.c
  7. 1 0
      dpkg-split/queue.c
  8. 1 4
      lib/dpkg.h
  9. 1 0
      lib/myopt-util.c
  10. 3 1
      src/main.c
  11. 3 1
      src/query.c
  12. 1 0
      src/select.c
  13. 3 1
      src/trigcmd.c

+ 17 - 0
ChangeLog

@@ -1,3 +1,20 @@
+2008-09-14  Guillem Jover  <guillem@debian.org>
+
+	* lib/dpkg.h: Do not include <myopt.h>.
+	(standard_startup): Do not take argc and argv as arguments, and do
+	not call myopt. Fix all callers.
+	* lib/myopt-util.c: Include <myopt.h>.
+	* dpkg-deb/build.c: Likewise.
+	* dpkg-split/info.c: Likewise.
+	* dpkg-split/join.c: Likewise.
+	* dpkg-split/queue.c: Likewise.
+	* src/select.c: Likewise.
+	* dpkg-deb/main.c (main): Call myopt directly.
+	* dpkg-split/main.c: Likewise.
+	* src/main.c: Likewise.
+	* src/query.c: Likewise.
+	* src/trigcmd.c: Likewise.
+
 2008-09-14  Guillem Jover  <guillem@debian.org>
 
 	* lib/dpkg.h (standard_shutdown): Remove unused freemem argument,

+ 1 - 0
dpkg-deb/build.c

@@ -24,6 +24,7 @@
 #include <compat.h>
 
 #include <dpkg-i18n.h>
+#include <myopt.h>
 
 #include <stdio.h>
 #include <string.h>

+ 3 - 1
dpkg-deb/main.c

@@ -207,7 +207,9 @@ int main(int argc, const char *const *argv) {
   bindtextdomain(PACKAGE, LOCALEDIR);
   textdomain(PACKAGE);
 
-  standard_startup(&ejbuf, argc, &argv, NULL, NULL, cmdinfos);
+  standard_startup(&ejbuf, NULL, NULL, cmdinfos);
+  myopt(&argv, cmdinfos);
+
   if (!cipaction) badusage(_("need an action option"));
 
   unsetenv("GZIP");

+ 1 - 0
dpkg-split/info.c

@@ -22,6 +22,7 @@
 #include <compat.h>
 
 #include <dpkg-i18n.h>
+#include <myopt.h>
 
 #include <stdio.h>
 #include <stdlib.h>

+ 1 - 0
dpkg-split/join.c

@@ -22,6 +22,7 @@
 #include <compat.h>
 
 #include <dpkg-i18n.h>
+#include <myopt.h>
 
 #include <stdio.h>
 #include <stdlib.h>

+ 3 - 1
dpkg-split/main.c

@@ -173,7 +173,9 @@ int main(int argc, const char *const *argv) {
   bindtextdomain(PACKAGE, LOCALEDIR);
   textdomain(PACKAGE);
 
-  standard_startup(&ejbuf, argc, &argv, NULL, 0, cmdinfos);
+  standard_startup(&ejbuf, NULL, 0, cmdinfos);
+  myopt(&argv, cmdinfos);
+
   if (!cipaction) badusage(_("need an action option"));
 
   l= strlen(depotdir);

+ 1 - 0
dpkg-split/queue.c

@@ -31,6 +31,7 @@
 #include <compat.h>
 
 #include <dpkg-i18n.h>
+#include <myopt.h>
 
 #include <stdio.h>
 #include <stdlib.h>

+ 1 - 4
lib/dpkg.h

@@ -32,8 +32,6 @@ DPKG_BEGIN_DECLS
 #include <stdio.h>
 #include <sys/types.h>
 
-#include <myopt.h>
-
 #ifdef HAVE_SYS_CDEFS_H
 #include <sys/cdefs.h>
 #endif
@@ -154,7 +152,7 @@ extern const char printforhelp[];
 
 /*** from startup.c ***/
 
-#define standard_startup(ejbuf, argc, argv, prog, loadcfg, cmdinfos) do {\
+#define standard_startup(ejbuf, prog, loadcfg, cmdinfos) do {\
   if (setjmp(*ejbuf)) { /* expect warning about possible clobbering of argv */\
     error_unwind(ehflag_bombout); exit(2);\
   }\
@@ -162,7 +160,6 @@ extern const char printforhelp[];
   umask(022); /* Make sure all our status databases are readable. */\
   if (loadcfg)\
     loadcfgfile(prog, cmdinfos);\
-  myopt(argv,cmdinfos);\
 } while (0)
 
 #define standard_shutdown() do { \

+ 1 - 0
lib/myopt-util.c

@@ -22,6 +22,7 @@
 #include <compat.h>
 
 #include <dpkg-i18n.h>
+#include <myopt.h>
 
 #include <stdlib.h>
 #include <unistd.h>

+ 3 - 1
src/main.c

@@ -632,7 +632,9 @@ int main(int argc, const char *const *argv) {
   bindtextdomain(PACKAGE, LOCALEDIR);
   textdomain(PACKAGE);
 
-  standard_startup(&ejbuf, argc, &argv, DPKG, 1, cmdinfos);
+  standard_startup(&ejbuf, DPKG, 1, cmdinfos);
+  myopt(&argv, cmdinfos);
+
   if (!cipaction) badusage(_("need an action option"));
 
   if (!f_triggers)

+ 3 - 1
src/query.c

@@ -564,7 +564,9 @@ int main(int argc, const char *const *argv) {
   bindtextdomain(PACKAGE, LOCALEDIR);
   textdomain(PACKAGE);
 
-  standard_startup(&ejbuf, argc, &argv, NULL, 0, cmdinfos);
+  standard_startup(&ejbuf, NULL, 0, cmdinfos);
+  myopt(&argv, cmdinfos);
+
   if (!cipaction) badusage(_("need an action option"));
 
   setvbuf(stdout, NULL, _IONBF, 0);

+ 1 - 0
src/select.c

@@ -22,6 +22,7 @@
 #include <compat.h>
 
 #include <dpkg-i18n.h>
+#include <myopt.h>
 
 #include <stdio.h>
 #include <stdlib.h>

+ 3 - 1
src/trigcmd.c

@@ -193,7 +193,9 @@ main(int argc, const char *const *argv)
 	bindtextdomain(PACKAGE, LOCALEDIR);
 	textdomain(PACKAGE);
 
-	standard_startup(&ejbuf, argc, &argv, NULL, 0, cmdinfos);
+	standard_startup(&ejbuf, NULL, 0, cmdinfos);
+	myopt(&argv, cmdinfos);
+
 	setvbuf(stdout, NULL, _IONBF, 0);
 
 	if (f_check) {