Change output text (ar is not a linker).
[openssl.git] / crypto / bio / b_dump.c
index 287aff2a5e6710b703d5306477455e3a5c3385a3..f5aeb237f502bf2bf5cbec36422f4dbb32ec93ee 100644 (file)
@@ -1,5 +1,5 @@
 /* crypto/bio/b_dump.c */
-/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
+/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
  * All rights reserved.
  *
  * This package is an SSL implementation written
 
 #include <stdio.h>
 #include "cryptlib.h"
-#include "bio.h"
+#include <openssl/bio.h>
 
 #define TRUNCATE
 #define DUMP_WIDTH     16
 
-int BIO_dump(bio,s,len)
-BIO *bio;
-char *s;
-int len;
+int BIO_dump(BIO *bio, const char *s, int len)
 {
   int ret=0;
   char buf[160+1],tmp[20];
@@ -95,7 +92,7 @@ int len;
       if (((i*DUMP_WIDTH)+j)>=len) {
        strcat(buf,"   ");
       } else {
-        ch=((unsigned char)*((char *)(s)+i*DUMP_WIDTH+j)) & 0xff;
+        ch=((unsigned char)*(s+i*DUMP_WIDTH+j)) & 0xff;
        sprintf(tmp,"%02x%c",ch,j==7?'-':' ');
         strcat(buf,tmp);
       }
@@ -104,8 +101,14 @@ int len;
     for(j=0;j<DUMP_WIDTH;j++) {
       if (((i*DUMP_WIDTH)+j)>=len)
        break;
-      ch=((unsigned char)*((char *)(s)+i*DUMP_WIDTH+j)) & 0xff;
+      ch=((unsigned char)*(s+i*DUMP_WIDTH+j)) & 0xff;
+#ifndef CHARSET_EBCDIC
       sprintf(tmp,"%c",((ch>=' ')&&(ch<='~'))?ch:'.');
+#else
+      sprintf(tmp,"%c",((ch>=os_toascii[' '])&&(ch<=os_toascii['~']))
+             ? os_toebcdic[ch]
+             : '.');
+#endif
       strcat(buf,tmp);
     }
     strcat(buf,"\n");