[Pkg-shadow-commits] r1600 - in upstream/trunk: . src
nekral-guest at alioth.debian.org
nekral-guest at alioth.debian.org
Tue Jan 1 15:07:41 UTC 2008
Author: nekral-guest
Date: 2008-01-01 15:07:41 +0000 (Tue, 01 Jan 2008)
New Revision: 1600
Modified:
upstream/trunk/ChangeLog
upstream/trunk/src/pwck.c
Log:
Split process_flags() out of main(). New global variables is_shadow,
sort_mode.
Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog 2008-01-01 14:48:04 UTC (rev 1599)
+++ upstream/trunk/ChangeLog 2008-01-01 15:07:41 UTC (rev 1600)
@@ -1,5 +1,10 @@
2008-01-01 Nicolas François <nicolas.francois at centraliens.net>
+ * src/pwck.c: Split process_flags() out of main(). New global
+ variables is_shadow, sort_mode.
+
+2008-01-01 Nicolas François <nicolas.francois at centraliens.net>
+
* libmisc/xgetXXbyYY.c: De-comment code (duplicate the entry when
the _R function is not present on the system).
Modified: upstream/trunk/src/pwck.c
===================================================================
--- upstream/trunk/src/pwck.c 2008-01-01 14:48:04 UTC (rev 1599)
+++ upstream/trunk/src/pwck.c 2008-01-01 15:07:41 UTC (rev 1600)
@@ -66,13 +66,18 @@
static char *Prog;
static const char *pwd_file = PASSWD_FILE;
+static const char *spw_file = SHADOW_FILE;
-static const char *spw_file = SHADOW_FILE;
+static int is_shadow = 0;
+
+/* Options */
static int read_only = 0;
+static int sort_mode = 0;
static int quiet = 0; /* don't report warnings, only errors */
/* local function prototypes */
static void usage (void);
+static void process_flags (int argc, char **argv);
/*
* usage - print syntax message and exit
@@ -85,33 +90,15 @@
}
/*
- * pwck - verify password file integrity
+ * process_flags - parse the command line options
+ *
+ * It will not return if an error is encountered.
*/
-int main (int argc, char **argv)
+static void process_flags (int argc, char **argv)
{
int arg;
- int errors = 0;
- int changed = 0;
- struct commonio_entry *pfe, *tpfe;
- struct passwd *pwd;
- int sort_mode = 0;
- struct commonio_entry *spe, *tspe;
- struct spwd *spw;
- int is_shadow = 0;
-
/*
- * Get my name so that I can use it to report errors.
- */
- Prog = Basename (argv[0]);
-
- setlocale (LC_ALL, "");
- bindtextdomain (PACKAGE, LOCALEDIR);
- textdomain (PACKAGE);
-
- OPENLOG ("pwck");
-
- /*
* Parse the command line arguments
*/
while ((arg = getopt (argc, argv, "eqrs")) != EOF) {
@@ -156,8 +143,36 @@
is_shadow = 1;
} else if (optind == argc)
is_shadow = spw_file_present ();
+}
+/*
+ * pwck - verify password file integrity
+ */
+int main (int argc, char **argv)
+{
+ int errors = 0;
+ int changed = 0;
+ struct commonio_entry *pfe, *tpfe;
+ struct passwd *pwd;
+
+ struct commonio_entry *spe, *tspe;
+ struct spwd *spw;
+
/*
+ * Get my name so that I can use it to report errors.
+ */
+ Prog = Basename (argv[0]);
+
+ setlocale (LC_ALL, "");
+ bindtextdomain (PACKAGE, LOCALEDIR);
+ textdomain (PACKAGE);
+
+ OPENLOG ("pwck");
+
+ /* Parse the command line arguments */
+ process_flags (argc, argv);
+
+ /*
* Lock the files if we aren't in "read-only" mode
*/
if (!read_only) {
More information about the Pkg-shadow-commits
mailing list