Mercurial > vim
annotate runtime/doc/xxd.1 @ 34074:1629cc65d78d v9.1.0006
patch 9.1.0006: is*() and to*() function may be unsafe
Commit: https://github.com/vim/vim/commit/184f71cc6868a240dc872ed2852542bbc1d43e28
Author: Keith Thompson <Keith.S.Thompson@gmail.com>
Date: Thu Jan 4 21:19:04 2024 +0100
patch 9.1.0006: is*() and to*() function may be unsafe
Problem: is*() and to*() function may be unsafe
Solution: Add SAFE_* macros and start using those instead
(Keith Thompson)
Use SAFE_() macros for is*() and to*() functions
The standard is*() and to*() functions declared in <ctype.h> have
undefined behavior for negative arguments other than EOF. If plain char
is signed, passing an unchecked value from argv for from user input
to one of these functions has undefined behavior.
Solution: Add SAFE_*() macros that cast the argument to unsigned char.
Most implementations behave sanely for negative arguments, and most
character values in practice are non-negative, but it's still best
to avoid undefined behavior.
The change from #13347 has been omitted, as this has already been
separately fixed in commit ac709e2fc0db6d31abb7da96f743c40956b60c3a
(v9.0.2054)
fixes: #13332
closes: #13347
Signed-off-by: Keith Thompson <Keith.S.Thompson@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 04 Jan 2024 21:30:04 +0100 |
parents | 33cbd544dc46 |
children | 42f061099b39 |
rev | line source |
---|---|
7 | 1 .TH XXD 1 "August 1996" "Manual page for xxd" |
2 .\" | |
3 .\" 21st May 1996 | |
4 .\" Man page author: | |
5 .\" Tony Nugent <tony@sctnugen.ppp.gu.edu.au> <T.Nugent@sct.gu.edu.au> | |
6 .\" Changes by Bram Moolenaar <Bram@vim.org> | |
7 .SH NAME | |
8 .I xxd | |
32780
36c49f10843b
patch 9.0.1706: typos in the xxd manpage
Christian Brabandt <cb@256bit.org>
parents:
29330
diff
changeset
|
9 \- make a hex dump or do the reverse. |
7 | 10 .SH SYNOPSIS |
11 .B xxd | |
12 \-h[elp] | |
13 .br | |
14 .B xxd | |
15 [options] [infile [outfile]] | |
16 .br | |
17 .B xxd | |
18 \-r[evert] [options] [infile [outfile]] | |
19 .SH DESCRIPTION | |
20 .I xxd | |
21 creates a hex dump of a given file or standard input. | |
22 It can also convert a hex dump back to its original binary form. | |
23 Like | |
216 | 24 .BR uuencode (1) |
7 | 25 and |
216 | 26 .BR uudecode (1) |
7 | 27 it allows the transmission of binary data in a `mail-safe' ASCII representation, |
28 but has the advantage of decoding to standard output. | |
29 Moreover, it can be used to perform binary file patching. | |
30 .SH OPTIONS | |
31 If no | |
32 .I infile | |
33 is given, standard input is read. | |
34 If | |
35 .I infile | |
36 is specified as a | |
37 .RB \` \- ' | |
38 character, then input is taken from standard input. | |
39 If no | |
40 .I outfile | |
41 is given (or a | |
42 .RB \` \- ' | |
43 character is in its place), results are sent to standard output. | |
44 .PP | |
45 Note that a "lazy" parser is used which does not check for more than the first | |
46 option letter, unless the option is followed by a parameter. | |
47 Spaces between a single option letter and its parameter are optional. | |
48 Parameters to options can be specified in decimal, hexadecimal or octal | |
49 notation. | |
50 Thus | |
51 .BR \-c8 , | |
52 .BR "\-c 8" , | |
53 .B \-c 010 | |
54 and | |
55 .B \-cols 8 | |
56 are all equivalent. | |
57 .PP | |
58 .TP | |
59 .IR \-a " | " \-autoskip | |
32780
36c49f10843b
patch 9.0.1706: typos in the xxd manpage
Christian Brabandt <cb@256bit.org>
parents:
29330
diff
changeset
|
60 Toggle autoskip: A single '*' replaces NUL-lines. Default off. |
7 | 61 .TP |
62 .IR \-b " | " \-bits | |
32780
36c49f10843b
patch 9.0.1706: typos in the xxd manpage
Christian Brabandt <cb@256bit.org>
parents:
29330
diff
changeset
|
63 Switch to bits (binary digits) dump, rather than hex dump. |
7 | 64 This option writes octets as eight digits "1"s and "0"s instead of a normal |
36 | 65 hexadecimal dump. Each line is preceded by a line number in hexadecimal and |
32780
36c49f10843b
patch 9.0.1706: typos in the xxd manpage
Christian Brabandt <cb@256bit.org>
parents:
29330
diff
changeset
|
66 followed by an ASCII (or EBCDIC) representation. The command line switches |
33496
33cbd544dc46
patch 9.0.1998: xxd: cannot reverse a bit dump
Christian Brabandt <cb@256bit.org>
parents:
33444
diff
changeset
|
67 \-p, \-i do not work with this mode. |
7 | 68 .TP |
69 .IR "\-c cols " | " \-cols cols" | |
13571
362b27e3f702
patch 8.0.1658: capitalize argument not available in long form
Christian Brabandt <cb@256bit.org>
parents:
6655
diff
changeset
|
70 Format |
7 | 71 .RI < cols > |
72 octets per line. Default 16 (\-i: 12, \-ps: 30, \-b: 6). Max 256. | |
32780
36c49f10843b
patch 9.0.1706: typos in the xxd manpage
Christian Brabandt <cb@256bit.org>
parents:
29330
diff
changeset
|
73 No maximum for \-ps. With \-ps, 0 results in one long line of output. |
7 | 74 .TP |
13571
362b27e3f702
patch 8.0.1658: capitalize argument not available in long form
Christian Brabandt <cb@256bit.org>
parents:
6655
diff
changeset
|
75 .IR \-C " | " \-capitalize |
362b27e3f702
patch 8.0.1658: capitalize argument not available in long form
Christian Brabandt <cb@256bit.org>
parents:
6655
diff
changeset
|
76 Capitalize variable names in C include file style, when using \-i. |
362b27e3f702
patch 8.0.1658: capitalize argument not available in long form
Christian Brabandt <cb@256bit.org>
parents:
6655
diff
changeset
|
77 .TP |
7 | 78 .IR \-E " | " \-EBCDIC |
79 Change the character encoding in the righthand column from ASCII to EBCDIC. | |
80 This does not change the hexadecimal representation. The option is | |
81 meaningless in combinations with \-r, \-p or \-i. | |
82 .TP | |
6655 | 83 .IR \-e |
32780
36c49f10843b
patch 9.0.1706: typos in the xxd manpage
Christian Brabandt <cb@256bit.org>
parents:
29330
diff
changeset
|
84 Switch to little-endian hex dump. |
6655 | 85 This option treats byte groups as words in little-endian byte order. |
86 The default grouping of 4 bytes may be changed using | |
87 .RI "" \-g . | |
32780
36c49f10843b
patch 9.0.1706: typos in the xxd manpage
Christian Brabandt <cb@256bit.org>
parents:
29330
diff
changeset
|
88 This option only applies to the hex dump, leaving the ASCII (or EBCDIC) |
6655 | 89 representation unchanged. |
90 The command line switches | |
91 \-r, \-p, \-i do not work with this mode. | |
92 .TP | |
7 | 93 .IR "\-g bytes " | " \-groupsize bytes" |
13571
362b27e3f702
patch 8.0.1658: capitalize argument not available in long form
Christian Brabandt <cb@256bit.org>
parents:
6655
diff
changeset
|
94 Separate the output of every |
7 | 95 .RI < bytes > |
32780
36c49f10843b
patch 9.0.1706: typos in the xxd manpage
Christian Brabandt <cb@256bit.org>
parents:
29330
diff
changeset
|
96 bytes (two hex characters or eight bit digits each) by a whitespace. |
7 | 97 Specify |
98 .I \-g 0 | |
99 to suppress grouping. | |
100 .RI < Bytes "> defaults to " 2 | |
6655 | 101 in normal mode, \fI4\fP in little-endian mode and \fI1\fP in bits mode. |
32780
36c49f10843b
patch 9.0.1706: typos in the xxd manpage
Christian Brabandt <cb@256bit.org>
parents:
29330
diff
changeset
|
102 Grouping does not apply to PostScript or include style. |
7 | 103 .TP |
104 .IR \-h " | " \-help | |
13571
362b27e3f702
patch 8.0.1658: capitalize argument not available in long form
Christian Brabandt <cb@256bit.org>
parents:
6655
diff
changeset
|
105 Print a summary of available commands and exit. No hex dumping is performed. |
7 | 106 .TP |
107 .IR \-i " | " \-include | |
13571
362b27e3f702
patch 8.0.1658: capitalize argument not available in long form
Christian Brabandt <cb@256bit.org>
parents:
6655
diff
changeset
|
108 Output in C include file style. A complete static array definition is written |
7 | 109 (named after the input file), unless xxd reads from stdin. |
110 .TP | |
111 .IR "\-l len " | " \-len len" | |
13571
362b27e3f702
patch 8.0.1658: capitalize argument not available in long form
Christian Brabandt <cb@256bit.org>
parents:
6655
diff
changeset
|
112 Stop after writing |
7 | 113 .RI < len > |
114 octets. | |
115 .TP | |
29330
948c947cb1ed
patch 9.0.0008: cannot specify the variable name for "xxd -i"
Bram Moolenaar <Bram@vim.org>
parents:
27118
diff
changeset
|
116 .I "\-n name " | " \-name name" |
948c947cb1ed
patch 9.0.0008: cannot specify the variable name for "xxd -i"
Bram Moolenaar <Bram@vim.org>
parents:
27118
diff
changeset
|
117 Override the variable name output when \-i is used. The array is named |
948c947cb1ed
patch 9.0.0008: cannot specify the variable name for "xxd -i"
Bram Moolenaar <Bram@vim.org>
parents:
27118
diff
changeset
|
118 \fIname\fP and the length is named \fIname\fP_len. |
948c947cb1ed
patch 9.0.0008: cannot specify the variable name for "xxd -i"
Bram Moolenaar <Bram@vim.org>
parents:
27118
diff
changeset
|
119 .TP |
6655 | 120 .I \-o offset |
13571
362b27e3f702
patch 8.0.1658: capitalize argument not available in long form
Christian Brabandt <cb@256bit.org>
parents:
6655
diff
changeset
|
121 Add |
6655 | 122 .RI < offset > |
123 to the displayed file position. | |
124 .TP | |
7 | 125 .IR \-p " | " \-ps " | " \-postscript " | " \-plain |
32780
36c49f10843b
patch 9.0.1706: typos in the xxd manpage
Christian Brabandt <cb@256bit.org>
parents:
29330
diff
changeset
|
126 Output in PostScript continuous hex dump style. Also known as plain hex dump |
7 | 127 style. |
128 .TP | |
129 .IR \-r " | " \-revert | |
32780
36c49f10843b
patch 9.0.1706: typos in the xxd manpage
Christian Brabandt <cb@256bit.org>
parents:
29330
diff
changeset
|
130 Reverse operation: convert (or patch) hex dump into binary. |
7 | 131 If not writing to stdout, xxd writes into its output file without truncating |
132 it. Use the combination | |
133 .I \-r \-p | |
134 to read plain hexadecimal dumps without line number information and without a | |
32780
36c49f10843b
patch 9.0.1706: typos in the xxd manpage
Christian Brabandt <cb@256bit.org>
parents:
29330
diff
changeset
|
135 particular column layout. Additional whitespace and line breaks are allowed |
33496
33cbd544dc46
patch 9.0.1998: xxd: cannot reverse a bit dump
Christian Brabandt <cb@256bit.org>
parents:
33444
diff
changeset
|
136 anywhere. Use the combination |
33cbd544dc46
patch 9.0.1998: xxd: cannot reverse a bit dump
Christian Brabandt <cb@256bit.org>
parents:
33444
diff
changeset
|
137 .I \-r \-b |
33cbd544dc46
patch 9.0.1998: xxd: cannot reverse a bit dump
Christian Brabandt <cb@256bit.org>
parents:
33444
diff
changeset
|
138 to read a bits dump instead of a hex dump. |
7 | 139 .TP |
33099
49f317597430
patch 9.0.1834: Some problems with xxd coloring
Christian Brabandt <cb@256bit.org>
parents:
33083
diff
changeset
|
140 .IR \-R " " when |
33444
0a2c50b59f30
runtime(doc): update xxd manpage and mention $NO_COLOR env
Christian Brabandt <cb@256bit.org>
parents:
33099
diff
changeset
|
141 In output the hex-value and the value are both colored with the same color |
0a2c50b59f30
runtime(doc): update xxd manpage and mention $NO_COLOR env
Christian Brabandt <cb@256bit.org>
parents:
33099
diff
changeset
|
142 depending on the hex-value. Mostly helping to differentiate printable and |
0a2c50b59f30
runtime(doc): update xxd manpage and mention $NO_COLOR env
Christian Brabandt <cb@256bit.org>
parents:
33099
diff
changeset
|
143 non-printable characters. |
33099
49f317597430
patch 9.0.1834: Some problems with xxd coloring
Christian Brabandt <cb@256bit.org>
parents:
33083
diff
changeset
|
144 .I \fIwhen\fP |
33083
79b2eb83f2df
patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents:
32780
diff
changeset
|
145 is |
79b2eb83f2df
patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents:
32780
diff
changeset
|
146 .BR never ", " always ", or " auto . |
33444
0a2c50b59f30
runtime(doc): update xxd manpage and mention $NO_COLOR env
Christian Brabandt <cb@256bit.org>
parents:
33099
diff
changeset
|
147 When the |
0a2c50b59f30
runtime(doc): update xxd manpage and mention $NO_COLOR env
Christian Brabandt <cb@256bit.org>
parents:
33099
diff
changeset
|
148 .BR $NO_COLOR |
0a2c50b59f30
runtime(doc): update xxd manpage and mention $NO_COLOR env
Christian Brabandt <cb@256bit.org>
parents:
33099
diff
changeset
|
149 environment variable is set, colorization will be disabled. |
33083
79b2eb83f2df
patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents:
32780
diff
changeset
|
150 .TP |
7 | 151 .I \-seek offset |
152 When used after | |
216 | 153 .IR \-r : |
154 revert with | |
7 | 155 .RI < offset > |
32780
36c49f10843b
patch 9.0.1706: typos in the xxd manpage
Christian Brabandt <cb@256bit.org>
parents:
29330
diff
changeset
|
156 added to file positions found in hex dump. |
7 | 157 .TP |
216 | 158 .I \-s [+][\-]seek |
13571
362b27e3f702
patch 8.0.1658: capitalize argument not available in long form
Christian Brabandt <cb@256bit.org>
parents:
6655
diff
changeset
|
159 Start at |
7 | 160 .RI < seek > |
161 bytes abs. (or rel.) infile offset. | |
1125 | 162 \fI+ \fRindicates that the seek is relative to the current stdin file position |
7 | 163 (meaningless when not reading from stdin). \fI\- \fRindicates that the seek |
164 should be that many characters from the end of the input (or if combined with | |
216 | 165 \fI+\fR: before the current stdin file position). |
7 | 166 Without \-s option, xxd starts at the current file position. |
167 .TP | |
168 .I \-u | |
32780
36c49f10843b
patch 9.0.1706: typos in the xxd manpage
Christian Brabandt <cb@256bit.org>
parents:
29330
diff
changeset
|
169 Use upper-case hex letters. Default is lower-case. |
7 | 170 .TP |
171 .IR \-v " | " \-version | |
13571
362b27e3f702
patch 8.0.1658: capitalize argument not available in long form
Christian Brabandt <cb@256bit.org>
parents:
6655
diff
changeset
|
172 Show version string. |
7 | 173 .SH CAVEATS |
174 .PP | |
175 .I xxd \-r | |
32780
36c49f10843b
patch 9.0.1706: typos in the xxd manpage
Christian Brabandt <cb@256bit.org>
parents:
29330
diff
changeset
|
176 has some built-in magic while evaluating line number information. |
36c49f10843b
patch 9.0.1706: typos in the xxd manpage
Christian Brabandt <cb@256bit.org>
parents:
29330
diff
changeset
|
177 If the output file is seekable, then the line numbers at the start of each |
36c49f10843b
patch 9.0.1706: typos in the xxd manpage
Christian Brabandt <cb@256bit.org>
parents:
29330
diff
changeset
|
178 hex dump line may be out of order, lines may be missing, or overlapping. In |
7 | 179 these cases xxd will lseek(2) to the next position. If the output file is not |
180 seekable, only gaps are allowed, which will be filled by null-bytes. | |
181 .PP | |
182 .I xxd \-r | |
183 never generates parse errors. Garbage is silently skipped. | |
184 .PP | |
32780
36c49f10843b
patch 9.0.1706: typos in the xxd manpage
Christian Brabandt <cb@256bit.org>
parents:
29330
diff
changeset
|
185 When editing hex dumps, please note that |
7 | 186 .I xxd \-r |
187 skips everything on the input line after reading enough columns of hexadecimal | |
32780
36c49f10843b
patch 9.0.1706: typos in the xxd manpage
Christian Brabandt <cb@256bit.org>
parents:
29330
diff
changeset
|
188 data (see option \-c). This also means that changes to the printable ASCII (or |
36c49f10843b
patch 9.0.1706: typos in the xxd manpage
Christian Brabandt <cb@256bit.org>
parents:
29330
diff
changeset
|
189 EBCDIC) columns are always ignored. Reverting a plain (or PostScript) style |
36c49f10843b
patch 9.0.1706: typos in the xxd manpage
Christian Brabandt <cb@256bit.org>
parents:
29330
diff
changeset
|
190 hex dump with xxd \-r \-p does not depend on the correct number of columns. Here, anything that looks like a pair of hex digits is interpreted. |
7 | 191 .PP |
192 Note the difference between | |
193 .br | |
194 \fI% xxd \-i file\fR | |
195 .br | |
196 and | |
197 .br | |
216 | 198 \fI% xxd \-i < file\fR |
7 | 199 .PP |
810 | 200 .I xxd \-s +seek |
7 | 201 may be different from |
216 | 202 .IR "xxd \-s seek" , |
203 as lseek(2) is used to "rewind" input. A '+' | |
7 | 204 makes a difference if the input source is stdin, and if stdin's file position |
205 is not at the start of the file by the time xxd is started and given its input. | |
32780
36c49f10843b
patch 9.0.1706: typos in the xxd manpage
Christian Brabandt <cb@256bit.org>
parents:
29330
diff
changeset
|
206 The following examples may help to clarify (or further confuse!): |
7 | 207 .PP |
208 Rewind stdin before reading; needed because the `cat' has already read to the | |
209 end of stdin. | |
210 .br | |
1125 | 211 \fI% sh \-c "cat > plain_copy; xxd \-s 0 > hex_copy" < file\fR |
7 | 212 .PP |
32780
36c49f10843b
patch 9.0.1706: typos in the xxd manpage
Christian Brabandt <cb@256bit.org>
parents:
29330
diff
changeset
|
213 Hex dump from file position 0x480 (=1024+128) onwards. |
7 | 214 The `+' sign means "relative to the current position", thus the `128' adds to |
215 the 1k where dd left off. | |
216 .br | |
1125 | 217 \fI% sh \-c "dd of=plain_snippet bs=1k count=1; xxd \-s +128 > hex_snippet" < file\fR |
7 | 218 .PP |
32780
36c49f10843b
patch 9.0.1706: typos in the xxd manpage
Christian Brabandt <cb@256bit.org>
parents:
29330
diff
changeset
|
219 Hex dump from file position 0x100 (=1024\-768) onwards. |
7 | 220 .br |
1125 | 221 \fI% sh \-c "dd of=plain_snippet bs=1k count=1; xxd \-s +\-768 > hex_snippet" < file\fR |
7 | 222 .PP |
223 However, this is a rare situation and the use of `+' is rarely needed. | |
36 | 224 The author prefers to monitor the effect of xxd with strace(1) or truss(1), whenever \-s is used. |
7 | 225 .SH EXAMPLES |
226 .PP | |
227 .br | |
228 Print everything but the first three lines (hex 0x30 bytes) of | |
810 | 229 .BR file . |
7 | 230 .br |
1125 | 231 \fI% xxd \-s 0x30 file\fR |
7 | 232 .PP |
233 .br | |
234 Print 3 lines (hex 0x30 bytes) from the end of | |
810 | 235 .BR file . |
7 | 236 .br |
1125 | 237 \fI% xxd \-s \-0x30 file\fR |
7 | 238 .PP |
239 .br | |
32780
36c49f10843b
patch 9.0.1706: typos in the xxd manpage
Christian Brabandt <cb@256bit.org>
parents:
29330
diff
changeset
|
240 Print 120 bytes as a continuous hex dump with 20 octets per line. |
7 | 241 .br |
242 \fI% xxd \-l 120 \-ps \-c 20 xxd.1\fR | |
243 .br | |
36 | 244 2e54482058584420312022417567757374203139 |
7 | 245 .br |
36 | 246 39362220224d616e75616c207061676520666f72 |
7 | 247 .br |
36 | 248 20787864220a2e5c220a2e5c222032317374204d |
7 | 249 .br |
36 | 250 617920313939360a2e5c22204d616e2070616765 |
7 | 251 .br |
36 | 252 20617574686f723a0a2e5c2220202020546f6e79 |
7 | 253 .br |
36 | 254 204e7567656e74203c746f6e79407363746e7567 |
7 | 255 .br |
256 | |
257 .br | |
32780
36c49f10843b
patch 9.0.1706: typos in the xxd manpage
Christian Brabandt <cb@256bit.org>
parents:
29330
diff
changeset
|
258 Hex dump the first 120 bytes of this man page with 12 octets per line. |
7 | 259 .br |
260 \fI% xxd \-l 120 \-c 12 xxd.1\fR | |
261 .br | |
36 | 262 0000000: 2e54 4820 5858 4420 3120 2241 .TH XXD 1 "A |
7 | 263 .br |
36 | 264 000000c: 7567 7573 7420 3139 3936 2220 ugust 1996" |
7 | 265 .br |
36 | 266 0000018: 224d 616e 7561 6c20 7061 6765 "Manual page |
7 | 267 .br |
36 | 268 0000024: 2066 6f72 2078 7864 220a 2e5c for xxd"..\\ |
7 | 269 .br |
36 | 270 0000030: 220a 2e5c 2220 3231 7374 204d "..\\" 21st M |
7 | 271 .br |
36 | 272 000003c: 6179 2031 3939 360a 2e5c 2220 ay 1996..\\" |
7 | 273 .br |
36 | 274 0000048: 4d61 6e20 7061 6765 2061 7574 Man page aut |
7 | 275 .br |
36 | 276 0000054: 686f 723a 0a2e 5c22 2020 2020 hor:..\\" |
7 | 277 .br |
36 | 278 0000060: 546f 6e79 204e 7567 656e 7420 Tony Nugent |
7 | 279 .br |
36 | 280 000006c: 3c74 6f6e 7940 7363 746e 7567 <tony@sctnug |
7 | 281 .PP |
282 .br | |
283 Display just the date from the file xxd.1 | |
284 .br | |
36 | 285 \fI% xxd \-s 0x36 \-l 13 \-c 13 xxd.1\fR |
7 | 286 .br |
36 | 287 0000036: 3231 7374 204d 6179 2031 3939 36 21st May 1996 |
7 | 288 .PP |
289 .br | |
290 Copy | |
291 .B input_file | |
292 to | |
293 .B output_file | |
294 and prepend 100 bytes of value 0x00. | |
295 .br | |
810 | 296 \fI% xxd input_file | xxd \-r \-s 100 > output_file\fR |
7 | 297 .br |
298 | |
299 .br | |
300 Patch the date in the file xxd.1 | |
301 .br | |
810 | 302 \fI% echo "0000037: 3574 68" | xxd \-r \- xxd.1\fR |
7 | 303 .br |
36 | 304 \fI% xxd \-s 0x36 \-l 13 \-c 13 xxd.1\fR |
7 | 305 .br |
36 | 306 0000036: 3235 7468 204d 6179 2031 3939 36 25th May 1996 |
7 | 307 .PP |
308 .br | |
309 Create a 65537 byte file with all bytes 0x00, | |
310 except for the last one which is 'A' (hex 0x41). | |
311 .br | |
810 | 312 \fI% echo "010000: 41" | xxd \-r > file\fR |
7 | 313 .PP |
314 .br | |
32780
36c49f10843b
patch 9.0.1706: typos in the xxd manpage
Christian Brabandt <cb@256bit.org>
parents:
29330
diff
changeset
|
315 Hex dump this file with autoskip. |
7 | 316 .br |
317 \fI% xxd \-a \-c 12 file\fR | |
318 .br | |
319 0000000: 0000 0000 0000 0000 0000 0000 ............ | |
320 .br | |
321 * | |
322 .br | |
323 000fffc: 0000 0000 40 ....A | |
324 .PP | |
325 Create a 1 byte file containing a single 'A' character. | |
32780
36c49f10843b
patch 9.0.1706: typos in the xxd manpage
Christian Brabandt <cb@256bit.org>
parents:
29330
diff
changeset
|
326 The number after '\-r \-s' adds to the line numbers found in the file; |
7 | 327 in effect, the leading bytes are suppressed. |
328 .br | |
810 | 329 \fI% echo "010000: 41" | xxd \-r \-s \-0x10000 > file\fR |
7 | 330 .PP |
331 Use xxd as a filter within an editor such as | |
332 .B vim(1) | |
32780
36c49f10843b
patch 9.0.1706: typos in the xxd manpage
Christian Brabandt <cb@256bit.org>
parents:
29330
diff
changeset
|
333 to hex dump a region marked between `a' and `z'. |
7 | 334 .br |
335 \fI:'a,'z!xxd\fR | |
336 .PP | |
337 Use xxd as a filter within an editor such as | |
338 .B vim(1) | |
32780
36c49f10843b
patch 9.0.1706: typos in the xxd manpage
Christian Brabandt <cb@256bit.org>
parents:
29330
diff
changeset
|
339 to recover a binary hex dump marked between `a' and `z'. |
7 | 340 .br |
341 \fI:'a,'z!xxd \-r\fR | |
342 .PP | |
343 Use xxd as a filter within an editor such as | |
344 .B vim(1) | |
32780
36c49f10843b
patch 9.0.1706: typos in the xxd manpage
Christian Brabandt <cb@256bit.org>
parents:
29330
diff
changeset
|
345 to recover one line of a hex dump. Move the cursor over the line and type: |
7 | 346 .br |
347 \fI!!xxd \-r\fR | |
348 .PP | |
349 Read single characters from a serial line | |
350 .br | |
351 \fI% xxd \-c1 < /dev/term/b &\fR | |
352 .br | |
353 \fI% stty < /dev/term/b \-echo \-opost \-isig \-icanon min 1\fR | |
354 .br | |
355 \fI% echo \-n foo > /dev/term/b\fR | |
356 .PP | |
357 .SH "RETURN VALUES" | |
358 The following error values are returned: | |
359 .TP | |
360 0 | |
361 no errors encountered. | |
362 .TP | |
363 \-1 | |
32780
36c49f10843b
patch 9.0.1706: typos in the xxd manpage
Christian Brabandt <cb@256bit.org>
parents:
29330
diff
changeset
|
364 operation not supported |
36c49f10843b
patch 9.0.1706: typos in the xxd manpage
Christian Brabandt <cb@256bit.org>
parents:
29330
diff
changeset
|
365 \%(\c |
36c49f10843b
patch 9.0.1706: typos in the xxd manpage
Christian Brabandt <cb@256bit.org>
parents:
29330
diff
changeset
|
366 .I \%xxd \-r \-i |
7 | 367 still impossible). |
368 .TP | |
369 1 | |
370 error while parsing options. | |
371 .TP | |
372 2 | |
373 problems with input file. | |
374 .TP | |
375 3 | |
376 problems with output file. | |
377 .TP | |
378 4,5 | |
379 desired seek position is unreachable. | |
380 .SH "SEE ALSO" | |
381 uuencode(1), uudecode(1), patch(1) | |
382 .br | |
383 .SH WARNINGS | |
32780
36c49f10843b
patch 9.0.1706: typos in the xxd manpage
Christian Brabandt <cb@256bit.org>
parents:
29330
diff
changeset
|
384 The tool's weirdness matches its creator's brain. |
7 | 385 Use entirely at your own risk. Copy files. Trace it. Become a wizard. |
386 .br | |
387 .SH VERSION | |
388 This manual page documents xxd version 1.7 | |
389 .SH AUTHOR | |
390 .br | |
391 (c) 1990-1997 by Juergen Weigert | |
392 .br | |
810 | 393 <jnweiger@informatik.uni\-erlangen.de> |
7 | 394 .LP |
395 Distribute freely and credit me, | |
396 .br | |
397 make money and share with me, | |
398 .br | |
399 lose money and don't ask me. | |
400 .PP | |
401 Manual page started by Tony Nugent | |
402 .br | |
403 <tony@sctnugen.ppp.gu.edu.au> <T.Nugent@sct.gu.edu.au> | |
404 .br | |
405 Small changes by Bram Moolenaar. | |
406 Edited by Juergen Weigert. | |
407 .PP |