summaryrefslogtreecommitdiffstats
path: root/crypto/bio
diff options
context:
space:
mode:
authorBodo Möller <bodo@openssl.org>2000-09-04 15:38:02 +0000
committerBodo Möller <bodo@openssl.org>2000-09-04 15:38:02 +0000
commit397bd0938aa724cccf4f97eb73f8d8f403670329 (patch)
treedd8266f4f02683d0bdae5fa4a8b3c49af61b26c2 /crypto/bio
parentbbb8de0966f0181498a0491f42d8b839778a93e7 (diff)
Use consistent indentation,
Diffstat (limited to 'crypto/bio')
-rw-r--r--crypto/bio/b_dump.c129
1 files changed, 68 insertions, 61 deletions
diff --git a/crypto/bio/b_dump.c b/crypto/bio/b_dump.c
index 7cbe4f22b5..8397cfab6a 100644
--- a/crypto/bio/b_dump.c
+++ b/crypto/bio/b_dump.c
@@ -74,72 +74,79 @@ int BIO_dump(BIO *bio, const char *s, int len)
}
int BIO_dump_indent(BIO *bio, const char *s, int len, int indent)
-{
- int ret=0;
- char buf[288+1],tmp[20],str[128+1];
- int i,j,rows,trunc;
- unsigned char ch;
- int dump_width;
-
- trunc=0;
-
+ {
+ int ret=0;
+ char buf[288+1],tmp[20],str[128+1];
+ int i,j,rows,trunc;
+ unsigned char ch;
+ int dump_width;
+
+ trunc=0;
+
#ifdef TRUNCATE
- for(; (len > 0) && ((s[len-1] == ' ') || (s[len-1] == '\0')); len--)
- trunc++;
+ for(; (len > 0) && ((s[len-1] == ' ') || (s[len-1] == '\0')); len--)
+ trunc++;
#endif
- if (indent < 0)
- indent = 0;
- if (indent) {
- if (indent > 128) indent=128;
- memset(str,' ',indent);
- }
- str[indent]='\0';
-
- dump_width=DUMP_WIDTH_LESS_INDENT(indent);
- rows=(len/dump_width);
- if ((rows*dump_width)<len)
- rows++;
- for(i=0;i<rows;i++) {
- buf[0]='\0'; /* start with empty string */
- strcpy(buf,str);
- sprintf(tmp,"%04x - ",i*dump_width);
- strcat(buf,tmp);
- for(j=0;j<dump_width;j++) {
- if (((i*dump_width)+j)>=len) {
- strcat(buf," ");
- } else {
- ch=((unsigned char)*(s+i*dump_width+j)) & 0xff;
- sprintf(tmp,"%02x%c",ch,j==7?'-':' ');
- strcat(buf,tmp);
- }
- }
- strcat(buf," ");
- for(j=0;j<dump_width;j++) {
- if (((i*dump_width)+j)>=len)
- break;
- ch=((unsigned char)*(s+i*dump_width+j)) & 0xff;
+ if (indent < 0)
+ indent = 0;
+ if (indent)
+ {
+ if (indent > 128) indent=128;
+ memset(str,' ',indent);
+ }
+ str[indent]='\0';
+
+ dump_width=DUMP_WIDTH_LESS_INDENT(indent);
+ rows=(len/dump_width);
+ if ((rows*dump_width)<len)
+ rows++;
+ for(i=0;i<rows;i++)
+ {
+ buf[0]='\0'; /* start with empty string */
+ strcpy(buf,str);
+ sprintf(tmp,"%04x - ",i*dump_width);
+ strcat(buf,tmp);
+ for(j=0;j<dump_width;j++)
+ {
+ if (((i*dump_width)+j)>=len)
+ {
+ strcat(buf," ");
+ }
+ else
+ {
+ ch=((unsigned char)*(s+i*dump_width+j)) & 0xff;
+ sprintf(tmp,"%02x%c",ch,j==7?'-':' ');
+ strcat(buf,tmp);
+ }
+ }
+ strcat(buf," ");
+ for(j=0;j<dump_width;j++)
+ {
+ if (((i*dump_width)+j)>=len)
+ break;
+ ch=((unsigned char)*(s+i*dump_width+j)) & 0xff;
#ifndef CHARSET_EBCDIC
- sprintf(tmp,"%c",((ch>=' ')&&(ch<='~'))?ch:'.');
+ sprintf(tmp,"%c",((ch>=' ')&&(ch<='~'))?ch:'.');
#else
- sprintf(tmp,"%c",((ch>=os_toascii[' '])&&(ch<=os_toascii['~']))
- ? os_toebcdic[ch]
- : '.');
+ sprintf(tmp,"%c",((ch>=os_toascii[' '])&&(ch<=os_toascii['~']))
+ ? os_toebcdic[ch]
+ : '.');
#endif
- strcat(buf,tmp);
- }
- strcat(buf,"\n");
- /* if this is the last call then update the ddt_dump thing so that
- * we will move the selection point in the debug window
- */
- ret+=BIO_write(bio,(char *)buf,strlen(buf));
- }
+ strcat(buf,tmp);
+ }
+ strcat(buf,"\n");
+ /* if this is the last call then update the ddt_dump thing so that
+ * we will move the selection point in the debug window
+ */
+ ret+=BIO_write(bio,(char *)buf,strlen(buf));
+ }
#ifdef TRUNCATE
- if (trunc > 0) {
- sprintf(buf,"%s%04x - <SPACES/NULS>\n",str,len+trunc);
- ret+=BIO_write(bio,(char *)buf,strlen(buf));
- }
+ if (trunc > 0)
+ {
+ sprintf(buf,"%s%04x - <SPACES/NULS>\n",str,len+trunc);
+ ret+=BIO_write(bio,(char *)buf,strlen(buf));
+ }
#endif
- return(ret);
-}
-
+ return(ret);
+ }