version 1.3, 2001/07/12 05:17:10 |
version 1.4, 2001/12/30 08:17:32 |
|
|
/* $OpenBSD$ */ |
/* $OpenBSD$ */ |
|
/* $NetBSD: conv.c,v 1.7 2001/12/07 15:14:29 bjh21 Exp $ */ |
|
|
/* |
/* |
* Copyright (c) 1989 The Regents of the University of California. |
* Copyright (c) 1989, 1993 |
* All rights reserved. |
* The Regents of the University of California. All rights reserved. |
* |
* |
* Redistribution and use in source and binary forms, with or without |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* modification, are permitted provided that the following conditions |
|
|
#endif /* not lint */ |
#endif /* not lint */ |
|
|
#include <sys/types.h> |
#include <sys/types.h> |
#include <ctype.h> |
|
#include <stdio.h> |
#include <stdio.h> |
|
#include <ctype.h> |
|
|
#include "hexdump.h" |
#include "hexdump.h" |
|
|
void |
void |
|
|
PR *pr; |
PR *pr; |
u_char *p; |
u_char *p; |
{ |
{ |
extern int deprecated; |
char buf[10]; |
char buf[10], *str; |
char const *str; |
|
|
switch(*p) { |
switch(*p) { |
case '\0': |
case '\0': |
|
|
*pr->cchar = 'c'; |
*pr->cchar = 'c'; |
(void)printf(pr->fmt, *p); |
(void)printf(pr->fmt, *p); |
} else { |
} else { |
(void)sprintf(str = buf, "%03o", (int)*p); |
(void)sprintf(buf, "%03o", (int)*p); |
|
str = buf; |
strpr: *pr->cchar = 's'; |
strpr: *pr->cchar = 's'; |
(void)printf(pr->fmt, str); |
(void)printf(pr->fmt, str); |
} |
} |
|
|
PR *pr; |
PR *pr; |
u_char *p; |
u_char *p; |
{ |
{ |
extern int deprecated; |
static const char *list[] = { |
static char *list[] = { |
|
"nul", "soh", "stx", "etx", "eot", "enq", "ack", "bel", |
"nul", "soh", "stx", "etx", "eot", "enq", "ack", "bel", |
"bs", "ht", "lf", "vt", "ff", "cr", "so", "si", |
"bs", "ht", "lf", "vt", "ff", "cr", "so", "si", |
"dle", "dcl", "dc2", "dc3", "dc4", "nak", "syn", "etb", |
"dle", "dcl", "dc2", "dc3", "dc4", "nak", "syn", "etb", |
|
|
} else if (*p == 0x7f) { |
} else if (*p == 0x7f) { |
*pr->cchar = 's'; |
*pr->cchar = 's'; |
(void)printf(pr->fmt, "del"); |
(void)printf(pr->fmt, "del"); |
} else if (deprecated && *p == 0x20) { /* od replace space with sp */ |
} else if (deprecated && *p == 0x20) { /* od replaced space with sp */ |
*pr->cchar = 's'; |
*pr->cchar = 's'; |
(void)printf(pr->fmt, " sp"); |
(void)printf(pr->fmt, " sp"); |
} else if (isprint(*p)) { |
} else if (isprint(*p)) { |