Refactoring BIO: Adapt s_client and s_server
[openssl.git] / apps / engine.c
index c7c0aafd75df5c1cb0db4220c814309e9f41edf1..c373df579c240f743a895c5759392524afa6f3db 100644 (file)
@@ -94,17 +94,12 @@ static void identity(char *ptr)
 
 static int append_buf(char **buf, const char *s, int *size, int step)
 {
-    int l = strlen(s);
-
     if (*buf == NULL) {
         *size = step;
         *buf = app_malloc(*size, "engine buffer");
         **buf = '\0';
     }
 
-    if (**buf != '\0')
-        l += 2;                 /* ", " */
-
     if (strlen(*buf) + strlen(s) >= (unsigned int)*size) {
         *size += step;
         *buf = OPENSSL_realloc(*buf, *size);
@@ -114,8 +109,8 @@ static int append_buf(char **buf, const char *s, int *size, int step)
         return 0;
 
     if (**buf != '\0')
-        BUF_strlcat(*buf, ", ", *size);
-    BUF_strlcat(*buf, s, *size);
+        OPENSSL_strlcat(*buf, ", ", *size);
+    OPENSSL_strlcat(*buf, s, *size);
 
     return 1;
 }
@@ -261,8 +256,7 @@ static int util_verbose(ENGINE *e, int verbose, BIO *out, const char *indent)
         BIO_printf(out, "\n");
     ret = 1;
  err:
-    if (cmds)
-        sk_OPENSSL_STRING_pop_free(cmds, identity);
+    sk_OPENSSL_STRING_pop_free(cmds, identity);
     OPENSSL_free(name);
     OPENSSL_free(desc);
     return ret;
@@ -320,7 +314,7 @@ int engine_main(int argc, char **argv)
     OPTION_CHOICE o;
     char *prog;
 
-    out = dup_bio_out();
+    out = dup_bio_out(FORMAT_TEXT);
     prog = opt_init(argc, argv, engine_options);
     if (!engines || !pre_cmds || !post_cmds)
         goto end;