Commit graph

137 commits

Author SHA1 Message Date
Eitan Adler 240299864c Fix typo ('1' != 'l')
PR:		bin/175975
Submitted by:	William Ahern <william@25thandclement.com>
Approved by:	cperciva (mentor)
2013-03-04 02:21:06 +00:00
Simon J. Gerraty f5f7c05209 Updated dependencies 2013-02-16 01:23:54 +00:00
Marcel Moolenaar 7750ad47a9 Sync FreeBSD's bmake branch with Juniper's internal bmake branch.
Requested by: Simon Gerraty <sjg@juniper.net>
2012-08-22 19:25:57 +00:00
Joel Dahl 748611c9c0 mdoc: fix column names, indentation, column separation within each row, and
quotation. Also make sure we have the same amount of columns in each row as
the number of columns we specify in the head arguments.

Reviewed by:	brueffer
2012-04-07 09:05:30 +00:00
Joel Dahl c2965cd185 mdoc: terminate quoted strings.
Reviewed by:	brueffer
2012-03-26 15:18:14 +00:00
Tijl Coosemans e57ac359cc 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)
2012-01-28 18:49:04 +00:00
Eitan Adler 01155b2005 - 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
2012-01-07 23:15:21 +00:00
Ed Schouten b3608ae18f 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.
2012-01-03 18:51:58 +00:00
Glen Barber dce762dd44 Formatting fixes:
hexdump/od.1:
 - Enclose tabbed content in quotes [1]

ar/ar.1:
 - Enclose tabbed content in quotes [1]

rctl/rctl.8:
 - Enclose tabbed content in quotes [1]
 - Start a sentence on a newline [2]

Reported by:		manlint [1], igor [2]
MFC after:		1 week
X-MFC-after:		9.0-RELEASE
2011-12-23 00:29:01 +00:00
Dimitry Andric 7818f8df2e Correct a logic error in usr.bin/hexdump/conv.c, found by clang.
Whenever the conv_c() function encounters an incomplete multibyte char,
it peeks ahead.  It also sets p to peekbuf, to indicate it is still
processing the incomplete character.

However, on the next retry, it compares buf against peekbuf, which
always returns false, since both buf and peekbuf are local char arrays,
whose addresses are never the same.

Fix this by comparing against p instead, which was the intention.  Also
turn peekbuf into an array of u_char, to prevent conversion warnings.

MFC after:	1 week
2011-12-17 15:33:26 +00:00
Joel Dahl da52b4caaf 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
2010-12-11 08:32:16 +00:00
Ulrich Spörlein 72f27fcbb1 Use same table markup as in hexdump.1 2010-06-11 06:04:14 +00:00
Ulrich Spörlein aa12cea2cc mdoc: order prologue macros consistently by Dd/Dt/Os
Although groff_mdoc(7) gives another impression, this is the ordering
most widely used and also required by mdocml/mandoc.

Reviewed by:	ru
Approved by:	philip, ed (mentors)
2010-04-14 19:08:06 +00:00
Gavin Atkinson a17f9fd691 The correct value of DEL is 0x7f, not 0xff. This is purely a documentation
issue - od(1) and hexdump(1) behave as expected.

PR:		docs/143869
Submitted by:	gcooper
MFC after:	2 weeks
2010-02-18 19:06:30 +00:00
Ed Schouten b7946da96b Build usr.bin/ with WARNS=6 by default.
Also add some missing $FreeBSD$ to keep svn happy.
2010-01-02 10:27:05 +00:00
Xin LI 821df508e8 Revert most part of 200420 as requested, as more review and polish is
needed.
2009-12-13 03:14:06 +00:00
Xin LI 6f2d322192 Remove unneeded header includes from usr.bin/ except contributed code.
Tested with:	make universe
2009-12-11 23:35:38 +00:00
Xin LI 884f7c03dd Use strlcpy() instead of explicitly set \0 on the tail of the array. 2009-06-23 23:32:24 +00:00
Ruslan Ermilov 30ee21d0dc Document the -d option. 2006-12-24 14:23:35 +00:00
Ruslan Ermilov 104c9971ee Fix markup. 2006-12-24 13:58:17 +00:00
Maxim Konovalov e4df92e126 o Simple strcpy/strcat replacement.
PR:		bin/101575
Founded by:	Dan Lukes
Obtained from:	OpenBSD, rev. 1.11 by deraadt
MFC after:	2 weeks
2006-08-09 19:12:10 +00:00
Joseph Koshy 1ae9926515 In 'od -c' mode, deal with printable but zero-width combining
characters correctly.  These characters are displayed "combined"
with a space character.

PR:		misc/100215
Submitted by:	"J.R. Oldroyd" <<fbsd AT opal.com>>
Reviewed by:	"J.R. Oldroyd" <<fbsd AT opal.com>> (revised patch)
MFC after:	3 days
2006-07-31 14:17:04 +00:00
Ruslan Ermilov a866e17077 Added the EXIT STATUS section where appropriate. 2005-01-17 07:44:44 +00:00
Ruslan Ermilov 4438d91ea2 Scheduled mdoc(7) sweep. 2005-01-11 10:32:52 +00:00
Tim J. Robbins 9a1e2d06e8 In next(), ensure that 'done' is set in the case when a file cannot
be opened, to avoid trying to read standard input after already closing
it, which resulted in EBADF errors.
2004-08-04 02:47:32 +00:00
Alexander Kabaev e95e2344a8 Do not predeclare __inline functions, this makes no sense and generates
a warning with gcc 3.4.x.
2004-07-28 07:10:03 +00:00
Johan Karlsson aae01d2439 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
2004-07-22 13:14:42 +00:00
Johan Karlsson 2345c82ea9 Revert WARNS bump until I figure out why this does not work. 2004-07-17 20:10:23 +00:00
Johan Karlsson 7eaedc0cd3 Include <string.h> to get memset and strcmp prototype.
Sort includes.

This is now WARNS=2 clean, bump WARNS to keep it clean.
2004-07-16 11:07:07 +00:00
Tim J. Robbins 40ccfb3137 Add POSIX-style support for multibyte characters to od(1): the 'c'
conversion interprets input bytes as multibyte sequences and displays
printable characters in the area corresponding to their first byte.
The remaining bytes are shown as "**".
2004-07-11 01:11:12 +00:00
Tim J. Robbins ee38feb205 Add a reference to od(1). 2004-07-10 13:11:00 +00:00
Tim J. Robbins 4f45d81178 Document missing multibyte character support in utilities specified
by POSIX.
2004-07-03 01:28:21 +00:00
Ruslan Ermilov 6a3e8b0adc Mechanically kill hard sentence breaks. 2004-07-02 22:22:35 +00:00
Ruslan Ermilov db8993ce9e Capitalize ASCII code names.
Approved by:	re
2002-12-05 08:50:00 +00:00
David Malone f4ac32def2 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
2002-09-04 23:29:10 +00:00
Mark Murray 8bd89d7e04 s/inline/__inline/ 2002-07-19 14:12:27 +00:00
David E. O'Brien e026a48c34 Consistently use FBSDID 2002-06-30 05:25:07 +00:00
Ruslan Ermilov c16cb68560 mdoc(7) police: tidy up the markup. 2002-05-29 18:49:22 +00:00
Tim J. Robbins 594830fbc1 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
2002-05-27 03:17:28 +00:00
Tim J. Robbins 7139b25561 Make the output tidier when multiple integer formats are requested by
attempting to line up values into columns.

Obtained from:	NetBSD (idea)
2002-05-17 08:54:32 +00:00
Tim J. Robbins cf021af20b 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
2002-05-17 07:14:55 +00:00
Tim J. Robbins 1b50831dd6 Declare variables that were extern'd in multiple places in hexdump.h.
PR:		36783
2002-05-17 06:32:00 +00:00
Tim J. Robbins 828663767a Add support for printing long doubles.
PR:		36783
2002-05-17 06:12:25 +00:00
Tim J. Robbins cf45dcc8e6 Print signed single-byte decimal integers correctly instead of implicitly
converting them to unsigned bytes.

PR:		36783
2002-05-17 05:43:00 +00:00
Tim J. Robbins ca9cbcece0 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
2002-05-17 05:20:30 +00:00
Philippe Charnier 3898680cf7 Use `The .Nm utility' 2002-04-19 23:44:58 +00:00
Warner Losh f1bb2cd2aa remove __P 2002-03-22 01:22:50 +00:00
David E. O'Brien 64049aa600 Slightly more efficient version of rev 1.6. 2002-03-07 23:01:55 +00:00
David E. O'Brien 95e5dc0476 A less intrusive version of rev 1.2. 2002-03-07 23:00:27 +00:00
David E. O'Brien 66da358885 Slightly more efficient fix to the const problem. 2002-03-07 22:58:16 +00:00
Mark Murray 91bd71d206 Remove leaf node WARNS?=2 (that mainly I added). This should
help the GCC3 transition and CURRENT in general.
2002-02-08 22:31:43 +00:00
Mark Murray c38cc7439c WARNS=2 fixups. 2001-12-02 12:09:41 +00:00
Ruslan Ermilov 6658f7a13b mdoc(7) police: Fixed the .Ex calls in manpages that describe more
than one utility.

PR:		docs/30437
Submitted by:	SUZUKI Koichi <koich@cac.co.jp>
2001-09-11 12:27:15 +00:00
Andrey A. Chernov 7a27e6571b File positions are off_t nowdays, not long, so:
strtol -> strtoll
  fseek -> fseeko

  NOTE: that fseek not works for >long offsets files per POSIX:

  [EOVERFLOW] For fseek( ), the resulting file offset would be a value which
  cannot be represented correctly in an object of type long.
2001-09-01 22:42:47 +00:00
Ruslan Ermilov d628d776c4 mdoc(7) police: utilize the new .Ex macro. 2001-08-15 09:09:47 +00:00
David E. O'Brien ac3c230c82 Remove the misnamed `emalloc' and replace its uses with the calloc (along
with error checking) that it actually was.
2001-07-24 14:11:09 +00:00
Dima Dorfman f247324df7 Remove whitespace at EOL. 2001-07-15 08:06:20 +00:00
Ruslan Ermilov dc12be5258 MAN[1-9] -> MAN. 2001-03-27 10:52:19 +00:00
Ruslan Ermilov 47dec78170 mdoc(7) police: use the default ``file ...'' feature of the .Ar macro. 2001-02-13 09:56:35 +00:00
Andrey A. Chernov 124d32d6a9 Change localizing to LC_ALL 2001-02-10 23:25:09 +00:00
Ruslan Ermilov d0353b836e mdoc(7) police: split punctuation characters + misc fixes. 2001-02-01 16:38:02 +00:00
Ruslan Ermilov f4ddfb3865 Prepare for mdoc(7)NG. 2000-12-27 16:52:31 +00:00
Ruslan Ermilov 9b88faecd3 Prepare for mdoc(7)NG. 2000-12-19 16:00:12 +00:00
Ruslan Ermilov 8fe908ef0c mdoc(7) police: use the new features of the Nm macro. 2000-11-20 19:21:22 +00:00
Kris Kennaway 3d3f014fd4 Oops, missed another printf() invocation with no format string. 2000-07-10 09:07:04 +00:00
Kris Kennaway 32d9afb622 Don't call printf() with no format string. 2000-07-10 09:05:31 +00:00
Alexey Zelkin c6d6e7726f Correct spelling : ascii -> ASCII
PR:		docs/13702
Submitted by:	Stephen J. Roznowski <sjr@home.com>
Reviewed by:	mpp
1999-09-20 09:15:23 +00:00
Peter Wemm c3aac50f28 $Id$ -> $FreeBSD$ 1999-08-28 01:08:13 +00:00
Bill Fumerola 9ef5c48bef Clean up some ambiguous nested if/elses. 1999-07-04 17:26:16 +00:00
Matthew Dillon b001517f54 PR: bin/9016
Fix bug with od/hd/hexdump. "*" lines are supposed to indicate one or
    duplicates of the previous line, but a small file with less then 16
    characters of zeros in it will be falsy identified as a repeat of
    the (non-existant) previous line.  i.e. the first line of output winds
    up being a "*".  Added a bit of code to handle the degenerate 'there is
    no previous line' case for the first line.
1998-12-13 06:40:18 +00:00
Andrey A. Chernov de34792f07 Localize it 1997-11-04 05:33:15 +00:00
Philippe Charnier 1073170298 Use err(3) instead of local redefinition, incorporate `hd' in usage str. 1997-07-10 06:48:24 +00:00
Steve Price d0dff61cfb Fix a minor nit in the .Dd macro invocation so that
the revision date is displayed correctly.
1997-06-23 04:52:13 +00:00
Warner Losh 1c8af87873 compare return value from getopt against -1 rather than EOF, per the final
posix standard on the topic.
1997-03-29 04:34:07 +00:00
Peter Wemm df3f5d9dd5 Merge from Lite2 1997-03-11 13:43:33 +00:00
Peter Wemm c115df18cd Revert $FreeBSD$ to $Id$ 1997-02-22 19:58:13 +00:00
Jordan K. Hubbard 1130b656e5 Make the long-awaited change from $Id$ to $FreeBSD$
This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore.  This update would have been
insane otherwise.
1997-01-14 07:20:47 +00:00
Wolfram Schneider e83201b43a delete doubled words, e.g.: "the the" -> "the" 1996-10-05 22:27:30 +00:00
Peter Wemm 7520d11894 Fix the previous commit. The second of the 8-character columns was
a duplicate of the first column of 8...
1996-10-04 23:29:38 +00:00
Joerg Wunsch 38d54d33e4 Now that we've already got "hexdump -C", make calling the command "hd"
having the same effect, and install a link for this.  There is
historic precedence for the command hd(1) (with roughly that output
format) in Xenix, SCO, and a few SysV's that tooks the idea.

Also, added a couple of spaces to the -C format to make the output
better readable.

Ok'ed by: phk
1996-09-29 04:17:24 +00:00
Poul-Henning Kamp f84276e918 Add '-C' "Canonical" format to hexdump:
$ hexdump -C /etc/resolv.conf
00000000 64 6f 6d 61 69 6e 20 64 6b 2e 74 66 73 2e 63 6f |domain dk.tfs.co|
00000010 6d 0a 6e 61 6d 65 73 65 72 76 65 72 20 31 34 30 |m.nameserver 140|
00000020 2e 31 34 35 2e 32 33 30 2e 31 30 0a             |.145.230.10.|
1996-09-16 21:18:48 +00:00
Wolfram Schneider b8923d4cc0 [HISTORY] command appeared in Version 1 AT&T UNIX
Obtained from: A Quarter Century of UNIX, Peter H. Salus, page 41
1996-08-29 18:06:19 +00:00
Mike Pritchard e229ffb7e9 Correct some cross references and some path names. 1996-04-06 09:47:30 +00:00
Mike Pritchard 7c87ef470d Correct some manual page cross reference errors. E.g. su is a section
one man page, not section eight.  This is the first round of such changes
and only fixes man pages in manual section one.
1996-02-02 00:26:12 +00:00
Rodney W. Grimes 7799f52a32 Remove trailing whitespace. 1995-05-30 06:41:30 +00:00
Jordan K. Hubbard 2c6983854a Change .0 man extents to .1, as reported by Julian Elischer. Whoops,
thought I'd gotten this one the first time around.
Reviewed by:
Submitted by:
1994-08-13 05:00:39 +00:00
Rodney W. Grimes 9b50d90275 BSD 4.4 Lite Usr.bin Sources 1994-05-27 12:33:43 +00:00