xref: /dragonfly/lib/libutil/hexdump.3 (revision 1975d09e)
1.\" -*- nroff -*-
2.\"
3.\" Copyright (c) 2003 Scott Long
4.\"
5.\" All rights reserved.
6.\"
7.\" This program is free software.
8.\"
9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions
11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright
13.\"    notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright
15.\"    notice, this list of conditions and the following disclaimer in the
16.\"    documentation and/or other materials provided with the distribution.
17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
19.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
22.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28.\"
29.\" $FreeBSD: head/lib/libutil/hexdump.3 206622 2010-04-14 19:08:06Z uqs $
30.\"
31.Dd November 3, 2012
32.Dt HEXDUMP 3
33.Os
34.Sh NAME
35.Nm hexdump
36.Nd "dump a block of bytes to standard out in hexadecimal form"
37.Sh LIBRARY
38.Lb libutil
39.Sh SYNOPSIS
40.In libutil.h
41.Ft void
42.Fn hexdump "const void *ptr" "int length" "const char *hdr" "int flags"
43.Sh DESCRIPTION
44The
45.Fn hexdump
46function prints an array of bytes to standard out in hexadecimal form,
47along with the
48.Tn ASCII
49representation of the bytes, if possible.
50By default, each line of
51output will start with an offset count, followed by 16 hexadecimal values,
52followed by 16
53.Tn ASCII
54characters.
55.Bl -tag -width indent
56.It Fa ptr
57Pointer to the array of bytes to print.
58It does not need to be
59.Dv NUL Ns
60-terminated.
61.It Fa length
62Number of bytes to print.
63.It Fa hdr
64Pointer to a
65.Dv NUL Ns
66-terminated character string that will be prepended to each
67line of output.
68A value of
69.Dv NULL
70implies that no header will be printed.
71.It Fa flags
72Flags for controlling the formatting of the output.
73.Bl -tag -width ".Dv HD_OMIT_COUNT"
74.It Bits 0-7
75Integer value of the number of bytes to display on each line.
76A value of 0 implies that the default value of 16 will be used.
77.It Bits 8-15
78Character
79.Tn ASCII
80value to use as the separator for the hexadecimal output.
81A value of 0 implies that the default value of 32
82.Tn ( ASCII
83space) will be used.
84.It Dv HD_OMIT_COUNT
85Do not print the offset column at the beginning of each line.
86.It Dv HD_OMIT_HEX
87Do not print the hexadecimal values on each line.
88.It Dv HD_OMIT_CHARS
89Do not print the character values on each line.
90.El
91.El
92.Sh SEE ALSO
93.Xr ascii 7
94.Sh AUTHORS
95This manual page was written by
96.An Scott Long .
97