pam: modules/pam_pwgen/pam_pwgen_app.c - parse args properly
baggins
baggins at pld-linux.org
Mon Feb 20 16:34:04 CET 2006
Author: baggins Date: Mon Feb 20 15:34:03 2006 GMT
Module: pam Tag: HEAD
---- Log message:
- parse args properly
---- Files affected:
pam/modules/pam_pwgen:
pam_pwgen_app.c (1.4 -> 1.5)
---- Diffs:
================================================================
Index: pam/modules/pam_pwgen/pam_pwgen_app.c
diff -u pam/modules/pam_pwgen/pam_pwgen_app.c:1.4 pam/modules/pam_pwgen/pam_pwgen_app.c:1.5
--- pam/modules/pam_pwgen/pam_pwgen_app.c:1.4 Mon Feb 20 15:09:37 2006
+++ pam/modules/pam_pwgen/pam_pwgen_app.c Mon Feb 20 16:33:58 2006
@@ -322,35 +322,36 @@
int genpw;
struct tris_data *tr;
struct stat st;
+ char **av = argv+1;
strcpy(tri_file, DEFAULT_TRIGRAM_FILE);
/* step through arguments */
- for (; --argc > 1; ++argv) {
+ for (; *av; ++av) {
char *ep = NULL;
/* generic options */
- if (!strncmp(*argv, "minlen=", 7)) {
- min_length = strtol(*argv + 7, &ep, 10);
+ if (!strncmp(*av, "minlen=", 7)) {
+ min_length = strtol(*av + 7, &ep, 10);
if (!ep || (min_length < 5))
min_length = 5;
if (min_length > 64)
min_length = 64;
- } else if (!strncmp(*argv, "count=", 6)) {
- pw_count = strtol(*argv + 6, &ep, 10);
+ } else if (!strncmp(*av, "count=", 6)) {
+ pw_count = strtol(*av + 6, &ep, 10);
if (!ep || (pw_count < 5))
pw_count = 5;
if (pw_count > 100)
pw_count = 100;
- } else if (!strncmp(*argv, "trifile=", 7)) {
- strncpy(tri_file, *argv + 7, 128);
- } else if (!strncmp(*argv, "upper=", 6)) {
- upper = strtol(*argv + 6, &ep, 10);
+ } else if (!strncmp(*av, "trifile=", 7)) {
+ strncpy(tri_file, *av + 7, 128);
+ } else if (!strncmp(*av, "upper=", 6)) {
+ upper = strtol(*av + 6, &ep, 10);
if (!ep || (upper < 0))
upper = 0;
- } else if (!strncmp(*argv, "digit=", 6)) {
- digit = strtol(*argv + 6, &ep, 10);
+ } else if (!strncmp(*av, "digit=", 6)) {
+ digit = strtol(*av + 6, &ep, 10);
if (!ep || (digit < 0))
digit = 0;
} else {
================================================================
---- CVS-web:
http://cvs.pld-linux.org/pam/modules/pam_pwgen/pam_pwgen_app.c?r1=1.4&r2=1.5&f=u
More information about the pld-cvs-commit
mailing list