version 1.4, 2001/07/12 05:17:10 |
version 1.5, 2001/11/02 19:41:06 |
|
|
#include <stdlib.h> |
#include <stdlib.h> |
#include <limits.h> |
#include <limits.h> |
#include <unistd.h> |
#include <unistd.h> |
|
#include <err.h> |
#include "hexdump.h" |
#include "hexdump.h" |
|
|
off_t skip; /* bytes to skip */ |
off_t skip; /* bytes to skip */ |
|
|
addfile(optarg); |
addfile(optarg); |
break; |
break; |
case 'n': |
case 'n': |
if ((length = atoi(optarg)) < 0) { |
if ((length = atoi(optarg)) < 0) |
(void)fprintf(stderr, |
errx(1, "bad length value"); |
"hexdump: bad length value.\n"); |
|
exit(1); |
|
} |
|
break; |
break; |
case 'o': |
case 'o': |
add("\"%07.7_Ax\n\""); |
add("\"%07.7_Ax\n\""); |
add("\"%07.7_ax \" 8/2 \" %06o \" \"\\n\""); |
add("\"%07.7_ax \" 8/2 \" %06o \" \"\\n\""); |
break; |
break; |
case 's': |
case 's': |
if ((skip = strtol(optarg, &p, 0)) < 0) { |
if ((skip = strtol(optarg, &p, 0)) < 0) |
(void)fprintf(stderr, |
errx(1, "bad skip value"); |
"hexdump: bad skip value.\n"); |
|
exit(1); |
|
} |
|
switch(*p) { |
switch(*p) { |
case 'b': |
case 'b': |
skip *= 512; |
skip *= 512; |
|
|
void |
void |
usage() |
usage() |
{ |
{ |
(void)fprintf(stderr, |
extern char *__progname; |
"hexdump: [-bcdovx] [-e fmt] [-f fmt_file] [-n length] [-s skip] [file ...]\n"); |
fprintf(stderr, "usage: %s [-bcdovx] [-e fmt] [-f fmt_file] " |
|
"[-n length] [-s skip] [file ...]", __progname); |
exit(1); |
exit(1); |
} |
} |