aboutsummaryrefslogtreecommitdiff
path: root/src/wydawca.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/wydawca.c')
-rw-r--r--src/wydawca.c47
1 files changed, 45 insertions, 2 deletions
diff --git a/src/wydawca.c b/src/wydawca.c
index 26b240d..8dd7c98 100644
--- a/src/wydawca.c
+++ b/src/wydawca.c
@@ -243,6 +243,46 @@ gconf_print_diag (gconf_locus_t *locus, int err, int errcode, const char *msg)
}
}
+
+static int uidc;
+static char **uidv;
+
+static int
+collect_uids (int argc, char **argv)
+{
+ int i;
+
+ uidc = argc;
+ uidv = xcalloc (uidc, sizeof (uidv[0]));
+ for (i = 0; i < argc; i++)
+ {
+ struct passwd *pw = getpwnam (argv[i]);
+ if (!pw)
+ {
+ char *p;
+ unsigned n = strtoul (argv[i], &p, 10);
+ if (*p)
+ error (1, 0, "no such user: %s", argv[i]);
+ uidv[i] = n;
+ }
+ else
+ uidv[i] = pw->pw_uid;
+ }
+}
+
+int
+match_uid (uid_t uid)
+{
+ int i;
+ if (!uidv)
+ return 1;
+ for (i = 0; i < uidc; i++)
+ if (uidv[i] == uid)
+ return 1;
+ return 0;
+}
+
+
#include "cmdline.h"
int
@@ -254,8 +294,11 @@ main (int argc, char **argv)
parse_options (argc, argv);
- if (argc != optind)
- error (1, 0, "extra command line arguments");
+ argv += optind;
+ argc -= optind;
+
+ if (argc)
+ collect_uids (argc, argv);
if (preprocess_only)
exit (gconf_preproc_run (conffile, gconf_preprocessor));

Return to:

Send suggestions and report system problems to the System administrator.