]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - lib/libutil/hexdump.3
- Copy stable/10@285827 to releng/10.2 in preparation for 10.2-RC1
[FreeBSD/releng/10.2.git] / lib / libutil / hexdump.3
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$
30 .\"
31 .Dd May 8, 2014
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 SYNOPSIS
38 .In libutil.h
39 .In sys/sbuf.h
40 .Ft void
41 .Fn hexdump "void *ptr" "int length" "const char *hdr" "int flags"
42 .Ft void
43 .Fo sbuf_hexdump
44 .Fa "struct sbuf *sb"
45 .Fa "void *ptr"
46 .Fa "int length"
47 .Fa "const char *hdr"
48 .Fa "int flags"
49 .Fc
50 .Sh DESCRIPTION
51 The
52 .Fn hexdump
53 function prints an array of bytes to standard out in hexadecimal form,
54 along with the
55 .Tn ASCII
56 representation of the bytes, if possible.
57 By default, each line of
58 output will start with an offset count, followed by 16 hexadecimal values,
59 followed by 16
60 .Tn ASCII
61 characters.
62 .Pp
63 The
64 .Fn sbuf_hexdump
65 function prints the hexdump to the supplied
66 .Xr sbuf 9 .
67 .Bl -tag -width indent
68 .It Fa ptr
69 Pointer to the array of bytes to print.
70 It does not need to be
71 .Dv NUL Ns
72 -terminated.
73 .It Fa length
74 Number of bytes to print.
75 .It Fa hdr
76 Pointer to a
77 .Dv NUL Ns
78 -terminated character string that will be prepended to each
79 line of output.
80 A value of
81 .Dv NULL
82 implies that no header will be printed.
83 .It Fa flags
84 Flags for controlling the formatting of the output.
85 .Bl -tag -width ".Dv HD_OMIT_COUNT"
86 .It Bits 0-7
87 Integer value of the number of bytes to display on each line.
88 A value of 0 implies that the default value of 16 will be used.
89 .It Bits 8-15
90 Character
91 .Tn ASCII
92 value to use as the separator for the hexadecimal output.
93 A value of 0 implies that the default value of 32
94 .Tn ( ASCII
95 space) will be used.
96 .It Dv HD_OMIT_COUNT
97 Do not print the offset column at the beginning of each line.
98 .It Dv HD_OMIT_HEX
99 Do not print the hexadecimal values on each line.
100 .It Dv HD_OMIT_CHARS
101 Do not print the character values on each line.
102 .El
103 .El
104 .Sh SEE ALSO
105 .Xr ascii 7 ,
106 .Xr sbuf 9
107 .Sh AUTHORS
108 This manual page was written by
109 .An Scott Long .