summaryrefslogtreecommitdiff
path: root/usr.bin/hexdump
diff options
context:
space:
mode:
authorIgor Sobrado <sobrado@cvs.openbsd.org>2014-04-15 15:35:25 +0000
committerIgor Sobrado <sobrado@cvs.openbsd.org>2014-04-15 15:35:25 +0000
commit22b310445c05bd0c618217b7c5277d6e01b0b73f (patch)
tree3d88123c20872eb2f406bb6a6b2ec34042df7f14 /usr.bin/hexdump
parent078abfe05af9b593e3342d716e75e71fb0f2cc3c (diff)
add -s (two-byte signed decimal display) to od(1), as mandated by POSIX;
remove cross reference to strings(1), it only made sense in the context of the old 4.3BSD od(1)'s -s flag. ok jmc@, millert@
Diffstat (limited to 'usr.bin/hexdump')
-rw-r--r--usr.bin/hexdump/od.116
-rw-r--r--usr.bin/hexdump/odsyntax.c9
2 files changed, 16 insertions, 9 deletions
diff --git a/usr.bin/hexdump/od.1 b/usr.bin/hexdump/od.1
index 7b0b339bac1..57d8b1ad17f 100644
--- a/usr.bin/hexdump/od.1
+++ b/usr.bin/hexdump/od.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: od.1,v 1.26 2014/04/14 22:51:20 sobrado Exp $
+.\" $OpenBSD: od.1,v 1.27 2014/04/15 15:35:24 sobrado Exp $
.\" $NetBSD: od.1,v 1.16 2001/12/07 01:23:42 bjh21 Exp $
.\"
.\" Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"/
-.Dd $Mdocdate: April 14 2014 $
+.Dd $Mdocdate: April 15 2014 $
.Dt OD 1
.Os
.Sh NAME
@@ -37,7 +37,7 @@
.Sh SYNOPSIS
.Nm od
.Bk -words
-.Op Fl aBbcDdeFfHhIiLlOovXx
+.Op Fl aBbcDdeFfHhIiLlOosvXx
.Op Fl A Ar base
.Op Fl j Ar offset
.Op Fl N Ar length
@@ -99,7 +99,7 @@ if no c escape exists for the character.
Display the input offset in octal, followed by four space-separated,
ten column, space filled, four-byte units of input data, in octal, per line.
.It Fl d
-.Em Two-byte decimal display .
+.Em Two-byte unsigned decimal display .
Display the input offset in octal, followed by eight
space-separated, five column, zero-filled, two-byte units
of input data, in unsigned decimal, per line.
@@ -186,6 +186,11 @@ of input data, in octal, per line.
Display the input offset in octal, followed by eight
space-separated, six column, zero-filled, two-byte units
of input data, in octal, per line.
+.It Fl s
+.Em Two-byte signed decimal display .
+Display the input offset in octal, followed by eight
+space-separated, five column, zero-filled, two-byte units
+of input data, in signed decimal, per line.
.It Fl t Ar type_string
Specify one or more output types.
The
@@ -298,8 +303,7 @@ option.
.Sh EXIT STATUS
.Ex -std od
.Sh SEE ALSO
-.Xr hexdump 1 ,
-.Xr strings 1
+.Xr hexdump 1
.Sh HISTORY
The
.Nm
diff --git a/usr.bin/hexdump/odsyntax.c b/usr.bin/hexdump/odsyntax.c
index 60e9c2020d0..701b96be16b 100644
--- a/usr.bin/hexdump/odsyntax.c
+++ b/usr.bin/hexdump/odsyntax.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: odsyntax.c,v 1.23 2014/04/14 22:51:20 sobrado Exp $ */
+/* $OpenBSD: odsyntax.c,v 1.24 2014/04/15 15:35:24 sobrado Exp $ */
/* $NetBSD: odsyntax.c,v 1.15 2001/12/07 15:14:29 bjh21 Exp $ */
/*-
@@ -90,7 +90,7 @@ oldsyntax(int argc, char ***argvp)
deprecated = 1;
argv = *argvp;
while ((ch = getopt(argc, argv,
- "A:aBbcDdeFfHhIij:LlN:Oot:vXx")) != -1)
+ "A:aBbcDdeFfHhIij:LlN:Oost:vXx")) != -1)
switch (ch) {
case 'A':
switch (*optarg) {
@@ -171,6 +171,9 @@ oldsyntax(int argc, char ***argvp)
case 'O':
odadd("4/4 \" %011o \" \"\\n\"");
break;
+ case 's':
+ odadd("8/2 \" %05d \" \"\\n\"");
+ break;
case 't':
posixtypes(optarg);
break;
@@ -294,7 +297,7 @@ void
oldusage(void)
{
extern char *__progname;
- fprintf(stderr, "usage: %s [-aBbcDdeFfHhIiLlOovXx] [-A base] "
+ fprintf(stderr, "usage: %s [-aBbcDdeFfHhIiLlOosvXx] [-A base] "
"[-j offset] [-N length]\n"
"\t[-t type_string] [[+]offset[.][Bb]] [file ...]\n", __progname);
exit(1);