- if (badops)
- {
-bad:
- BIO_printf(bio_err,"%s [options]\n",prog);
- BIO_printf(bio_err,"where options are\n");
- BIO_printf(bio_err," -in arg input file\n");
- BIO_printf(bio_err," -out arg output file\n");
- BIO_printf(bio_err," -key arg create SPKAC using private key\n");
- BIO_printf(bio_err," -passin arg input file pass phrase source\n");
- BIO_printf(bio_err," -challenge arg challenge string\n");
- BIO_printf(bio_err," -spkac arg alternative SPKAC name\n");
- BIO_printf(bio_err," -noout don't print SPKAC\n");
- BIO_printf(bio_err," -pubkey output public key\n");
- BIO_printf(bio_err," -verify verify SPKAC signature\n");
- goto end;
- }
+ prog = argv[0];
+ argc--;
+ argv++;
+ while (argc >= 1) {
+ if (strcmp(*argv, "-in") == 0) {
+ if (--argc < 1)
+ goto bad;
+ infile = *(++argv);
+ } else if (strcmp(*argv, "-out") == 0) {
+ if (--argc < 1)
+ goto bad;
+ outfile = *(++argv);
+ } else if (strcmp(*argv, "-passin") == 0) {
+ if (--argc < 1)
+ goto bad;
+ passargin = *(++argv);
+ } else if (strcmp(*argv, "-key") == 0) {
+ if (--argc < 1)
+ goto bad;
+ keyfile = *(++argv);
+ } else if (strcmp(*argv, "-challenge") == 0) {
+ if (--argc < 1)
+ goto bad;
+ challenge = *(++argv);
+ } else if (strcmp(*argv, "-spkac") == 0) {
+ if (--argc < 1)
+ goto bad;
+ spkac = *(++argv);
+ } else if (strcmp(*argv, "-spksect") == 0) {
+ if (--argc < 1)
+ goto bad;
+ spksect = *(++argv);
+ }
+#ifndef OPENSSL_NO_ENGINE
+ else if (strcmp(*argv, "-engine") == 0) {
+ if (--argc < 1)
+ goto bad;
+ engine = *(++argv);
+ }
+#endif
+ else if (strcmp(*argv, "-noout") == 0)
+ noout = 1;
+ else if (strcmp(*argv, "-pubkey") == 0)
+ pubkey = 1;
+ else if (strcmp(*argv, "-verify") == 0)
+ verify = 1;
+ else
+ badops = 1;
+ argc--;
+ argv++;
+ }
+
+ if (badops) {
+ bad:
+ BIO_printf(bio_err, "%s [options]\n", prog);
+ BIO_printf(bio_err, "where options are\n");
+ BIO_printf(bio_err, " -in arg input file\n");
+ BIO_printf(bio_err, " -out arg output file\n");
+ BIO_printf(bio_err,
+ " -key arg create SPKAC using private key\n");
+ BIO_printf(bio_err,
+ " -passin arg input file pass phrase source\n");
+ BIO_printf(bio_err, " -challenge arg challenge string\n");
+ BIO_printf(bio_err, " -spkac arg alternative SPKAC name\n");
+ BIO_printf(bio_err, " -noout don't print SPKAC\n");
+ BIO_printf(bio_err, " -pubkey output public key\n");
+ BIO_printf(bio_err, " -verify verify SPKAC signature\n");
+#ifndef OPENSSL_NO_ENGINE
+ BIO_printf(bio_err,
+ " -engine e use engine e, possibly a hardware device.\n");
+#endif
+ goto end;
+ }