diff options
Diffstat (limited to 'apps/srp.c')
-rw-r--r-- | apps/srp.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/apps/srp.c b/apps/srp.c index c5002188a5..ceb0640c2f 100644 --- a/apps/srp.c +++ b/apps/srp.c @@ -297,11 +297,12 @@ int srp_main(int argc, char **argv) "Exactly one of the options -add, -delete, -modify -list must be specified.\n"); goto opthelp; } - if ((mode == OPT_DELETE || mode == OPT_MODIFY || mode == OPT_ADD) - && argc < 1) { - BIO_printf(bio_err, - "Need at least one user for options -add, -delete, -modify. \n"); - goto opthelp; + if (mode == OPT_DELETE || mode == OPT_MODIFY || mode == OPT_ADD) { + if (argc == 0) { + BIO_printf(bio_err, "Need at least one user.\n"); + goto opthelp; + } + user = *argv++; } if ((passinarg != NULL || passoutarg != NULL) && argc != 1) { BIO_printf(bio_err, @@ -390,10 +391,7 @@ int srp_main(int argc, char **argv) if (verbose > 1) BIO_printf(bio_err, "Starting user processing\n"); - if (argc > 0) - user = *(argv++); - - while (mode == OPT_LIST || user) { + while (mode == OPT_LIST || user != NULL) { int userindex = -1; if (user != NULL && verbose > 1) @@ -554,9 +552,8 @@ int srp_main(int argc, char **argv) doupdatedb = 1; } } - if (--argc > 0) { - user = *(argv++); - } else { + user = *argv++; + if (user == NULL) { /* no more processing in any mode if no users left */ break; } |