Un-deprecate od(1): rename the deprecated' variable to
odmode', remove the
deprecation warning from the utility and manual page. Since this utility is required by POSIX, it's not likely to be removed any time soon. This is leading up to the addition of the P1003.1-2001 -s -A -j -N -t options. PR: 36783
This commit is contained in:
parent
952f608b76
commit
ed1adbad3e
@ -48,7 +48,6 @@ conv_c(pr, p)
|
|||||||
PR *pr;
|
PR *pr;
|
||||||
u_char *p;
|
u_char *p;
|
||||||
{
|
{
|
||||||
extern int deprecated;
|
|
||||||
char buf[10];
|
char buf[10];
|
||||||
char const *str;
|
char const *str;
|
||||||
|
|
||||||
@ -58,7 +57,7 @@ conv_c(pr, p)
|
|||||||
goto strpr;
|
goto strpr;
|
||||||
/* case '\a': */
|
/* case '\a': */
|
||||||
case '\007':
|
case '\007':
|
||||||
if (deprecated) /* od didn't know about \a */
|
if (odmode) /* od didn't know about \a */
|
||||||
break;
|
break;
|
||||||
str = "\\a";
|
str = "\\a";
|
||||||
goto strpr;
|
goto strpr;
|
||||||
@ -78,7 +77,7 @@ conv_c(pr, p)
|
|||||||
str = "\\t";
|
str = "\\t";
|
||||||
goto strpr;
|
goto strpr;
|
||||||
case '\v':
|
case '\v':
|
||||||
if (deprecated)
|
if (odmode)
|
||||||
break;
|
break;
|
||||||
str = "\\v";
|
str = "\\v";
|
||||||
goto strpr;
|
goto strpr;
|
||||||
@ -101,7 +100,6 @@ conv_u(pr, p)
|
|||||||
PR *pr;
|
PR *pr;
|
||||||
u_char *p;
|
u_char *p;
|
||||||
{
|
{
|
||||||
extern int deprecated;
|
|
||||||
static char const * list[] = {
|
static char const * 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",
|
||||||
@ -112,14 +110,14 @@ conv_u(pr, p)
|
|||||||
/* od used nl, not lf */
|
/* od used nl, not lf */
|
||||||
if (*p <= 0x1f) {
|
if (*p <= 0x1f) {
|
||||||
*pr->cchar = 's';
|
*pr->cchar = 's';
|
||||||
if (deprecated && *p == 0x0a)
|
if (odmode && *p == 0x0a)
|
||||||
(void)printf(pr->fmt, "nl");
|
(void)printf(pr->fmt, "nl");
|
||||||
else
|
else
|
||||||
(void)printf(pr->fmt, list[*p]);
|
(void)printf(pr->fmt, list[*p]);
|
||||||
} 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 replaced space with sp */
|
} else if (odmode && *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)) {
|
||||||
|
@ -73,6 +73,7 @@ typedef struct _fs { /* format strings */
|
|||||||
|
|
||||||
extern FS *fshead; /* head of format strings list */
|
extern FS *fshead; /* head of format strings list */
|
||||||
extern int blocksize; /* data block size */
|
extern int blocksize; /* data block size */
|
||||||
|
extern int odmode; /* are we acting as od(1)? */
|
||||||
enum _vflag { ALL, DUP, FIRST, WAIT }; /* -v values */
|
enum _vflag { ALL, DUP, FIRST, WAIT }; /* -v values */
|
||||||
|
|
||||||
void add(const char *);
|
void add(const char *);
|
||||||
|
@ -52,11 +52,6 @@
|
|||||||
.Ar file
|
.Ar file
|
||||||
.Sh DESCRIPTION
|
.Sh DESCRIPTION
|
||||||
The
|
The
|
||||||
.Nm
|
|
||||||
utility has been deprecated in favor of
|
|
||||||
.Xr hexdump 1 .
|
|
||||||
.Pp
|
|
||||||
The
|
|
||||||
.Nm hexdump
|
.Nm hexdump
|
||||||
utility, if called as
|
utility, if called as
|
||||||
.Nm ,
|
.Nm ,
|
||||||
|
@ -49,7 +49,7 @@ static const char rcsid[] =
|
|||||||
|
|
||||||
#include "hexdump.h"
|
#include "hexdump.h"
|
||||||
|
|
||||||
int deprecated;
|
int odmode;
|
||||||
|
|
||||||
static void odoffset(int, char ***);
|
static void odoffset(int, char ***);
|
||||||
static void odprecede(void);
|
static void odprecede(void);
|
||||||
@ -64,7 +64,7 @@ oldsyntax(argc, argvp)
|
|||||||
int ch;
|
int ch;
|
||||||
char **argv;
|
char **argv;
|
||||||
|
|
||||||
deprecated = 1;
|
odmode = 1;
|
||||||
argv = *argvp;
|
argv = *argvp;
|
||||||
while ((ch = getopt(argc, argv, "aBbcDdeFfHhIiLlOoPpswvXx")) != -1)
|
while ((ch = getopt(argc, argv, "aBbcDdeFfHhIiLlOoPpswvXx")) != -1)
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
@ -136,7 +136,6 @@ oldsyntax(argc, argvp)
|
|||||||
case 'w':
|
case 'w':
|
||||||
case '?':
|
case '?':
|
||||||
default:
|
default:
|
||||||
warnx("od(1) has been deprecated for hexdump(1)");
|
|
||||||
if (ch != '?')
|
if (ch != '?')
|
||||||
warnx("hexdump(1) compatibility doesn't support the -%c option%s",
|
warnx("hexdump(1) compatibility doesn't support the -%c option%s",
|
||||||
ch, ch == 's' ? "; see strings(1)" : "");
|
ch, ch == 's' ? "; see strings(1)" : "");
|
||||||
|
Loading…
Reference in New Issue
Block a user