logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

od.1p (26574B)


  1. '\" et
  2. .TH OD "1P" 2017 "IEEE/The Open Group" "POSIX Programmer's Manual"
  3. .\"
  4. .SH PROLOG
  5. This manual page is part of the POSIX Programmer's Manual.
  6. The Linux implementation of this interface may differ (consult
  7. the corresponding Linux manual page for details of Linux behavior),
  8. or the interface may not be implemented on Linux.
  9. .\"
  10. .SH NAME
  11. od
  12. \(em dump files in various formats
  13. .SH SYNOPSIS
  14. .LP
  15. .nf
  16. od \fB[\fR-v\fB] [\fR-A \fIaddress_base\fB] [\fR-j \fIskip\fB] [\fR-N \fIcount\fB] [\fR-t \fItype_string\fB]\fR...
  17. \fB[\fIfile\fR...\fB]\fR
  18. .P
  19. od \fB[\fR-bcdosx\fB] [\fIfile\fB] [[\fR+\fB]\fIoffset\fB[\fR.\fB][\fRb\fB]]\fR
  20. .fi
  21. .SH DESCRIPTION
  22. The
  23. .IR od
  24. utility shall write the contents of its input files to standard output
  25. in a user-specified format.
  26. .SH OPTIONS
  27. The
  28. .IR od
  29. utility shall conform to the Base Definitions volume of POSIX.1\(hy2017,
  30. .IR "Section 12.2" ", " "Utility Syntax Guidelines",
  31. except that the order of presentation of the
  32. .BR \-t
  33. options
  34. and the
  35. .BR \-bcdosx
  36. options
  37. is significant.
  38. .P
  39. The following options shall be supported:
  40. .IP "\fB\-A\ \fIaddress_base\fR" 10
  41. .br
  42. Specify the input offset base. See the EXTENDED DESCRIPTION section.
  43. The application shall ensure that the
  44. .IR address_base
  45. option-argument is a character. The characters
  46. .BR 'd' ,
  47. .BR 'o' ,
  48. and
  49. .BR 'x'
  50. specify that the offset base shall be written in decimal, octal, or
  51. hexadecimal, respectively. The character
  52. .BR 'n'
  53. specifies that the offset shall not be written.
  54. .IP "\fB\-b\fP" 10
  55. Interpret bytes in octal. This shall be equivalent to
  56. .BR "\-t\ o1" .
  57. .IP "\fB\-c\fP" 10
  58. Interpret bytes as characters specified by the current setting of the
  59. .IR LC_CTYPE
  60. category. Certain non-graphic characters appear as C escapes:
  61. .BR \(dqNUL=\e0\(dq ,
  62. .BR \(dqBS=\eb\(dq ,
  63. .BR \(dqFF=\ef\(dq ,
  64. .BR \(dqNL=\en\(dq ,
  65. .BR \(dqCR=\er\(dq ,
  66. .BR \(dqHT=\et\(dq ;
  67. others appear as 3-digit octal numbers.
  68. .IP "\fB\-d\fP" 10
  69. Interpret
  70. .IR word s
  71. (two-byte units) in unsigned decimal. This shall be equivalent to
  72. .BR "\-t\ u2" .
  73. .IP "\fB\-j\ \fIskip\fR" 10
  74. Jump over
  75. .IR skip
  76. bytes from the beginning of the input. The
  77. .IR od
  78. utility shall read or seek past the first
  79. .IR skip
  80. bytes in the concatenated input files. If the combined input is not at
  81. least
  82. .IR skip
  83. bytes long, the
  84. .IR od
  85. utility shall write a diagnostic message to standard error and exit
  86. with a non-zero exit status.
  87. .RS 10
  88. .P
  89. By default, the
  90. .IR skip
  91. option-argument shall be interpreted as a decimal number. With a
  92. leading 0x or 0X, the offset shall be interpreted as a hexadecimal
  93. number; otherwise, with a leading
  94. .BR '0' ,
  95. the offset shall be interpreted as an octal number. Appending the
  96. character
  97. .BR 'b' ,
  98. .BR 'k' ,
  99. or
  100. .BR 'm'
  101. to offset shall cause it to be interpreted as a multiple of 512,
  102. 1\|024, or 1\|048\|576 bytes, respectively. If the
  103. .IR skip
  104. number is hexadecimal, any appended
  105. .BR 'b'
  106. shall be considered to be the final hexadecimal digit.
  107. .RE
  108. .IP "\fB\-N\ \fIcount\fR" 10
  109. Format no more than
  110. .IR count
  111. bytes of input. By default,
  112. .IR count
  113. shall be interpreted as a decimal number. With a leading 0x or 0X,
  114. .IR count
  115. shall be interpreted as a hexadecimal number; otherwise, with a leading
  116. .BR '0' ,
  117. it shall be interpreted as an octal number. If
  118. .IR count
  119. bytes of input (after successfully skipping, if
  120. .BR \-j
  121. .IR skip
  122. is specified) are not available, it shall not be considered an error;
  123. the
  124. .IR od
  125. utility shall format the input that is available.
  126. .IP "\fB\-o\fP" 10
  127. Interpret
  128. .IR word s
  129. (two-byte units) in octal. This shall be equivalent to
  130. .BR "\-t\ o2" .
  131. .IP "\fB\-s\fP" 10
  132. Interpret
  133. .IR word s
  134. (two-byte units) in signed decimal. This shall be equivalent to
  135. .BR "\-t\ d2" .
  136. .IP "\fB\-t\ \fItype_string\fR" 10
  137. .br
  138. Specify one or more output types. See the EXTENDED DESCRIPTION
  139. section. The application shall ensure that the
  140. .IR type_string
  141. option-argument is a string specifying the types to be used when
  142. writing the input data. The string shall consist of the type
  143. specification characters
  144. .BR a ,
  145. .BR c ,
  146. .BR d ,
  147. .BR f ,
  148. .BR o ,
  149. .BR u ,
  150. and
  151. .BR x ,
  152. specifying named character, character, signed decimal, floating point,
  153. octal, unsigned decimal, and hexadecimal, respectively. The type
  154. specification characters
  155. .BR d ,
  156. .BR f ,
  157. .BR o ,
  158. .BR u ,
  159. and
  160. .BR x
  161. can be followed by an optional unsigned decimal integer that specifies
  162. the number of bytes to be transformed by each instance of the output
  163. type. The type specification character
  164. .BR f
  165. can be followed by an optional
  166. .BR F ,
  167. .BR D ,
  168. or
  169. .BR L
  170. indicating that the conversion should be applied to an item of type
  171. .BR float ,
  172. .BR double ,
  173. or
  174. .BR "long double" ,
  175. respectively. The type specification characters
  176. .BR d ,
  177. .BR o ,
  178. .BR u ,
  179. and
  180. .BR x
  181. can be followed by an optional
  182. .BR C ,
  183. .BR S ,
  184. .BR I ,
  185. or
  186. .BR L
  187. indicating that the conversion should be applied to an item of type
  188. .BR char ,
  189. .BR short ,
  190. .BR int ,
  191. or
  192. .BR long ,
  193. respectively. Multiple types can be concatenated within the same
  194. .IR type_string
  195. and multiple
  196. .BR \-t
  197. options can be specified. Output lines shall be written for each type
  198. specified in the order in which the type specification characters are
  199. specified.
  200. .IP "\fB\-v\fP" 10
  201. Write all input data. Without the
  202. .BR \-v
  203. option, any number of groups of output lines, which would be identical
  204. to the immediately preceding group of output lines (except for the byte
  205. offsets), shall be replaced with a line containing only an
  206. <asterisk>
  207. (\c
  208. .BR '*' ).
  209. .IP "\fB\-x\fP" 10
  210. Interpret
  211. .IR word s
  212. (two-byte units) in hexadecimal. This shall be equivalent to
  213. .BR "\-t\ x2" .
  214. .P
  215. Multiple types can be specified by using multiple
  216. .BR \-bcdostx
  217. options. Output lines are written for each type specified in the order
  218. in which the types are specified.
  219. .SH OPERANDS
  220. The following operands shall be supported:
  221. .IP "\fIfile\fR" 10
  222. A pathname of a file to be read. If no
  223. .IR file
  224. operands are specified, the standard input shall be used.
  225. .RS 10
  226. .P
  227. If there are no more than two operands, none of the
  228. .BR \-A ,
  229. .BR \-j ,
  230. .BR \-N ,
  231. .BR \-t ,
  232. or
  233. .BR \-v
  234. options is specified, and either of the following is true: the first
  235. character of the last operand is a
  236. <plus-sign>
  237. (\c
  238. .BR '\(pl' ),
  239. or there are two operands and the first character of the last operand
  240. is numeric;
  241. the last operand shall be interpreted as an offset operand on
  242. XSI-conformant systems.
  243. Under these conditions, the results are unspecified on systems that are
  244. not XSI-conformant systems.
  245. .RE
  246. .IP "\fB[+]\fIoffset\fB[.][b]\fR" 10
  247. The
  248. .IR offset
  249. operand specifies the offset in the file where dumping is to commence.
  250. This operand is normally interpreted as octal bytes. If
  251. .BR '.'
  252. is appended, the offset shall be interpreted in decimal. If
  253. .BR 'b'
  254. is appended, the offset shall be interpreted in units of 512 bytes.
  255. .SH STDIN
  256. The standard input shall be used if no
  257. .IR file
  258. operands are specified, and shall be used if a
  259. .IR file
  260. operand is
  261. .BR '\-'
  262. and the implementation treats the
  263. .BR '\-'
  264. as meaning standard input.
  265. Otherwise, the standard input shall not be used.
  266. See the INPUT FILES section.
  267. .SH "INPUT FILES"
  268. The input files can be any file type.
  269. .SH "ENVIRONMENT VARIABLES"
  270. The following environment variables shall affect the execution of
  271. .IR od :
  272. .IP "\fILANG\fP" 10
  273. Provide a default value for the internationalization variables that are
  274. unset or null. (See the Base Definitions volume of POSIX.1\(hy2017,
  275. .IR "Section 8.2" ", " "Internationalization Variables"
  276. for the precedence of internationalization variables used to determine
  277. the values of locale categories.)
  278. .IP "\fILC_ALL\fP" 10
  279. If set to a non-empty string value, override the values of all the
  280. other internationalization variables.
  281. .IP "\fILC_CTYPE\fP" 10
  282. Determine the locale for the interpretation of sequences of bytes of
  283. text data as characters (for example, single-byte as opposed to
  284. multi-byte characters in arguments and input files).
  285. .IP "\fILC_MESSAGES\fP" 10
  286. .br
  287. Determine the locale that should be used to affect the format and
  288. contents of diagnostic messages written to standard error.
  289. .IP "\fILC_NUMERIC\fP" 10
  290. .br
  291. Determine the locale for selecting the radix character used when
  292. writing floating-point formatted output.
  293. .IP "\fINLSPATH\fP" 10
  294. Determine the location of message catalogs for the processing of
  295. .IR LC_MESSAGES .
  296. .SH "ASYNCHRONOUS EVENTS"
  297. Default.
  298. .SH STDOUT
  299. See the EXTENDED DESCRIPTION section.
  300. .SH STDERR
  301. The standard error shall be used only for diagnostic messages.
  302. .SH "OUTPUT FILES"
  303. None.
  304. .SH "EXTENDED DESCRIPTION"
  305. The
  306. .IR od
  307. utility shall copy sequentially each input file to standard output,
  308. transforming the input data according to the output types specified by
  309. the
  310. .BR \-t
  311. option
  312. or the
  313. .BR \-bcdosx
  314. options.
  315. If no output type is specified, the default output shall be as if
  316. .BR "\-t\ oS"
  317. had been specified.
  318. .P
  319. The number of bytes transformed by the output type specifier
  320. .BR c
  321. may be variable depending on the
  322. .IR LC_CTYPE
  323. category.
  324. .P
  325. The default number of bytes transformed by output type specifiers
  326. .BR d ,
  327. .BR f ,
  328. .BR o ,
  329. .BR u ,
  330. and
  331. .BR x
  332. corresponds to the various C-language types as follows. If the
  333. .IR c99
  334. compiler is present on the system, these specifiers shall correspond to
  335. the sizes used by default in that compiler. Otherwise, these sizes
  336. may vary among systems that conform to POSIX.1\(hy2008.
  337. .IP " *" 4
  338. For the type specifier characters
  339. .BR d ,
  340. .BR o ,
  341. .BR u ,
  342. and
  343. .BR x ,
  344. the default number of bytes shall correspond to the size of the
  345. underlying implementation's basic integer type. For these specifier
  346. characters, the implementation shall support values of the optional
  347. number of bytes to be converted corresponding to the number of bytes in
  348. the C-language types
  349. .BR char ,
  350. .BR short ,
  351. .BR int ,
  352. and
  353. .BR long .
  354. These numbers can also be specified by an application as the characters
  355. .BR 'C' ,
  356. .BR 'S' ,
  357. .BR 'I' ,
  358. and
  359. .BR 'L' ,
  360. respectively. The implementation shall also support the values 1, 2, 4,
  361. and 8, even if it provides no C-Language types of those sizes. The
  362. implementation shall support the decimal value corresponding to the
  363. C-language type
  364. .BR "long long" .
  365. The byte order used when interpreting numeric values is
  366. implementation-defined, but shall correspond to the order in which a
  367. constant of the corresponding type is stored in memory on the system.
  368. .IP " *" 4
  369. For the type specifier character
  370. .BR f ,
  371. the default number of bytes shall correspond to the number of bytes in
  372. the underlying implementation's basic double precision floating-point
  373. data type. The implementation shall support values of the optional
  374. number of bytes to be converted corresponding to the number of bytes in
  375. the C-language types
  376. .BR float,
  377. .BR double ,
  378. and
  379. .BR "long double" .
  380. These numbers can also be specified by an application as the characters
  381. .BR 'F' ,
  382. .BR 'D' ,
  383. and
  384. .BR 'L' ,
  385. respectively.
  386. .P
  387. The type specifier character
  388. .BR a
  389. specifies that bytes shall be interpreted as named characters from the
  390. International Reference Version (IRV) of the ISO/IEC\ 646:\|1991 standard. Only the least
  391. significant seven bits of each byte shall be used for this type
  392. specification. Bytes with the values listed in the following table
  393. shall be written using the corresponding names for those characters.
  394. .br
  395. .sp
  396. .ce 1
  397. \fBTable: Named Characters in \fIod\fP\fR
  398. .TS
  399. center box tab(@);
  400. cB cB | cB cB | cB cB | cB cB
  401. l lb | l lb | l lb | l lb.
  402. Value@Name@Value@Name@Value@Name@Value@Name
  403. _
  404. \e000@nul@\e001@soh@\e002@stx@\e003@etx
  405. \e004@eot@\e005@enq@\e006@ack@\e007@bel
  406. \e010@bs@\e011@ht@\e012@lf \fRor\fP nl\u\s-3*\s+3\d@\e013@vt
  407. \e014@ff@\e015@cr@\e016@so@\e017@si
  408. \e020@dle@\e021@dc1@\e022@dc2@\e023@dc3
  409. \e024@dc4@\e025@nak@\e026@syn@\e027@etb
  410. \e030@can@\e031@em@\e032@sub@\e033@esc
  411. \e034@fs@\e035@gs@\e036@rs@\e037@us
  412. \e040@sp@\e177@del
  413. .TE
  414. .TP 10
  415. .BR Note:
  416. The
  417. .BR \(dq\e012\(dq
  418. value may be written either as
  419. .BR lf
  420. or
  421. .BR nl .
  422. .P
  423. .P
  424. The type specifier character
  425. .BR c
  426. specifies that bytes shall be interpreted as characters specified by
  427. the current setting of the
  428. .IR LC_CTYPE
  429. locale category. Characters listed in the table in the Base Definitions volume of POSIX.1\(hy2017,
  430. .IR "Chapter 5" ", " "File Format Notation"
  431. (\c
  432. .BR '\e\e' ,
  433. .BR '\ea' ,
  434. .BR '\eb' ,
  435. .BR '\ef' ,
  436. .BR '\en' ,
  437. .BR '\er' ,
  438. .BR '\et' ,
  439. .BR '\ev' )
  440. shall be written as the corresponding escape sequences, except that
  441. <backslash>
  442. shall be written as a single
  443. <backslash>
  444. and a NUL shall be written as
  445. .BR '\e0' .
  446. Other non-printable characters shall be written as one three-digit
  447. octal number for each byte in the character. Printable multi-byte
  448. characters shall be written in the area corresponding to the first byte
  449. of the character; the two-character sequence
  450. .BR \(dq**\(dq
  451. shall be written in the area corresponding to each remaining byte in
  452. the character, as an indication that the character is continued. When
  453. either the
  454. .BR \-j
  455. .IR skip
  456. or
  457. .BR \-N
  458. .IR count
  459. option is specified along with the
  460. .BR c
  461. type specifier, and this results in an attempt to start or finish in
  462. the middle of a multi-byte character, the result is
  463. implementation-defined.
  464. .P
  465. The input data shall be manipulated in blocks, where a block is defined
  466. as a multiple of the least common multiple of the number of bytes
  467. transformed by the specified output types. If the least common
  468. multiple is greater than 16, the results are unspecified. Each input
  469. block shall be written as transformed by each output type, one per
  470. written line, in the order that the output types were specified. If
  471. the input block size is larger than the number of bytes transformed by
  472. the output type, the output type shall sequentially transform the parts
  473. of the input block, and the output from each of the transformations
  474. shall be separated by one or more
  475. <blank>
  476. characters.
  477. .P
  478. If, as a result of the specification of the
  479. .BR \-N
  480. option or end-of-file being reached on the last input file, input data
  481. only partially satisfies an output type, the input shall be extended
  482. sufficiently with null bytes to write the last byte of the input.
  483. .P
  484. Unless
  485. .BR "\-A\ n"
  486. is specified, the first output line produced for each input block shall
  487. be preceded by the input offset, cumulative across input files, of the
  488. next byte to be written. The format of the input offset is unspecified;
  489. however, it shall not contain any
  490. <blank>
  491. characters, shall start at the first character of the output line,
  492. and shall be followed by one or more
  493. <blank>
  494. characters. In addition, the offset of the byte following the last byte
  495. written shall be written after all the input data has been processed,
  496. but shall not be followed by any
  497. <blank>
  498. characters.
  499. .P
  500. If no
  501. .BR \-A
  502. option is specified, the input offset base is unspecified.
  503. .SH "EXIT STATUS"
  504. The following exit values shall be returned:
  505. .IP "\00" 6
  506. All input files were processed successfully.
  507. .IP >0 6
  508. An error occurred.
  509. .SH "CONSEQUENCES OF ERRORS"
  510. Default.
  511. .LP
  512. .IR "The following sections are informative."
  513. .SH "APPLICATION USAGE"
  514. XSI-conformant applications are warned not to use filenames starting
  515. with
  516. .BR '\(pl'
  517. or a first operand starting with a numeric character so that the old
  518. functionality can be maintained by implementations, unless they specify
  519. one of the
  520. .BR \-A ,
  521. .BR \-j ,
  522. or
  523. .BR \-N
  524. options. To guarantee that one of these filenames is always
  525. interpreted as a filename, an application could always specify the
  526. address base format with the
  527. .BR \-A
  528. option.
  529. .SH EXAMPLES
  530. If a file containing 128 bytes with decimal values zero to 127, in
  531. increasing order, is supplied as standard input to the command:
  532. .sp
  533. .RS 4
  534. .nf
  535. od -A d -t a
  536. .fi
  537. .P
  538. .RE
  539. .P
  540. on an implementation using an input block size of 16 bytes, the
  541. standard output, independent of the current locale setting, would be
  542. similar to:
  543. .sp
  544. .RS 4
  545. .nf
  546. 0000000 nul soh stx etx eot enq ack bel bs ht nl vt ff cr so si
  547. 0000016 dle dc1 dc2 dc3 dc4 nak syn etb can em sub esc fs gs rs us
  548. 0000032 sp ! " # $ % & \(aq ( ) * + , - . /
  549. 0000048 0 1 2 3 4 5 6 7 8 9 : ; < = > ?
  550. 0000064 @ A B C D E F G H I J K L M N O
  551. 0000080 P Q R S T U V W X Y Z [ \e ] \(ha _
  552. 0000096 ` a b c d e f g h i j k l m n o
  553. 0000112 p q r s t u v w x y z { | } \(ti del
  554. 0000128
  555. .fi
  556. .P
  557. .RE
  558. .P
  559. Note that this volume of POSIX.1\(hy2017 allows
  560. .BR nl
  561. or
  562. .BR lf
  563. to be used as the name for the ISO/IEC\ 646:\|1991 standard IRV character with decimal value
  564. 10. The IRV names this character
  565. .BR lf
  566. (line feed), but traditional implementations have referred to this
  567. character as newline
  568. (\c
  569. .BR nl )
  570. and the POSIX locale character set symbolic name for the corresponding
  571. character is a
  572. <newline>.
  573. .P
  574. The command:
  575. .sp
  576. .RS 4
  577. .nf
  578. od -A o -t o2x2x -N 18
  579. .fi
  580. .P
  581. .RE
  582. .P
  583. on a system with 32-bit words and an implementation using an input
  584. block size of 16 bytes could write 18 bytes in approximately the
  585. following format:
  586. .sp
  587. .RS 4
  588. .nf
  589. 0000000 032056 031440 041123 042040 052516 044530 020043 031464
  590. 342e 3320 4253 4420 554e 4958 2023 3334
  591. 342e3320 42534420 554e4958 20233334
  592. 0000020 032472
  593. 353a
  594. 353a0000
  595. 0000022
  596. .fi
  597. .P
  598. .RE
  599. .P
  600. The command:
  601. .sp
  602. .RS 4
  603. .nf
  604. od -A d -t f -t o4 -t x4 -N 24 -j 0x15
  605. .fi
  606. .P
  607. .RE
  608. .P
  609. on a system with 64-bit doubles (for example, IEEE\ Std\ 754\(hy1985 double
  610. precision floating-point format) would skip 21 bytes of input data and
  611. then write 24 bytes in approximately the following format:
  612. .sp
  613. .RS 4
  614. .nf
  615. 0000000 1.00000000000000e+00 1.57350000000000e+01
  616. 07774000000 00000000000 10013674121 35341217270
  617. 3ff00000 00000000 402f3851 eb851eb8
  618. 0000016 1.40668230000000e+02
  619. 10030312542 04370303230
  620. 40619562 23e18698
  621. 0000024
  622. .fi
  623. .P
  624. .RE
  625. .SH RATIONALE
  626. The
  627. .IR od
  628. utility went through several names in early proposals, including
  629. .IR hd ,
  630. .IR xd ,
  631. and most recently
  632. .IR hexdump .
  633. There were several objections to all of these based on the following
  634. reasons:
  635. .IP " *" 4
  636. The
  637. .IR hd
  638. and
  639. .IR xd
  640. names conflicted with historical utilities that behaved differently.
  641. .IP " *" 4
  642. The
  643. .IR hexdump
  644. description was much more complex than needed for a simple dump
  645. utility.
  646. .IP " *" 4
  647. The
  648. .IR od
  649. utility has been available on all historical implementations and there
  650. was no need to create a new name for a utility so similar to the
  651. historical
  652. .IR od
  653. utility.
  654. .P
  655. The original reasons for not standardizing historical
  656. .IR od
  657. were also fairly widespread. Those reasons are given below along with
  658. rationale explaining why the standard developers believe that this
  659. version does not suffer from the indicated problem:
  660. .IP " *" 4
  661. The BSD and System V versions of
  662. .IR od
  663. have diverged, and the intersection of features provided by both does
  664. not meet the needs of the user community. In fact, the System V
  665. version only provides a mechanism for dumping octal bytes and
  666. .BR short s,
  667. signed and unsigned decimal
  668. .BR short s,
  669. hexadecimal
  670. .BR short s,
  671. and ASCII characters. BSD added the ability to dump
  672. .BR float s,
  673. .BR double s,
  674. named ASCII characters, and octal, signed decimal, unsigned decimal,
  675. and hexadecimal
  676. .BR long s.
  677. The version presented here provides more normalized forms for dumping
  678. bytes,
  679. .BR short s,
  680. .BR int s,
  681. and
  682. .BR long s
  683. in octal, signed decimal, unsigned decimal, and hexadecimal;
  684. .BR float ,
  685. .BR double ,
  686. and
  687. .BR "long double" ;
  688. and named ASCII as well as current locale characters.
  689. .IP " *" 4
  690. It would not be possible to come up with a compatible superset of the
  691. BSD and System V flags that met the requirements of the standard
  692. developers. The historical default
  693. .IR od
  694. output is the specified default output of this utility. None of the
  695. option letters chosen for this version of
  696. .IR od
  697. conflict with any of the options to historical versions of
  698. .IR od .
  699. .IP " *" 4
  700. On systems with different sizes for
  701. .BR short ,
  702. .BR int ,
  703. and
  704. .BR long ,
  705. there was no way to ask for dumps of
  706. .BR int s,
  707. even in the BSD version. Because of the way options are named, the
  708. name space could not be extended to solve these problems. This is why
  709. the
  710. .BR \-t
  711. option was added (with type specifiers more closely matched to the
  712. \fIprintf\fR()
  713. formats used in the rest of this volume of POSIX.1\(hy2017) and the optional field sizes were
  714. added to the
  715. .BR d ,
  716. .BR f ,
  717. .BR o ,
  718. .BR u ,
  719. and
  720. .BR x
  721. type specifiers. It is also one of the reasons why the historical
  722. practice was not mandated as a required obsolescent form of
  723. .IR od .
  724. (Although the old versions of
  725. .IR od
  726. are not listed as an obsolescent form, implementations are urged to
  727. continue to recognize the older forms for several more years.) The
  728. .BR a ,
  729. .BR c ,
  730. .BR f ,
  731. .BR o ,
  732. and
  733. .BR x
  734. types match the meaning of the corresponding format characters in the
  735. historical implementations of
  736. .IR od
  737. except for the default sizes of the fields converted. The
  738. .BR d
  739. format is signed in this volume of POSIX.1\(hy2017 to match the
  740. \fIprintf\fR()
  741. notation. (Historical versions of
  742. .IR od
  743. used
  744. .BR d
  745. as a synonym for
  746. .BR u
  747. in this version. The System V implementation uses
  748. .BR s
  749. for signed decimal; BSD uses
  750. .BR i
  751. for signed decimal and
  752. .BR s
  753. for null-terminated strings.) Other than
  754. .BR d
  755. and
  756. .BR u ,
  757. all of the type specifiers match format characters in the historical
  758. BSD version of
  759. .BR od .
  760. .RS 4
  761. .P
  762. The sizes of the C-language types
  763. .BR char ,
  764. .BR short ,
  765. .BR int ,
  766. .BR long ,
  767. .BR float ,
  768. .BR double ,
  769. and
  770. .BR "long double"
  771. are used even though it is recognized that there may be zero or more
  772. than one compiler for the C language on an implementation and that they
  773. may use different sizes for some of these types. (For example, one
  774. compiler might use 2 bytes
  775. .BR short s,
  776. 2 bytes
  777. .BR int s,
  778. and 4 bytes
  779. .BR long s,
  780. while another compiler (or an option to the same compiler) uses 2 bytes
  781. .BR short s,
  782. 4 bytes
  783. .BR int s,
  784. and 4 bytes
  785. .BR long s.)
  786. Nonetheless, there has to be a basic size known by the implementation
  787. for these types, corresponding to the values reported by invocations of
  788. the
  789. .IR getconf
  790. utility when called with
  791. .IR system_var
  792. operands
  793. {UCHAR_MAX},
  794. {USHORT_MAX},
  795. {UINT_MAX},
  796. and
  797. {ULONG_MAX}
  798. for the types
  799. .BR char ,
  800. .BR short ,
  801. .BR int ,
  802. and
  803. .BR long ,
  804. respectively. There are similar constants required by the ISO\ C standard, but
  805. not required by the System Interfaces volume of POSIX.1\(hy2017 or this volume of POSIX.1\(hy2017. They are
  806. {FLT_MANT_DIG},
  807. {DBL_MANT_DIG},
  808. and
  809. {LDBL_MANT_DIG}
  810. for the types
  811. .BR float ,
  812. .BR double ,
  813. and
  814. .BR "long double" ,
  815. respectively. If the optional
  816. .IR c99
  817. utility is provided by the implementation and used as specified by
  818. \&this volume of POSIX.1\(hy2017, these are the sizes that would be provided. If an option is used
  819. that specifies different sizes for these types, there is no guarantee
  820. that the
  821. .IR od
  822. utility is able to interpret binary data output by such a program
  823. correctly.
  824. .P
  825. This volume of POSIX.1\(hy2017 requires that the numeric values of these lengths be recognized
  826. by the
  827. .IR od
  828. utility and that symbolic forms also be recognized. Thus, a conforming
  829. application can always look at an array of
  830. .BR "unsigned long"
  831. data elements using
  832. .IR od
  833. .BR \-t
  834. .IR uL .
  835. .RE
  836. .IP " *" 4
  837. The method of specifying the format for the address field based on
  838. specifying a starting offset in a file unnecessarily tied the two
  839. together. The
  840. .BR \-A
  841. option now specifies the address base and the
  842. .BR \-S
  843. option specifies a starting offset.
  844. .IP " *" 4
  845. It would be difficult to break the dependence on US ASCII to achieve
  846. an internationalized utility. It does not seem to be any harder for
  847. .IR od
  848. to dump characters in the current locale than it is for the
  849. .IR ed
  850. or
  851. .IR sed
  852. .BR l
  853. commands. The
  854. .BR c
  855. type specifier does this without difficulty and is completely
  856. compatible with the historical implementations of the
  857. .BR c
  858. format character when the current locale uses a superset of the ISO/IEC\ 646:\|1991 standard
  859. as a codeset. The
  860. .BR a
  861. type specifier (from the BSD
  862. .BR a
  863. format character) was left as a portable means to dump ASCII (or more
  864. correctly ISO/IEC\ 646:\|1991 standard (IRV)) so that headers produced by
  865. .IR pax
  866. could be deciphered even on systems that do not use the ISO/IEC\ 646:\|1991 standard as a
  867. subset of their base codeset.
  868. .P
  869. The use of
  870. .BR \(dq**\(dq
  871. as an indication of continuation of a multi-byte character in
  872. .BR c
  873. specifier output was chosen based on seeing an implementation that uses
  874. this method. The continuation bytes have to be marked in a way that is
  875. not ambiguous with another single-byte or multi-byte character.
  876. .P
  877. An early proposal used
  878. .BR \-S
  879. and
  880. .BR \-n ,
  881. respectively, for the
  882. .BR \-j
  883. and
  884. .BR \-N
  885. options eventually selected. These were changed to avoid conflicts with
  886. historical implementations.
  887. .P
  888. The original standard specified
  889. .BR "\-t o2"
  890. as the default when no output type was given. This was changed to
  891. .BR "\-t oS"
  892. (the length of a
  893. .BR short )
  894. to accommodate a supercomputer implementation that historically used 64
  895. bits as its default (and that defined shorts as 64 bits). This change
  896. should not affect conforming applications. The requirement to support
  897. lengths of 1, 2, and 4 was added at the same time to address an
  898. historical implementation that had no two-byte data types in its C
  899. compiler.
  900. .P
  901. The use of a basic integer data type is intended to allow the
  902. implementation to choose a word size commonly used by applications
  903. on that architecture.
  904. .P
  905. Earlier versions of this standard allowed for implementations with
  906. bytes other than eight bits, but this has been modified in this
  907. version.
  908. .SH "FUTURE DIRECTIONS"
  909. All option and operand interfaces marked XSI may be removed
  910. in a future version.
  911. .SH "SEE ALSO"
  912. .IR "\fIc99\fR\^",
  913. .IR "\fIsed\fR\^"
  914. .P
  915. The Base Definitions volume of POSIX.1\(hy2017,
  916. .IR "Chapter 5" ", " "File Format Notation",
  917. .IR "Chapter 8" ", " "Environment Variables",
  918. .IR "Section 12.2" ", " "Utility Syntax Guidelines"
  919. .\"
  920. .SH COPYRIGHT
  921. Portions of this text are reprinted and reproduced in electronic form
  922. from IEEE Std 1003.1-2017, Standard for Information Technology
  923. -- Portable Operating System Interface (POSIX), The Open Group Base
  924. Specifications Issue 7, 2018 Edition,
  925. Copyright (C) 2018 by the Institute of
  926. Electrical and Electronics Engineers, Inc and The Open Group.
  927. In the event of any discrepancy between this version and the original IEEE and
  928. The Open Group Standard, the original IEEE and The Open Group Standard
  929. is the referee document. The original Standard can be obtained online at
  930. http://www.opengroup.org/unix/online.html .
  931. .PP
  932. Any typographical or formatting errors that appear
  933. in this page are most likely
  934. to have been introduced during the conversion of the source files to
  935. man page format. To report such errors, see
  936. https://www.kernel.org/doc/man-pages/reporting_bugs.html .