[Midnightbsd-cvs] src [11532] trunk/usr.bin/hexdump: sync hexdump with freebsd.
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Sat Jul 7 16:30:55 EDT 2018
Revision: 11532
http://svnweb.midnightbsd.org/src/?rev=11532
Author: laffer1
Date: 2018-07-07 16:30:54 -0400 (Sat, 07 Jul 2018)
Log Message:
-----------
sync hexdump with freebsd.
Modified Paths:
--------------
trunk/usr.bin/hexdump/Makefile
trunk/usr.bin/hexdump/conv.c
trunk/usr.bin/hexdump/display.c
trunk/usr.bin/hexdump/hexdump.1
trunk/usr.bin/hexdump/hexdump.c
trunk/usr.bin/hexdump/hexdump.h
trunk/usr.bin/hexdump/hexsyntax.c
trunk/usr.bin/hexdump/od.1
trunk/usr.bin/hexdump/odsyntax.c
trunk/usr.bin/hexdump/parse.c
Property Changed:
----------------
trunk/usr.bin/hexdump/hexdump.1
trunk/usr.bin/hexdump/od.1
Modified: trunk/usr.bin/hexdump/Makefile
===================================================================
--- trunk/usr.bin/hexdump/Makefile 2018-07-07 20:29:18 UTC (rev 11531)
+++ trunk/usr.bin/hexdump/Makefile 2018-07-07 20:30:54 UTC (rev 11532)
@@ -1,5 +1,6 @@
+# $MidnightBSD$
# @(#)Makefile 8.1 (Berkeley) 6/6/93
-# $MidnightBSD$
+# $FreeBSD: stable/10/usr.bin/hexdump/Makefile 201386 2010-01-02 10:27:05Z ed $
PROG= hexdump
SRCS= conv.c display.c hexdump.c hexsyntax.c odsyntax.c parse.c
Modified: trunk/usr.bin/hexdump/conv.c
===================================================================
--- trunk/usr.bin/hexdump/conv.c 2018-07-07 20:29:18 UTC (rev 11531)
+++ trunk/usr.bin/hexdump/conv.c 2018-07-07 20:30:54 UTC (rev 11532)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
@@ -31,7 +32,7 @@
static const char sccsid[] = "@(#)conv.c 8.1 (Berkeley) 6/6/93";
#endif /* not lint */
#include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/usr.bin/hexdump/conv.c 247753 2013-03-04 02:21:06Z eadler $");
#include <sys/types.h>
@@ -151,7 +152,7 @@
static char const * list[] = {
"nul", "soh", "stx", "etx", "eot", "enq", "ack", "bel",
"bs", "ht", "lf", "vt", "ff", "cr", "so", "si",
- "dle", "dcl", "dc2", "dc3", "dc4", "nak", "syn", "etb",
+ "dle", "dc1", "dc2", "dc3", "dc4", "nak", "syn", "etb",
"can", "em", "sub", "esc", "fs", "gs", "rs", "us",
};
Modified: trunk/usr.bin/hexdump/display.c
===================================================================
--- trunk/usr.bin/hexdump/display.c 2018-07-07 20:29:18 UTC (rev 11531)
+++ trunk/usr.bin/hexdump/display.c 2018-07-07 20:30:54 UTC (rev 11532)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
@@ -33,7 +34,7 @@
#endif
#endif /* not lint */
#include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/usr.bin/hexdump/display.c 282738 2015-05-10 21:26:07Z jilles $");
#include <sys/param.h>
#include <sys/stat.h>
@@ -220,7 +221,7 @@
pr->cchar[0] = 's';
pr->cchar[1] = '\0';
for (p1 = pr->fmt; *p1 != '%'; ++p1);
- for (p2 = ++p1; *p1 && index(spec, *p1); ++p1);
+ for (p2 = ++p1; *p1 && strchr(spec, *p1); ++p1);
while ((*p2++ = *p1++));
}
@@ -380,7 +381,7 @@
return;
}
}
- if (S_ISREG(sb.st_mode)) {
+ if (statok && S_ISREG(sb.st_mode)) {
if (fseeko(stdin, skip, SEEK_SET))
err(1, "%s", fname);
address += skip;
Modified: trunk/usr.bin/hexdump/hexdump.1
===================================================================
--- trunk/usr.bin/hexdump/hexdump.1 2018-07-07 20:29:18 UTC (rev 11531)
+++ trunk/usr.bin/hexdump/hexdump.1 2018-07-07 20:30:54 UTC (rev 11532)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
.\" Copyright (c) 1989, 1990, 1993
.\" The Regents of the University of California. All rights reserved.
.\"
@@ -26,7 +27,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)hexdump.1 8.2 (Berkeley) 4/18/94
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/usr.bin/hexdump/hexdump.1 233992 2012-04-07 09:05:30Z joel $
.\"
.Dd February 18, 2010
.Dt HEXDUMP 1
@@ -200,14 +201,14 @@
described in the C standard are supported:
.Bd -ragged -offset indent -compact
.Bl -column <alert_character>
-.It "NUL \e0
-.It "<alert character> \ea
-.It "<backspace> \eb
-.It "<form-feed> \ef
-.It "<newline> \en
-.It "<carriage return> \er
-.It "<tab> \et
-.It "<vertical tab> \ev
+.It "NUL \e0"
+.It "<alert character> \ea"
+.It "<backspace> \eb"
+.It "<form-feed> \ef"
+.It "<newline> \en"
+.It "<carriage return> \er"
+.It "<tab> \et"
+.It "<vertical tab> \ev"
.El
.Ed
.El
@@ -248,13 +249,13 @@
displayed using the following, lower-case, names.
Characters greater than 0xff, hexadecimal, are displayed as hexadecimal
strings.
-.Bl -column \&000_nu \&001_so \&002_st \&003_et \&004_eo
-.It "\&000\ NUL\t001\ SOH\t002\ STX\t003\ ETX\t004\ EOT\t005\ ENQ
-.It "\&006\ ACK\t007\ BEL\t008\ BS\t009\ HT\t00A\ LF\t00B\ VT
-.It "\&00C\ FF\t00D\ CR\t00E\ SO\t00F\ SI\t010\ DLE\t011\ DC1
-.It "\&012\ DC2\t013\ DC3\t014\ DC4\t015\ NAK\t016\ SYN\t017\ ETB
-.It "\&018\ CAN\t019\ EM\t01A\ SUB\t01B\ ESC\t01C\ FS\t01D\ GS
-.It "\&01E\ RS\t01F\ US\t07F\ DEL
+.Bl -column 000_nu 001_so 002_st 003_et 004_eo
+.It "000 NUL" Ta "001 SOH" Ta "002 STX" Ta "003 ETX" Ta "004 EOT" Ta "005 ENQ"
+.It "006 ACK" Ta "007 BEL" Ta "008 BS" Ta "009 HT" Ta "00A LF" Ta "00B VT"
+.It "00C FF" Ta "00D CR" Ta "00E\ SO" Ta "00F SI" Ta "010 DLE" Ta "011 DC1"
+.It "012 DC2" Ta "013 DC3" Ta "014 DC4" Ta "015\ NAK" Ta "016 SYN" Ta "017 ETB"
+.It "018 CAN" Ta "019 EM" Ta "01A SUB" Ta "01B ESC" Ta "01C FS" Ta "01D GS"
+.It "01E RS" Ta "01F US" Ta "07F DEL" Ta \& Ta \& Ta \&
.El
.El
.Pp
Property changes on: trunk/usr.bin/hexdump/hexdump.1
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/usr.bin/hexdump/hexdump.c
===================================================================
--- trunk/usr.bin/hexdump/hexdump.c 2018-07-07 20:29:18 UTC (rev 11531)
+++ trunk/usr.bin/hexdump/hexdump.c 2018-07-07 20:30:54 UTC (rev 11532)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
@@ -39,7 +40,7 @@
#endif
#endif /* not lint */
#include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/usr.bin/hexdump/hexdump.c 229403 2012-01-03 18:51:58Z ed $");
#include <sys/types.h>
#include <locale.h>
@@ -61,7 +62,7 @@
(void)setlocale(LC_ALL, "");
- if (!(p = rindex(argv[0], 'o')) || strcmp(p, "od"))
+ if (!(p = strrchr(argv[0], 'o')) || strcmp(p, "od"))
newsyntax(argc, &argv);
else
oldsyntax(argc, &argv);
Modified: trunk/usr.bin/hexdump/hexdump.h
===================================================================
--- trunk/usr.bin/hexdump/hexdump.h 2018-07-07 20:29:18 UTC (rev 11531)
+++ trunk/usr.bin/hexdump/hexdump.h 2018-07-07 20:30:54 UTC (rev 11532)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
@@ -27,7 +28,7 @@
* SUCH DAMAGE.
*
* @(#)hexdump.h 8.1 (Berkeley) 6/6/93
- * $MidnightBSD$
+ * $FreeBSD: stable/10/usr.bin/hexdump/hexdump.h 216370 2010-12-11 08:32:16Z joel $
*/
#include <wchar.h>
Modified: trunk/usr.bin/hexdump/hexsyntax.c
===================================================================
--- trunk/usr.bin/hexdump/hexsyntax.c 2018-07-07 20:29:18 UTC (rev 11531)
+++ trunk/usr.bin/hexdump/hexsyntax.c 2018-07-07 20:30:54 UTC (rev 11532)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
@@ -33,7 +34,7 @@
#endif
#endif /* not lint */
#include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/usr.bin/hexdump/hexsyntax.c 229403 2012-01-03 18:51:58Z ed $");
#include <sys/types.h>
@@ -54,7 +55,7 @@
char *p, **argv;
argv = *argvp;
- if ((p = rindex(argv[0], 'h')) != NULL &&
+ if ((p = strrchr(argv[0], 'h')) != NULL &&
strcmp(p, "hd") == 0) {
/* "Canonical" format, implies -C. */
add("\"%08.8_Ax\n\"");
Modified: trunk/usr.bin/hexdump/od.1
===================================================================
--- trunk/usr.bin/hexdump/od.1 2018-07-07 20:29:18 UTC (rev 11531)
+++ trunk/usr.bin/hexdump/od.1 2018-07-07 20:30:54 UTC (rev 11532)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
.\" Copyright (c) 1990, 1993
.\" The Regents of the University of California. All rights reserved.
.\"
@@ -26,7 +27,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)od.1 8.1 (Berkeley) 6/6/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/usr.bin/hexdump/od.1 233992 2012-04-07 09:05:30Z joel $
.\"
.Dd December 22, 2011
.Dt OD 1
@@ -151,7 +152,7 @@
.It "00C FF 00D CR 00E SO 00F SI 010 DLE 011 DC1"
.It "012 DC2 013 DC3 014 DC4 015 NAK 016 SYN 017 ETB"
.It "018 CAN 019 EM 01A SUB 01B ESC 01C FS 01D GS"
-.It "01E RS 01F US 020 SP 07F DEL"
+.It "01E RS 01F US 020 SP 07F DEL \& \&"
.El
.It Cm c
Characters in the default character set.
Property changes on: trunk/usr.bin/hexdump/od.1
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/usr.bin/hexdump/odsyntax.c
===================================================================
--- trunk/usr.bin/hexdump/odsyntax.c 2018-07-07 20:29:18 UTC (rev 11531)
+++ trunk/usr.bin/hexdump/odsyntax.c 2018-07-07 20:30:54 UTC (rev 11532)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
@@ -33,7 +34,7 @@
#endif
#endif /* not lint */
#include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/usr.bin/hexdump/odsyntax.c 216370 2010-12-11 08:32:16Z joel $");
#include <sys/types.h>
Modified: trunk/usr.bin/hexdump/parse.c
===================================================================
--- trunk/usr.bin/hexdump/parse.c 2018-07-07 20:29:18 UTC (rev 11531)
+++ trunk/usr.bin/hexdump/parse.c 2018-07-07 20:30:54 UTC (rev 11532)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
@@ -33,7 +34,7 @@
#endif
#endif /* not lint */
#include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/usr.bin/hexdump/parse.c 262926 2014-03-08 12:24:47Z brueffer $");
#include <sys/types.h>
@@ -58,7 +59,7 @@
if ((fp = fopen(name, "r")) == NULL)
err(1, "%s", name);
while (fgets(buf, sizeof(buf), fp)) {
- if (!(p = index(buf, '\n'))) {
+ if (!(p = strchr(buf, '\n'))) {
warnx("line too long");
while ((ch = getchar()) != '\n' && ch != EOF);
continue;
@@ -167,7 +168,7 @@
* skip any special chars -- save precision in
* case it's a %s format.
*/
- while (index(spec + 1, *++fmt));
+ while (strchr(spec + 1, *++fmt));
if (*fmt == '.' && isdigit(*++fmt)) {
prec = atoi(fmt);
while (isdigit(*++fmt));
@@ -210,7 +211,6 @@
int nconv, prec;
size_t len;
- nextpr = NULL;
prec = 0;
for (fu = fs->nextfu; fu; fu = fu->nextfu) {
@@ -218,13 +218,11 @@
* Break each format unit into print units; each conversion
* character gets its own.
*/
+ nextpr = &fu->nextpr;
for (nconv = 0, fmtp = fu->fmt; *fmtp; nextpr = &pr->nextpr) {
if ((pr = calloc(1, sizeof(PR))) == NULL)
err(1, NULL);
- if (!fu->nextpr)
- fu->nextpr = pr;
- else
- *nextpr = pr;
+ *nextpr = pr;
/* Skip preceding text and up to the next % sign. */
for (p1 = fmtp; *p1 && *p1 != '%'; ++p1);
@@ -243,10 +241,10 @@
if (fu->bcnt) {
sokay = USEBCNT;
/* Skip to conversion character. */
- for (++p1; index(spec, *p1); ++p1);
+ for (++p1; strchr(spec, *p1); ++p1);
} else {
/* Skip any special chars, field width. */
- while (index(spec + 1, *++p1));
+ while (strchr(spec + 1, *++p1));
if (*p1 == '.' && isdigit(*++p1)) {
sokay = USEPREC;
prec = atoi(p1);
More information about the Midnightbsd-cvs
mailing list