Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ hd(C) — OpenDesktop 1.0.0y

Media Vault

Software Library

Restoration Projects

Artifacts Sought


     HD(C)                                      UNIX System V



     Name
          hd - displays files in hexadecimal format


     Syntax
          hd [ -format [ -s offset ] [ -n count ] [ file ] ...


     Description
          The  hd  command  displays  the   contents   of   files   in
          hexadecimal, octal, decimal, and character formats.  Control
          over the specification  of  ranges  of  characters  is  also
          available.  The default behavior is with the following flags
          set: ``-abx -A''. This says that  addresses  (file  offsets)
          and bytes are printed in hexadecimal and that characters are
          also printed.  If no file argument is  given,  the  standard
          input is read.

          Options include:

          -s offset   Specify the beginning offset in the  file  where
                      printing  is to begin.  If no `file' argument is
                      given, or if a seek fails because the input is a
                      pipe, `offset' bytes are read from the input and
                      discarded.   Otherwise,  a   seek   error   will
                      terminate processing of the current file.

                      The offset may be given in decimal,  hexadecimal
                      (preceded  by  `0x'),  or  octal  (preceded by a
                      `0'). It is optionally followed by  one  of  the
                      following  multipliers: w, l, b, or k; for words
                      (2 bytes), long words (4 bytes), half  kilobytes
                      (512   bytes),   or   kilobytes   (1024  bytes),
                      respectively.  Note that this is  the  one  case
                      where  ``b''  does  not  stand  for bytes. Since
                      specifying a hexadecimal offset in blocks  would
                      result  in an ambiguous trailing `b', any offset
                      and multiplier may be separated by  an  asterisk
                      (*).

          -n count    Specify the number  of  bytes  to  process.  The
                      count is in the same format as offset, above.

     Format Flags
          Format flags may specify addresses, characters, bytes, words
          (2  bytes) or longs (4 bytes) to be printed in hex, decimal,
          or octal.  Two special formats may also be  indicated:  text
          or ascii.  Format and base specifiers may be freely combined
          and repeated as desired in order to specify different  bases
          (hexadecimal, decimal or octal) for different output formats
          (addresses, characters, etc.).  All format  flags  appearing
          in a single argument are applied as appropriate to all other
          flags in that argument.

          acbwlA
               Output format  specifiers  for  addresses,  characters,
               bytes,  words,  longs and ascii respectively.  Only one
               base specifier will be used for addresses. The  address
               will  appear  on  the  first line of output that begins
               each new offset in the input.

               The character format prints  all  printable  characters
               without  change,  special  C  escapes as defined in the
               language, and the remaining  values  in  the  specified
               base.

               The  ascii  format  prints  all  printable   characters
               without  change,  and  all others as a period (.). This
               format appears to the  right  of  the  first  of  other
               specified  output  formats.  A  base  specifier  has no
               meaning with the  ascii  format.  If  no  other  output
               format  (other than addresses) is given, bx is assumed.
               If no base specifier is given, all of xdo are used.

          xdo  Output base specifiers  for  hexadecimal,  decimal  and
               octal.

          t    Print a text file, each line preceded by the address in
               the  file. Normally, lines should be terminated by a \n
               character; but long lines will be broken  up.   Control
               characters  in  the  range  0x00 to 0x1f are printed as
               `^@' to `^_'.  Bytes with the high bit set are preceded
               by  a tilde (~) and printed as if the high bit were not
               set. The special characters (^, ~, \) are preceded by a
               backslash  (\)  to  escape  their  special  meaning. As
               special  cases,  these  two  values   are   represented
               numerically  as  `\177'  and  `\377'.   This  flag will
               override all output format specifiers except addresses.

          If no output format  is  given,  but  a  base  specifier  is
          present,  the  output  format  is  set to -acbwl. If no base
          specifier is given, but an output  format  is  present,  the
          base  specifier  is  set to -xdo. If neither is present, the
          format flag is set to -abx -A.


     Value Added
          hd is an extension of AT&T System V provided  by  the  Santa
          Cruz Operation.


     (printed 8/28/89)                                  HD(C)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026