Browse Source

dpkg-trigger: Move functions and variables around

Place cmdinfos just before main, and the variables and noawait function
definitions after usage.
Guillem Jover 17 years ago
parent
commit
00c6f6094e
1 changed files with 25 additions and 24 deletions
  1. 25 24
      src/trigcmd.c

+ 25 - 24
src/trigcmd.c

@@ -43,30 +43,6 @@
 #include <dpkg/dpkg-db.h>
 #include <dpkg/myopt.h>
 
-static const char *bypackage, *activate, *admindir = ADMINDIR;
-static int f_noact, f_check;
-
-static void
-noawait(const struct cmdinfo *ci, const char *value)
-{
-	bypackage = "-";
-}
-
-static const struct cmdinfo cmdinfos[] = {
-	{ "admindir",        0,   1, NULL,     &admindir },
-	{ "by-package",      'f', 1, NULL,     &bypackage },
-	{ "no-await",        0,   0, NULL,     &bypackage, noawait },
-	{ "no-act",          0,   0, &f_noact, NULL,       NULL, 1 },
-	{ "check-supported", 0,   0, &f_check, NULL,       NULL, 1 },
-	{ "help",            'h', 0, NULL,     NULL,       helponly },
-	{ "version",         0,   0, NULL,     NULL,       versiononly },
-	/* UK spelling */
-	{ "licence",         0,   0, NULL,     NULL,       showcopyright },
-	/* US spelling */
-	{ "license",         0,   0, NULL,     NULL,       showcopyright },
-	{  NULL  }
-};
-
 const char thisname[] = "dpkg-trigger";
 
 const char printforhelp[] = N_(
@@ -116,8 +92,18 @@ usage(void)
 	m_output(stdout, _("<standard output>"));
 }
 
+static const char *admindir = ADMINDIR;
+static int f_noact, f_check;
+
+static const char *bypackage, *activate;
 static int done_trig, ctrig;
 
+static void
+noawait(const struct cmdinfo *ci, const char *value)
+{
+	bypackage = "-";
+}
+
 static void
 yespackage(const char *awname)
 {
@@ -178,6 +164,21 @@ do_check(void)
 	}
 }
 
+static const struct cmdinfo cmdinfos[] = {
+	{ "admindir",        0,   1, NULL,     &admindir },
+	{ "by-package",      'f', 1, NULL,     &bypackage },
+	{ "no-await",        0,   0, NULL,     &bypackage, noawait },
+	{ "no-act",          0,   0, &f_noact, NULL,       NULL, 1 },
+	{ "check-supported", 0,   0, &f_check, NULL,       NULL, 1 },
+	{ "help",            'h', 0, NULL,     NULL,       helponly },
+	{ "version",         0,   0, NULL,     NULL,       versiononly },
+	/* UK spelling */
+	{ "licence",         0,   0, NULL,     NULL,       showcopyright },
+	/* US spelling */
+	{ "license",         0,   0, NULL,     NULL,       showcopyright },
+	{  NULL  }
+};
+
 int
 main(int argc, const char *const *argv)
 {