break;
}
}
+ if (opt_num_rest() != 0) {
+ BIO_printf(bio_err, "Extra arguments given.\n");
+ goto opthelp;
+ }
if (cipher && EVP_CIPHER_flags(cipher) & EVP_CIPH_FLAG_AEAD_CIPHER) {
BIO_printf(bio_err, "%s: AEAD ciphers not supported\n", prog);
switch (o) {
case OPT_EOF:
case OPT_ERR:
+opthelp:
BIO_printf(bio_err, "%s: Use -help for summary.\n", prog);
goto end;
case OPT_HELP:
}
argc = opt_num_rest();
argv = opt_rest();
- private = 1;
- if (argv[0] && (!opt_int(argv[0], &num) || num <= 0))
- goto end;
+ if (argc == 1) {
+ if (!opt_int(argv[0], &num) || num <= 0)
+ goto end;
+ } else if (argc > 0) {
+ BIO_printf(bio_err, "Extra arguments given.\n");
+ goto opthelp;
+ }
+ private = 1;
if (!app_passwd(NULL, passoutarg, NULL, &passout)) {
BIO_printf(bio_err, "Error getting password\n");
goto end;
switch (o) {
case OPT_EOF: /* Never hit, but suppresses warning */
case OPT_ERR:
+opthelp:
BIO_printf(bio_err, "%s: Use -help for summary.\n", prog);
return 1;
case OPT_HELP:
}
done = 1;
}
-
- if (!done) {
- BIO_printf(bio_err, "%s: Use -help for summary.\n", prog);
- return 1;
+ if (opt_num_rest() != 0) {
+ BIO_printf(bio_err, "Extra arguments given.\n");
+ goto opthelp;
}
+ if (!done)
+ goto opthelp;
+
return 0;
}
switch (o) {
case OPT_EOF:
case OPT_ERR:
+opthelp:
BIO_printf(bio_err, "%s: Use -help for summary.\n", prog);
goto end;
case OPT_HELP:
argc = opt_num_rest();
argv = opt_rest();
- if (argc == 0 && !generate) {
+ if (generate) {
+ if (argc != 0) {
+ BIO_printf(bio_err, "Extra arguments given.\n");
+ goto opthelp;
+ }
+ } else if (argc == 0) {
BIO_printf(bio_err, "%s: No prime specified\n", prog);
- goto end;
+ goto opthelp;
}
if (generate) {
}
argc = opt_num_rest();
argv = opt_rest();
-
- if (argc != 1 || !opt_int(argv[0], &num) || num < 0)
+ if (argc == 1) {
+ if (!opt_int(argv[0], &num) || num <= 0)
+ goto end;
+ } else if (argc > 0) {
+ BIO_printf(bio_err, "Extra arguments given.\n");
goto opthelp;
+ }
out = bio_open_default(outfile, 'w', format);
if (out == NULL)
"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,
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)
doupdatedb = 1;
}
}
- if (--argc > 0) {
- user = *(argv++);
- } else {
+ user = *argv++;
+ if (user == NULL) {
/* no more processing in any mode if no users left */
break;
}
switch (o) {
case OPT_EOF:
case OPT_ERR:
+opthelp:
BIO_printf(bio_err, "%s: Use -help for summary.\n", prog);
goto end;
case OPT_HELP:
break;
}
}
+ if (opt_num_rest() != 0) {
+ BIO_printf(bio_err, "Extra parameters given.\n");
+ goto opthelp;
+ }
if (!dirty)
version = 1;