aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/hexdump/parse.c
Commit message (Collapse)AuthorAgeFilesLines
* usr.bin: Automated cleanup of cdefs and other formattingWarner Losh2023-11-271-3/+0
| | | | | | | | | | | | | | | | 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
* usr.bin: Remove ancient SCCS tags.Warner Losh2023-11-271-3/+0
| | | | | | | | 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
* Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-161-2/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* Enable support for printing 8-byte integers. For some reason, most of theBen Harris2023-06-051-0/+3
| | | | | | | | | | 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
* hexdump(1): Exit gracefully on format strings missing conversionConrad Meyer2019-04-131-3/+18
| | | | | | | | PR: 237263 Submitted by: Bojan Petrovic <bojan_petrovic AT fastmail.fm> Notes: svn path=/head/; revision=346187
* General further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-201-1/+3
| | | | | | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=326025
* Renumber copyright clause 4Warner Losh2017-02-281-1/+1
| | | | | | | | | | | | 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 Notes: svn path=/head/; revision=314436
* hexdump(1): Simplify by using asprintf(3)Pedro F. Giffuni2016-09-191-4/+1
| | | | | | | | | | Instead of strlen() + calloc() + snprintf, just use asprintf(). No functional change. Obtained from: OpenBSD (CVS Rev. 1.22) Notes: svn path=/head/; revision=305990
* Constify.Xin LI2014-04-251-3/+3
| | | | Notes: svn path=/head/; revision=264910
* Simplify the way the end of a singly linked list is followed (for addingChristian Brueffer2014-02-221-5/+2
| | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=262333
* Fix decoding of escape sequences in format strings:Tijl Coosemans2012-01-281-13/+6
| | | | | | | | | | | | | | | - 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) Notes: svn path=/head/; revision=230649
* - Fix how hexdump parses escape stringsEitan Adler2012-01-071-8/+23
| | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=229794
* Replace index() and rindex() calls with strchr() and strrchr().Ed Schouten2012-01-031-4/+4
| | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=229403
* Remove the advertising clause from UCB copyrighted files in usr.bin. ThisJoel Dahl2010-12-111-4/+0
| | | | | | | | | | | | 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 Notes: svn path=/head/; revision=216370
* Use strlcpy() instead of explicitly set \0 on the tail of the array.Xin LI2009-06-231-2/+1
| | | | Notes: svn path=/head/; revision=194796
* o Simple strcpy/strcat replacement.Maxim Konovalov2006-08-091-3/+4
| | | | | | | | | | PR: bin/101575 Founded by: Dan Lukes Obtained from: OpenBSD, rev. 1.11 by deraadt MFC after: 2 weeks Notes: svn path=/head/; revision=161132
* display.c:Johan Karlsson2004-07-221-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - '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 Notes: svn path=/head/; revision=132541
* ANSIify function definitions.David Malone2002-09-041-24/+16
| | | | | | | | | | | | 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 Notes: svn path=/head/; revision=102944
* Consistently use FBSDIDDavid E. O'Brien2002-06-301-2/+2
| | | | Notes: svn path=/head/; revision=99112
* From NetBSD:Tim J. Robbins2002-05-271-3/+1
| | | | | | | | | | | 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 Notes: svn path=/head/; revision=97329
* Overhaul hexdump's od syntax code to handle the -s -A -j -N -t options thatTim J. Robbins2002-05-171-8/+9
| | | | | | | | | SUSv3 requires and give od a proper manual page. PR: 36783 Notes: svn path=/head/; revision=96795
* Add support for printing long doubles.Tim J. Robbins2002-05-171-0/+6
| | | | | | | PR: 36783 Notes: svn path=/head/; revision=96792
* Slightly more efficient version of rev 1.6.David E. O'Brien2002-03-071-1/+1
| | | | Notes: svn path=/head/; revision=91840
* WARNS=2 fixups.Mark Murray2001-12-021-4/+4
| | | | Notes: svn path=/head/; revision=87203
* Remove the misnamed `emalloc' and replace its uses with the calloc (alongDavid E. O'Brien2001-07-241-5/+9
| | | | | | | with error checking) that it actually was. Notes: svn path=/head/; revision=80290
* $Id$ -> $FreeBSD$Peter Wemm1999-08-281-1/+1
| | | | Notes: svn path=/head/; revision=50477
* Localize itAndrey A. Chernov1997-11-041-7/+6
| | | | Notes: svn path=/head/; revision=30921
* Use err(3) instead of local redefinition, incorporate `hd' in usage str.Philippe Charnier1997-07-101-8/+12
| | | | Notes: svn path=/head/; revision=27315
* BSD 4.4 Lite Usr.bin SourcesRodney W. Grimes1994-05-271-0/+507
Notes: svn path=/cvs2svn/branches/CHRISTOS/; revision=1590