History log of /freebsd-current/usr.bin/hexdump/parse.c
Revision Date Author Comments
# 5e3934b1 24-Nov-2023 Warner Losh <imp@FreeBSD.org>

usr.bin: Automated cleanup of cdefs and other formatting

Apply the following automated changes to try to eliminate
no-longer-needed sys/cdefs.h includes as well as now-empty
blank lines in a row.

Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/
Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/
Remove /\n+#if.*\n#endif.*\n+/
Remove /^#if.*\n#endif.*\n/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/

Sponsored by: Netflix


# bdcbfde3 23-Nov-2023 Warner Losh <imp@FreeBSD.org>

usr.bin: Remove ancient SCCS tags.

Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl script.

Sponsored by: Netflix


# 1d386b48 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# 37e3f5b2 07-Dec-2001 Ben Harris <bjh21@netbsd.org>

Enable support for printing 8-byte integers. For some reason, most of the
code for this was present, but disabled.
This is required for POSIX compliance on platforms with 8-byte longs.

Obtained-From: NetBSD
PR: 238586
Reported-By: Mohamed Akram <mohd.akram@outlook.com>
MFC after: 2 weeks


# 8fb93ac9 13-Apr-2019 Conrad Meyer <cem@FreeBSD.org>

hexdump(1): Exit gracefully on format strings missing conversion

PR: 237263
Submitted by: Bojan Petrovic <bojan_petrovic AT fastmail.fm>


# 8a16b7a1 20-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

General further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.


# fbbd9655 28-Feb-2017 Warner Losh <imp@FreeBSD.org>

Renumber copyright clause 4

Renumber cluase 4 to 3, per what everybody else did when BSD granted
them permission to remove clause 3. My insistance on keeping the same
numbering for legal reasons is too pedantic, so give up on that point.

Submitted by: Jan Schaumann <jschauma@stevens.edu>
Pull Request: https://github.com/freebsd/freebsd/pull/96


# 0c9426b6 19-Sep-2016 Pedro F. Giffuni <pfg@FreeBSD.org>

hexdump(1): Simplify by using asprintf(3)

Instead of strlen() + calloc() + snprintf, just use asprintf().
No functional change.

Obtained from: OpenBSD (CVS Rev. 1.22)


# a1217f20 24-Apr-2014 Xin LI <delphij@FreeBSD.org>

Constify.


# 8c91e67c 22-Feb-2014 Christian Brueffer <brueffer@FreeBSD.org>

Simplify the way the end of a singly linked list is followed (for adding
items), so it is more obvious that we aren't going to indirect through
a NULL pointer.

PR: 144723
Submitted by: Garrett Cooper <yaneurabeya at gmail.com>
Obtained from: NetBSD r1.19
MFC after: 2 weeks


# e57ac359 28-Jan-2012 Tijl Coosemans <tijl@FreeBSD.org>

Fix decoding of escape sequences in format strings:
- Zero-terminate the resulting string by letting the for-loop copy the
terminating zero.
- Exit the for-loop after handling a backslash at the end of the format
string to fix a buffer overrun.
- Remove some unnecessary comments and blank lines. [1]

Requested by: bde [1]
PR: bin/144722
Approved by: kib (mentor)


# 01155b20 07-Jan-2012 Eitan Adler <eadler@FreeBSD.org>

- Fix how hexdump parses escape strings
From the NetBSD bug:
The way how hexdump(1) parses escape sequences has some bugs.
It shows up when an escape sequence is used as the non-last character
of a format string.

PR: bin/144722
Submitted by: gcooper
Approved by: rpaulo
Obtained from: NetBSD
MFC after: 1 week


# b3608ae1 03-Jan-2012 Ed Schouten <ed@FreeBSD.org>

Replace index() and rindex() calls with strchr() and strrchr().

The index() and rindex() functions were marked LEGACY in the 2001
revision of POSIX and were subsequently removed from the 2008 revision.
The strchr() and strrchr() functions are part of the C standard.

This makes the source code a lot more consistent, as most of these C
files also call into other str*() routines. In fact, about a dozen
already perform strchr() calls.


# da52b4ca 11-Dec-2010 Joel Dahl <joel@FreeBSD.org>

Remove the advertising clause from UCB copyrighted files in usr.bin. This
is in accordance with the information provided at
ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change

Also add $FreeBSD$ to a few files to keep svn happy.

Discussed with: imp, rwatson


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# fe0506d7 09-Mar-2010 Marcel Moolenaar <marcel@FreeBSD.org>

Create the altix project branch. The altix project will add support
for the SGI Altix 350 to FreeBSD/ia64. The hardware used for porting
is a two-module system, consisting of a base compute module and a
CPU expansion module. SGI's NUMAFlex architecture can be an excellent
platform to test CPU affinity and NUMA-aware features in FreeBSD.


# 884f7c03 23-Jun-2009 Xin LI <delphij@FreeBSD.org>

Use strlcpy() instead of explicitly set \0 on the tail of the array.


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# e4df92e1 09-Aug-2006 Maxim Konovalov <maxim@FreeBSD.org>

o Simple strcpy/strcat replacement.

PR: bin/101575
Founded by: Dan Lukes
Obtained from: OpenBSD, rev. 1.11 by deraadt
MFC after: 2 weeks


# aae01d24 22-Jul-2004 Johan Karlsson <johan@FreeBSD.org>

display.c:
- 'savech' is only used if it is set a few lines above where
it is used, initialize it to silence warning.

- 'length' is either -1 or greater than 0, hence it is safe to cast it
to unsigned when comparing it here.

odsyntax.c:
- 'p' is assigned either (*argvp)[0] or (*argvp)[1] which both are
char *. 'num' and 'end' are assigned values based on 'p'.
Hence use char * instead of unsigned char * for these variables.

'&end' as the second argument to strtoll does not need to be casted
to char** any more.

This solves a
'dereferencing type-punned pointer will break strict-aliasing rules'
warning when compiling with -O2.

parse.c:
- 'prec' is only used when sokay == USEPREC and sokay = USEPREC
when 'prec' is assigned. Hence 'prec' is not used uninitialized,
initialize it to silence warning.

- The code involving 'nextpr' is hard to follow, but I belive
'nextpr' will not be used unless it is initialized.
Anyway, IF 'nextpr' is used uninitialized it is better to
get a consistant error (seg fault, when dereferencing a NULL pointer)
than potentially accessing some random memory.

The above changes makes hexdump WARNS=6 clean even when compiled with
-O2. Hence bump WARNS to keep it clean.

Tested by: CFLAGS='-O2 -pipe' make universe


# f4ac32de 04-Sep-2002 David Malone <dwmalone@FreeBSD.org>

ANSIify function definitions.
Add some constness to avoid some warnings.
Remove use register keyword.
Deal with missing/unneeded extern/prototypes.
Some minor type changes/casts to avoid warnings.

Reviewed by: md5


# e026a48c 29-Jun-2002 David E. O'Brien <obrien@FreeBSD.org>

Consistently use FBSDID


# 594830fb 26-May-2002 Tim J. Robbins <tjr@FreeBSD.org>

From NetBSD:
Revision 1.10 Sat Oct 14 17:41:55 2000 UTC by bjh21
Don't core dump with an empty format string. Fixes PR#11218.
Patch supplied by Launey Thomas.

Obtained from: NetBSD


# cf021af2 17-May-2002 Tim J. Robbins <tjr@FreeBSD.org>

Overhaul hexdump's od syntax code to handle the -s -A -j -N -t options that
SUSv3 requires and give od a proper manual page.

PR: 36783


# 82866376 17-May-2002 Tim J. Robbins <tjr@FreeBSD.org>

Add support for printing long doubles.

PR: 36783


# 64049aa6 07-Mar-2002 David E. O'Brien <obrien@FreeBSD.org>

Slightly more efficient version of rev 1.6.


# c38cc743 01-Dec-2001 Mark Murray <markm@FreeBSD.org>

WARNS=2 fixups.


# ac3c230c 24-Jul-2001 David E. O'Brien <obrien@FreeBSD.org>

Remove the misnamed `emalloc' and replace its uses with the calloc (along
with error checking) that it actually was.


# c3aac50f 27-Aug-1999 Peter Wemm <peter@FreeBSD.org>

$Id$ -> $FreeBSD$


# de34792f 03-Nov-1997 Andrey A. Chernov <ache@FreeBSD.org>

Localize it


# 10731702 10-Jul-1997 Philippe Charnier <charnier@FreeBSD.org>

Use err(3) instead of local redefinition, incorporate `hd' in usage str.


# 9b50d902 26-May-1994 Rodney W. Grimes <rgrimes@FreeBSD.org>

BSD 4.4 Lite Usr.bin Sources