apps: constify some string parameters
[openssl.git] / apps / pkcs7.c
index 6c58c67eb27927f146362d1c403b81b234fd6643..ae6cd33f738a81ab3adf6ed53b97adc59f80ab68 100644 (file)
@@ -82,15 +82,12 @@ int MAIN(int, char **);
 
 int MAIN(int argc, char **argv)
        {
-#ifndef OPENSSL_NO_ENGINE
-       ENGINE *e = NULL;
-#endif
        PKCS7 *p7=NULL;
        int i,badops=0;
        BIO *in=NULL,*out=NULL;
        int informat,outformat;
        char *infile,*outfile,*prog;
-       int print_certs=0,text=0,noout=0;
+       int print_certs=0,text=0,noout=0,p7_print=0;
        int ret=1;
 #ifndef OPENSSL_NO_ENGINE
        char *engine=NULL;
@@ -102,6 +99,9 @@ int MAIN(int argc, char **argv)
                if ((bio_err=BIO_new(BIO_s_file())) != NULL)
                        BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
 
+       if (!load_config(bio_err, NULL))
+               goto end;
+
        infile=NULL;
        outfile=NULL;
        informat=FORMAT_PEM;
@@ -136,6 +136,8 @@ int MAIN(int argc, char **argv)
                        noout=1;
                else if (strcmp(*argv,"-text") == 0)
                        text=1;
+               else if (strcmp(*argv,"-print") == 0)
+                       p7_print=1;
                else if (strcmp(*argv,"-print_certs") == 0)
                        print_certs=1;
 #ifndef OPENSSL_NO_ENGINE
@@ -177,7 +179,7 @@ bad:
        ERR_load_crypto_strings();
 
 #ifndef OPENSSL_NO_ENGINE
-        e = setup_engine(bio_err, engine, 0);
+        setup_engine(bio_err, engine, 0);
 #endif
 
        in=BIO_new(BIO_s_file());
@@ -235,6 +237,9 @@ bad:
                        }
                }
 
+       if (p7_print)
+               PKCS7_print_ctx(out, p7, 0, NULL);
+
        if (print_certs)
                {
                STACK_OF(X509) *certs=NULL;