home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / pc / source / pep21.arc / PEP.DOC < prev    next >
Text File  |  1989-12-29  |  35KB  |  925 lines

  1.  
  2.  
  3.  
  4. PEP(1L)                  LOCAL COMMANDS                   PEP(1L)
  5.  
  6.  
  7.  
  8. NAME
  9.      pep - a file detergent
  10.  
  11. SYNOPSIS
  12.      pep [ -a ] [ -b ] [ -c [ size ]] [ -d + | - ]
  13.           [ -e [ 0 | 1 | 2 ]] [ -g file ] [ -h ] [ -i + | - ]
  14.           [ -k + | - ] [ -m + | - ] [ -o [ b ]] [ -p ]
  15.           [ -s [ size ]] [ -t [ size ]] [ -u terminator ] [ -v ]
  16.           [ -w + | - ] [ -x ] [ -z ] [ filename ... ]
  17.  
  18. DESCRIPTION
  19.      Pep is a filter program to "clean" files.  It is named after
  20.      a popular Norwegian detergent.
  21.  
  22.      Pep may be used to remove control characters,  strip  parity
  23.      bits,  interpret ANSI escape sequences, compress tabulation,
  24.      extract strings and convert character sets.  Nine out of ten
  25.      hackers  prefer  "pep"  to soap (which may very well explain
  26.      why some of them smell the way they do).
  27.  
  28.      Pep is a filter.  Its default  operation  is  to  read  from
  29.      standard  input  (the keyboard) and write on standard output
  30.      (the terminal).
  31.  
  32.      You may also specify the name of one or more  files  as  the
  33.      last  argument  on  the  command line.  Most versions of pep
  34.      (not the version compiled for the DEC VMS operating  system)
  35.      allow  ambiguous  filename arguments, were a single filename
  36.      argument may specify several files.
  37.  
  38.      You may instruct pep to write the result back onto the  ori-
  39.      ginal  input  file  with  the  -o  option.   If you use this
  40.      option, the original file will be lost.  If you want to keep
  41.      the  original  file (something that usually will be the case
  42.      when you do things like extracting strings from  an  execut-
  43.      able file), you should make a copy of the file before apply-
  44.      ing pep, and filter the copy rather than the original.  Some
  45.      of  the  functions in pep (in particular those selected with
  46.      the -b and -s options) may remove a  lot  of  material  from
  47.      files,  and  it  may  be  unfortunate if this happens to the
  48.      wrong file.  It is probably a good idea to always use pep on
  49.      copies  until  you  have  some  experience  with the various
  50.      pep-options.  You may also use the  b  argument  on  the  -o
  51.      option to save the original in a .BAK-file.
  52.  
  53.      To get a brief summary of the command line  syntax  and  all
  54.      the  options,  you need to specify the -h option.  Just type
  55.      the command:
  56.           pep -h
  57.  
  58.      followed by the RETURN key.  Note that  just  pep  will  not
  59.      give you this summary.  The command:
  60.  
  61.  
  62.  
  63. Version 2.1       Last change: 28 December 1989                 1
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. PEP(1L)                  LOCAL COMMANDS                   PEP(1L)
  71.  
  72.  
  73.  
  74.           pep
  75.  
  76.      will start pep as a filter, and it will just echo back what-
  77.      ever  you  type,  until  you  type the end of file character
  78.      (usually CTRL-D or CTRL-Z).
  79.  
  80.      When pep is running as filter, it is reading from the  stan-
  81.      dard  input  and  writing  to  the standard output.  In this
  82.      state, pep will be very much less verbose  than  it  usually
  83.      is.   It  will  still  print error messages, but very little
  84.      else.  Note that while:
  85.           pep < foobar.in > foobar.out
  86.           pep -ob foobar.txt
  87.  
  88.      will do more or less the same job,  the  first  will  do  it
  89.      quietly,  in  the tradition of Unix filters; the latter will
  90.      print the copyright notice, a detailed list of the things it
  91.      will  do, and finally a list and line count of all the files
  92.      it processes as it plods along.
  93.  
  94.      Pep will remove some "noise" from files, even if no  options
  95.      are specified.  The following is the default behavior:
  96.  
  97.           +  remove trailing spaces;
  98.  
  99.           +  terminate each line with the canonical line termina-
  100.              tor (usually LF, CR or both);
  101.  
  102.           +  remove   underlining   intended   for    backspacing
  103.              printers;
  104.  
  105.           +  remove control characters  (character  codes  <  32)
  106.              except canonical line terminator, FF and TAB;
  107.  
  108.           +  break the line before the FF if a line  contains  an
  109.              FF anywhere except in the first column.
  110.  
  111.      If you want to check what pep actually intend to do to  your
  112.      file  before  it  does it, you may make it pause with the -p
  113.      option.  For example:
  114.           pep -p foobar.txt
  115.  
  116.      will make pep stop after displaying a list  of  the  conver-
  117.      sions  it  will apply to the file.  The user is prompted and
  118.      may choose to proceed (hitting the RETURN key), or abort the
  119.      program without doing anything (hitting CTRL-C).
  120.  
  121.      The user may want other conversions than the default  action
  122.      described  above.   A  number of conversion functions may be
  123.      selected by specifying one or more options  on  the  command
  124.      line.
  125.  
  126.  
  127.  
  128.  
  129. Version 2.1       Last change: 28 December 1989                 2
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. PEP(1L)                  LOCAL COMMANDS                   PEP(1L)
  137.  
  138.  
  139.  
  140.      Some of the options require an additional  argument  switch,
  141.      and  must  be  followed  by  a  "+"  or a "-", other options
  142.      require a number  or  a  filename  argument.   Most  of  the
  143.      options  may  be  combined with other options, but a few are
  144.      mutually exclusive.  If the user specifies  invalid  options
  145.      or  option arguments, then pep will abort with an error mes-
  146.      sage and return an error exit code on operating systems that
  147.      support exit codes.
  148.  
  149. OPTIONS
  150.      -a   Write out information about pep.
  151.  
  152.      -b   Remove all characters not in the original 7-bit charac-
  153.           ter  set  (ISO  646).  I.e. remove the characters which
  154.           are encoded from 128 to 255.  (If this option  is  com-
  155.           bined  with  the -x option, it will print the codes for
  156.           these characters in  hexadecimal  instead  of  removing
  157.           them.)  The -b option is powerful, and may remove a lot
  158.           of bytes if you use it on the wrong file.  Only use  it
  159.           if  you  know  exactly how the eight bit is used in the
  160.           file you intend to filter.  Also note that the  options
  161.           i,  d,  k, g, m, w or z in most cases are better suited
  162.           to process files where the eight bit is set.
  163.  
  164.      -c [ size ]
  165.           Compress space into tabulation.  I.e. insert TAB  char-
  166.           acters  when replacing a run of two or more SPACE char-
  167.           acters would produce a smaller output file.  This func-
  168.           tion  is  the opposite of the function invoked with the
  169.           -t option.
  170.  
  171.           The default tabulation size is 8, but you  may  specify
  172.           any  other  tabulation  with the optional numeric argu-
  173.           ment.
  174.  
  175.      -d + | -
  176.           Convert to or from the ISO 8859/1 8 bit  character  set
  177.           and  the Norwegian version of the ISO 646 7 bit charac-
  178.           ter set.  If the argument is "+", the file is converted
  179.           to  ISO  8859/1.   If  the argument is "-", the file is
  180.           converted from ISO 8859/1.  The  ISO  8859/1  character
  181.           set  is also known as the  "DEC Multinational Character
  182.           Set".
  183.  
  184.      -e [ 0 | 1 | 2 ]
  185.           Interpret ANSI screen control sequences (also known  as
  186.           ANSI  ESCAPE  sequences).  This function makes pep emu-
  187.           late cursor  positioning  and  other  functions  on  an
  188.           ANSI-terminal.
  189.  
  190.           Pep will complain about "strange" (i.e.  implementation
  191.           dependent) use of ANSI escape sequences.
  192.  
  193.  
  194.  
  195. Version 2.1       Last change: 28 December 1989                 3
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. PEP(1L)                  LOCAL COMMANDS                   PEP(1L)
  203.  
  204.  
  205.  
  206.           Pep will normally save a screen  image  on  the  output
  207.           file  when one of two events occur:  1) When the screen
  208.           is full and scrolls up; or  2)  just  before  a  screen
  209.           image  is  erased  with  the "erase screen" ANSI screen
  210.           control sequence.  In some cases  important  fields  on
  211.           the  screen will be overwritten or erased.  There is no
  212.           good solution to this problem,  but  pep  provides  the
  213.           user with some opportunity to guard against overwriting
  214.           and erasure.  This is done by specifying an  additional
  215.           numeric  argument to the -e option.  This numeric indi-
  216.           cate the level of protection and is interpreted as fol-
  217.           lows:
  218.  
  219.                0: no  protection  -  fields  may  be  erased  and
  220.                   overwritten (this is the default);
  221.  
  222.                1: sequences that erase fields are ignored;
  223.  
  224.                2: sequences that erase or  overwrite  fields  are
  225.                   ignored.
  226.  
  227.      -g file
  228.           Read the conversion table from a file.  The name of the
  229.           file must be appended as the argument to this option.
  230.  
  231.           The file itself is a standard  ASCII  text  file  where
  232.           each  line  should  contain  two  decimal numbers.  The
  233.           first number is the character code to convert from, and
  234.           the  second number is the character code to convert to.
  235.           A "#" character and all the following characters up  to
  236.           a  NEWLINE  is  considered  a  comment, and is ignored.
  237.           Comments are however echoed on the  screen  along  with
  238.           the  other  comments pep makes, unless the comment line
  239.           starts with a "##".
  240.  
  241.           Below is an example of how such a conversion  file  may
  242.           look:
  243.  
  244.                # Convert from Macintosh to IBM-PC
  245.                ##This line is not echoed on the screen.
  246.                # MAC IBM
  247.                  174 146
  248.                  175 157
  249.                  129 143
  250.                  190 145
  251.                  191 155
  252.                  140 134
  253.                # EOF
  254.  
  255.      -h   Write a brief summary of pep options, and exit.
  256.  
  257.      -i + | -
  258.  
  259.  
  260.  
  261. Version 2.1       Last change: 28 December 1989                 4
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268. PEP(1L)                  LOCAL COMMANDS                   PEP(1L)
  269.  
  270.  
  271.  
  272.           Convert to or from the IBM 8 bit  character  set  (Code
  273.           Page 850 Multilingual) and the Norwegian version of the
  274.           ISO 646 7 bit character set.  If the argument  is  "+",
  275.           the  file  is  converted to CP 850.  If the argument is
  276.           "-", the file is converted from CP  850.   The  CP  850
  277.           character  set  (or  a subset of it) is what is used in
  278.           the IBM PC, AT, and PS/2 series of computers and  their
  279.           clones.   Note  that  some machines with American PROMs
  280.           have a yen- and cent character in the  position  right-
  281.           fully belonging to upper and lower case versions of the
  282.           Norwegian character written as  an  "o"  with  a  slash
  283.           across it (often referred to as oslash).
  284.  
  285.      -k + | -
  286.           Convert to or from a 8 bit character set  and  the  ISO
  287.           646 7 bit character set.  This is a modified version of
  288.           the -i function, hacked to preserve both the  backslash
  289.           character  and  the  upper  case  oslash  character  as
  290.           required by, among others, the "KnowledgeMan"  package.
  291.           These  characters share the same code (92 decimal) in 7
  292.           bit ISO 646, but uses different codes (92 is backslash,
  293.           157  is  oslash)  in 8 bit CP 850.  To get around this,
  294.           two backslashes in ISO 646 will  be  converted  to  the
  295.           upper  case  oslash character in CP 850, while a single
  296.           backslash will be preserved - and vice versa.
  297.  
  298.           If this option is combined with the -d  or  -m  option,
  299.           the  DEC/ISO or the Macintosh character sets is used as
  300.           base instead of CP 850.
  301.  
  302.      -m + | -
  303.           Convert to or from the Apple Macintosh 8 bit  character
  304.           set  and  the  Norwegian  version  of the ISO 646 7 bit
  305.           character set.  If the argument is  "+",  the  file  is
  306.           converted  to the Macintosh character set; if the argu-
  307.           ment is "-", the file is converted from  the  Macintosh
  308.           character  set.  See description of -v option below and
  309.           note in "bugs" section below about treatment  of  "end-
  310.           of-line" and "end-of-paragraph".
  311.  
  312.      -o [ b ]
  313.           Pep will usually write the result of conversions on the
  314.           standard output (stdout). This option instead instructs
  315.           pep to replace each named input file with a  file  con-
  316.           taining  the  result of filtering the file through pep.
  317.           If the option is augmented with the  argument  b  (i.e.
  318.           -ob),  then pep will create a backup copy of the origi-
  319.           nal input file on a file with extension .BAK.   If  you
  320.           just specify -o the original file is deleted.
  321.  
  322.           The VMS version of pep  will  always  run  as  if  this
  323.           option  was  specified.   This  is because VMS does not
  324.  
  325.  
  326.  
  327. Version 2.1       Last change: 28 December 1989                 5
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334. PEP(1L)                  LOCAL COMMANDS                   PEP(1L)
  335.  
  336.  
  337.  
  338.           support useful redirection or pipes.  Therefore, it  is
  339.           never necessary to specify the -o option under VMS, but
  340.           users should still specify -ob if they  want  a  backup
  341.           copy of the original input file.
  342.  
  343.      -p   Write out a brief description the conversion  functions
  344.           that  will  be activated by the current set of options,
  345.           and pause.  The user may review the list of  conversion
  346.           functions  and abort (by hitting CTRL-C) if they do not
  347.           have the intended effect.
  348.  
  349.      -s [ size ]
  350.           Find strings in extremely "noisy" files.
  351.  
  352.           Pep's concept of a string is that it is a  sequence  of
  353.           "printable"   characters  of  a  certain  length.   The
  354.           default minimum length of this sequence is 4, but  this
  355.           may  be  changed  by  the user by supplying an optional
  356.           numeric argument that becomes the minimum length of the
  357.           sequence.
  358.  
  359.           The default definition of a "printable" character is  a
  360.           symbol  with encoding above 31 decimal (i.e. 32 to 255)
  361.           plus certain common control  characters  (TAB,  CR  and
  362.           LF).  This definition is almost always too liberal, and
  363.           will include a lot of "noise" in the  output.   One  or
  364.           more  of  the  options  -b,  -d, -i, -m or -z should be
  365.           specified in addition to -s  in  order  to  narrow  the
  366.           definition and the search space.  In my experience, the
  367.           -b option is a particularly  useful  additional  filter
  368.           when searching for strings.
  369.  
  370.      -t [ size ]
  371.           Expand tabulation, replacing the TAB character  with  a
  372.           suitable number of spaces.  The default tabulation size
  373.           is 8, but the optional numeric  argument  size  may  be
  374.           used to set tabulation to any desired size.
  375.  
  376.      -u r | n | s | - | # | number
  377.           Pep's default behaviour  is  to  terminate  lines  with
  378.           whatever is the canonical line terminator (the standard
  379.           way to terminate a text line)  on  the  assumed  target
  380.           system  for  the  output  file.   This means CR/LF on a
  381.           microcomputer system, LF on a UNIX system,  and  CR  if
  382.           the  target is a Macintosh).  The assumed target system
  383.           is usually the system pep is  running  on,  unless  you
  384.           request  folding  to  the character set of another com-
  385.           puter system.  Then, that computer system  becomes  the
  386.           assumed target.
  387.  
  388.           The -u option allows you to override  this  assumption.
  389.           You  do  this  by  specifying explicit (in decimal) the
  390.  
  391.  
  392.  
  393. Version 2.1       Last change: 28 December 1989                 6
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400. PEP(1L)                  LOCAL COMMANDS                   PEP(1L)
  401.  
  402.  
  403.  
  404.           numeric ASCII value of the end of  line  character  you
  405.           want  in  your  output file.  For example, to make sure
  406.           lines are terminated by LF (the standard for UNIX  text
  407.           files), you may use -u10, because 10 is the ASCII value
  408.           of the newline (LF) control character.   Instead  of  a
  409.           numeric argument, you may specify r, for carrige return
  410.           (CR), n, for newline  (LF),  s,  for  record  separator
  411.           (RS), the symbol -, for no line terminator, or the sym-
  412.           bol # to get  carrige  return  followed  by  a  newline
  413.           (CR/LF).
  414.  
  415.      -v   Normally, pep will terminate each line with the canoni-
  416.           cal  line  terminator.   Some  typesetting programs and
  417.           word processors, however, require  that  no  hard  line
  418.           terminator is present within a paragraph, and that only
  419.           paragraphs are hard terminated.  If you want to  import
  420.           a file to such a typesetting program or word processor,
  421.           you may instruct pep to terminate paragraphs only  with
  422.           this option.
  423.  
  424.           See note in "bugs" section  below  about  treatment  of
  425.           "end-of-line" and "end-of-paragraph".
  426.  
  427.      -w + | -
  428.           This slightly obsolete option  converts  files  to  and
  429.           from  the WordStar version 3.2 "document" mode.  If the
  430.           argument is "+", the  file  is  converted  to  WordStar
  431.           document mode; if the argument is "-", the file is con-
  432.           verted from WordStar document  mode  into  plain  ASCII
  433.           text.
  434.  
  435.      -x   Expand unprintable characters.  This option  will  make
  436.           pep  expand  the  characters  it would otherwise remove
  437.           from the file by printing  the  character  encoding  of
  438.           these characters in hexadecimal between angle brackets.
  439.  
  440.      -z   Zero the eight bit (a.k.a. the parity bit) on all char-
  441.           acters in the file.
  442.  
  443. ENVIRONMENT
  444.      Pep knows a single environment variable: PEP, which  may  be
  445.      used  to  indicate the lookup path for files with conversion
  446.      tables.  Below is some examples on how to set this  in  some
  447.      operating systems:
  448.           set PEP=c:\usr\lib                 (MS-DOS)
  449.           setenv PEP /usr/local/lib                    (UNIX)
  450.           define PEP "DISK_USR:<LOCAL.LIB>"       (VMS)
  451.  
  452.      The command to set this environment variable should  usually
  453.      be  part of the command file that is read during login (this
  454.      may be named AUTOEXEC.BAT,  LOGIN.COM,  .profile  or  .login
  455.      depending upon your choice of operating system.  Please note
  456.  
  457.  
  458.  
  459. Version 2.1       Last change: 28 December 1989                 7
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466. PEP(1L)                  LOCAL COMMANDS                   PEP(1L)
  467.  
  468.  
  469.  
  470.      that environment variables do not exist under CP/M.
  471.  
  472. EXAMPLES
  473.      Some of the examples below use i/o redirection and pipes, as
  474.      indicated with the symbols ">" and "<" (redirection) and "|"
  475.      (pipe symbol).  These examples only apply to operating  sys-
  476.      tems that support redirection and pipes.
  477.  
  478.      pep -h
  479.         Print a quick summary of all available options, and exit.
  480.  
  481.      pep
  482.         Read input from standard input (the keyboard), and  write
  483.         the result on standard output (the screen) until the user
  484.         types the end of file character (usually CTRL-D (UNIX) or
  485.         CTRL-Z  (MS-DOS)).   This  is of limited practical use by
  486.         itself, usually this command is inserted into the  middle
  487.         of a command where the standard input and standard output
  488.         are pipes.
  489.  
  490.      pep < foo.bar
  491.         Display a slightly cleaned-up version of the file foo.bar
  492.         on the screen.
  493.  
  494.      pep < foo.bar > foo.txt
  495.         Read the file foo.bar, clean it, and write the result  on
  496.         the file foo.txt.
  497.  
  498.      pep foo.bar > foo.txt
  499.         Read the file foo.bar, clean it, and write the result  on
  500.         the file foo.txt.
  501.  
  502.      pep foo1.bar foo2.bar > foo.txt
  503.         Read the files foo1.bar and  foo2.bar,  clean  them,  and
  504.         catenate the result on the file foo.txt.
  505.  
  506.      pep -o foo.fil bar.fil
  507.         Clean the files foo.fil and bar.fil, replacing the origi-
  508.         nal files with the cleaned-up versions.
  509.  
  510.      pep -ob foo.fil bar.fil
  511.         Clean the files foo.fil and bar.fil, replacing the origi-
  512.         nal  files  with  the  cleaned-up versions.  The original
  513.         files are preserved as foo.bak and bar.bak.
  514.  
  515.      pep -i+ -o program.dok
  516.         Convert the Norwegian text in the file program.dok to use
  517.         the  IBM-PC  8  bit character set.  Please note that this
  518.         conversion may not be 100 percent correct.  For instance,
  519.         the  pipe  symbol "|" will be converted to the lower case
  520.         Norwegian oslash character.  This  is  because  the  pipe
  521.         symbol  and the character share the same ASCII code (124)
  522.  
  523.  
  524.  
  525. Version 2.1       Last change: 28 December 1989                 8
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532. PEP(1L)                  LOCAL COMMANDS                   PEP(1L)
  533.  
  534.  
  535.  
  536.         in the Norwegian version of the 7-bit character set,  but
  537.         they  have  different  codes  when  using 8-bit character
  538.         sets.
  539.  
  540.      pep -e2 -o kermit.log
  541.         Interpret ANSI  screen  control  sequences  in  the  file
  542.         kermit.log.   Set  guard  to  level  2  (no  deletion  or
  543.         overwriting).
  544.  
  545.         In this example, it is assumed that the  file  kermit.log
  546.         is  a log record of an on-line session with some Bulletin
  547.         Board System (BBS).  Such files may be created  with  the
  548.         command "log session" in the popular kermit communication
  549.         program.  Most other communication programs have  similar
  550.         commands.   Many BBSs uses uses ANSI sequences for simple
  551.         graphics, highlighting and other special effects, and you
  552.         will get a much more more readable session log if you run
  553.         it through pep with the -e option turned on.
  554.  
  555.      test | pep -e > test.scr
  556.         Run the program test, and pipe its output to  pep,  which
  557.         interprets  any  ANSI  sequences  and store the resulting
  558.         screen images in the file test.scr.  Note  that  this  is
  559.         only  possible  on  operating  systems that support pipes
  560.         (i.e. UNIX and MS-DOS).
  561.  
  562.         The screen images will now  be  on  standard  text  files
  563.         which have the same general layout as the original screen
  564.         images.  This may be useful if you need text versions  of
  565.         the  screen images for inclusion in manuals or for proto-
  566.         types.
  567.  
  568.      nroff -man -Tlpr pep.1l | pep > pep.doc
  569.         Generate a plain text version  of  this  manual,  without
  570.         backspaces  or double strikes (nroff is the standard Unix
  571.         text formatter).
  572.  
  573.      pep -d- -o *.txt
  574.         Convert all files with extension .txt from DEC/ISO  char-
  575.         acter set to Norwegian 7-bit ASCII characters.
  576.  
  577.      pep -gibm2mac -ur -< foo.ibm > foo.mac
  578.         Use the conversion table in the file ibm2mac  to  convert
  579.         the  character  set in the file foo.ibm. Store the result
  580.         on the file foo.mac, where each line should be terminated
  581.         by a single CR character.
  582.  
  583.      pep -m- < foo.mac | pep -i+ > foo.ibm
  584.         Convert Apple Macintosh encoded Norwegian  characters  in
  585.         the  file  foo.mac  to  IBM-PC  (Code Page 850) encoding.
  586.         This is an alternative way to accomplish the  same  thing
  587.         as the conversion done in the previous example.
  588.  
  589.  
  590.  
  591. Version 2.1       Last change: 28 December 1989                 9
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598. PEP(1L)                  LOCAL COMMANDS                   PEP(1L)
  599.  
  600.  
  601.  
  602.      pep -w- -o *.*
  603.         Convert all files in the current directory from  WordStar
  604.         document mode to 7-bit ASCII.
  605.  
  606.      pep -w+ -t4 < foo.txt > foo.ws
  607.         Convert the file foo.txt to WordStar document  mode  for-
  608.         mat,  also  expanding  tabulation  (tabstop = 4) to space
  609.         characters.  The result is stored on a file named foo.ws.
  610.         Pep uses a simple pattern recognition mechanism to recog-
  611.         nize  pages,  paragraphs,  soft  white  space  and   soft
  612.         hyphens.   It will probably not do a 100% conversion, but
  613.         the file will be much easier to edit in WordStar than the
  614.         original.
  615.  
  616.      pep -z -x < foo.dat > foo.dmp
  617.         Strip the 8th bit and expand control  characters  to  hex
  618.         digits  in  the file foo.dat, and store the result on the
  619.         file foo.dmp.
  620.  
  621.         Expanding the unprintable characters to hexadecimal makes
  622.         it  easier  to inspect a file in an ordinary text editor,
  623.         and to post-process it by a  customized  filter  you  may
  624.         create yourself with the search/replace and macro facili-
  625.         ties found in many editors today.
  626.  
  627.      pep -s6 -b < pep.exe
  628.         Extract "strings" from the file pep.exe. The strings  are
  629.         just  listed  on standard output (the screen).  "Strings"
  630.         are in this context assumed to be any sequence of charac-
  631.         ters  that are at least 6 characters long.  The -b option
  632.         excludes characters with codes in the range  128  to  255
  633.         from the search.  It is almost always a good idea to com-
  634.         bine the -b option with -s option, otherwise to much gar-
  635.         bage is picked up by the filter.
  636.  
  637.      pep -t4 -c8 -o foo.c
  638.         If both tab expansion -t and tab compression -c is speci-
  639.         fied,  then pep will repack the tabulation.  This is use-
  640.         ful if you want to convert a file from  one  tab-size  to
  641.         another (e.g. to convert non-standard 4 character tabula-
  642.         tion into standard  8  character  tabulation).   In  this
  643.         example,  two  TAB  characters  in  the  file  foo.c  are
  644.         replaced by a single tab character: and any TAB character
  645.         that  cannot  be paired up is replaced by the appropriate
  646.         number of spaces.
  647.  
  648.      pep -t -c -o foo.c
  649.         Remove redundant space characters in existing  tabulation
  650.         in  the  file  foo.c.  What happens is that tabulation on
  651.         each line is first expanded and  then  compressed  again,
  652.         which effectively removes any space characters "inside" a
  653.         tabulation.
  654.  
  655.  
  656.  
  657. Version 2.1       Last change: 28 December 1989                10
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664. PEP(1L)                  LOCAL COMMANDS                   PEP(1L)
  665.  
  666.  
  667.  
  668. DIAGNOSTICS
  669.      If you specify an option that pep does not  recognize,  then
  670.      pep  will  write a summary of usage and abort.  Other errors
  671.      on the command line will result in pep writing an error mes-
  672.      sage before aborting.
  673.  
  674.      On operating systems  that  support  exit  codes,  pep  will
  675.      return an exit code upon termination.
  676.  
  677.      If pep is interpreting ANSI  escape  sequences  and  notices
  678.      syntactical or semantical errors in the way they are used, a
  679.      warning is printed on the screen, prefixed with  the  string
  680.      "ansi:".   This means that it is also possible to use pep to
  681.      check if programs use ANSI sequences in a portable way.
  682.  
  683. FILES
  684.      pep, pep.exe, pep.cmd
  685.                executable file (actual name  depends  upon  which
  686.                operating system you use).
  687.  
  688.      mac2ibm   small example of a user supplied conversion  table
  689.                to  convert  from  the  Macintosh character set to
  690.                that used on the Norwegian version of the original
  691.                IBM-PC  (the sample file only covers the Norwegian
  692.                characters - to complete it is left as an exercise
  693.                to the reader :-) ).
  694.  
  695.      ibm2mac   inverse of mac2ibm: conversion table from a  small
  696.                subset of IBM CP 850 to Macintosh character set.
  697.  
  698.      ebc2ns7   conversion table from the IBM EBCDIC character set
  699.                to  the Norwegian version of the ASCII 7-bit char-
  700.                acter set (ISO646 NS4551).
  701.  
  702.      ibm2ro8   conversion table from the IBM-PC  8-bit  character
  703.                set to Hewlett-Packard ROMAN8.
  704.  
  705.      ro82ibm   inverse of ibm2ro8: conversion table  from  ROMAN8
  706.                to IBM-PC character set.
  707.  
  708.      ibm2iso   conversion table from  the  IBM-PC  CP  850  8-bit
  709.                character set to ISO 8859/1.
  710.  
  711.      iso2ibm   inverse of  ibm2iso:  conversion  table  from  ISO
  712.                8859/1 to CP 850.
  713.  
  714. AUTHOR
  715.      Copyright (C) 1989 Gisle Hannemyr.
  716.  
  717.      Pep may be freely distributed and copied, as  long  as  this
  718.      file  is  included in the distribution and that these state-
  719.      ments about authorship  and  copyright  is  not  altered  or
  720.  
  721.  
  722.  
  723. Version 2.1       Last change: 28 December 1989                11
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730. PEP(1L)                  LOCAL COMMANDS                   PEP(1L)
  731.  
  732.  
  733.  
  734.      removed.
  735.  
  736.      Bug reports, improvements, comments, suggestions and  flames
  737.      to:
  738.        Snail: Gisle Hannemyr, Brageveien 3A, 0452 Oslo, Norway.
  739.        Email: gisle@nr.uninett (EAN);
  740.               gisle@ifi.uio.no (Internet);
  741.               ...!mcvax!ifi!gisle (UUCP);
  742.               (and several BBS mailboxes).
  743.  
  744. ACKNOWLEDGMENTS
  745.      Thanks to Robert Andersson, for the SYS-V  rename  function;
  746.      and to Knut Borge, Bjoern Larsen, Knut Omang and Geir-Harald
  747.      Strand, for elucidation of  the  unspeakeable  mysteries  of
  748.      VMS.   Special  thanks  are due Inge Arnesen for finding and
  749.      fixed a bug, (and to Nils-Eivind Naas for bringing it to  my
  750.      attention).
  751.  
  752.      Several people have contributed ideas  and/or  bug  reports.
  753.      In  addition  to  those  mentioned above, Ola Garstad, Ottar
  754.      Grimstad, Tor Sjoewall, and Jens-Henrik Soerensen should  be
  755.      mentioned.  My apologies if anyone is forgotten.
  756.  
  757. SEE ALSO
  758.      dd(1),   detex(1L),   convert(VMS),    expand(1),    od(1V),
  759.      strings(1), tr(1), unexpand(1).
  760.  
  761.      Detex(1L) is a lex-based program to convert  LaTex  and  TeX
  762.      manuscripts into plain ASCII text.  It is available from the
  763.      author upon request.  Those  marked  VMS  are  standard  VMS
  764.      utilities.  The others are standard UNIX utilities.
  765.  
  766. BUGS
  767.      There is a very strong Norwegian bias in pep. In particular,
  768.      there  exists several national versions of the ISO 646 7-bit
  769.      character set; but all built-in functions to convert between
  770.      this  and various 8-bit character sets (i.e.  -d, -i, -k and
  771.      -m) bluntly assumes the standard Norwegian  version  of  the
  772.      ISO 646. For pep to work with other national 7-bit character
  773.      sets, the compiled in conversion tables (type FOLDMATRIX for
  774.      those who read the source code) need to be extended.
  775.  
  776.      The VMS version of pep runs with the -o  option  permanently
  777.      enabled.  This is because VMS does not support an useful i/o
  778.      redirection or pipe mechanism.
  779.  
  780.      The VMS Record Management Service  (RMS)  knows  of  several
  781.      record formats.  You can see what record format a file is by
  782.      using the VMS DCL command  DIRECTORY/FULL  and  examine  the
  783.      field "Record format".  On VMS systems, Pep will always gen-
  784.      erate output files with record format  set  to  "Stream_LF",
  785.      but  some  programs  may  require that the output file is in
  786.  
  787.  
  788.  
  789. Version 2.1       Last change: 28 December 1989                12
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796. PEP(1L)                  LOCAL COMMANDS                   PEP(1L)
  797.  
  798.  
  799.  
  800.      other formats.  To fix this, it might be  necessary  to  run
  801.      the  output  of pep through the VMS CONVERT utility.  Please
  802.      see the DEC VMS manuals for details.
  803.  
  804.      The Macintosh "text only" format uses  the  carriage  return
  805.      (CR)  character (ASCII 13) as terminator.  Most text proces-
  806.      sors (e.g. MacWrite) seems capable of handling  two  conven-
  807.      tions:  One  is to use CR to terminate each line (and two or
  808.      more consequtive CR's between paragraphs); the other  is  to
  809.      use CR between paragraphs only.  Pep is also capable of han-
  810.      dling both conventions.  The default behaviour  is  to  ter-
  811.      minate each line, but the -v option may be used to terminate
  812.      paragraphs  only.   Please  note  that  pep  uses  a  rather
  813.      simplistic  heuristic to identify the end of a paragraph, it
  814.      bluntly assumes  that  paragraphs  are  separated  by  blank
  815.      lines.
  816.  
  817.      If you use the -o option, then the original input file  will
  818.      be  overwritten.   Before you are familiar with pep, you may
  819.      find that it sometimes removes more material than you expect
  820.      from a file.  It may be a good idea to always make a copy of
  821.      the original file before you start experimenting  with  pep,
  822.      or you may add the "b" argument to the -o option (-ob).
  823.  
  824.      The built-in IBM-PC, DEC  and  Macintosh  conversion  tables
  825.      converts  to and from the Norwegian version of 7-bit "ASCII"
  826.      characters.  You should use  the  -g  option  and  "general"
  827.      conversion tables for all other purposes.
  828.  
  829.      Pep only knows the ANSI sequences implemented in  the  stan-
  830.      dard MS-DOS console driver ANSI.SYS.
  831.  
  832.      There cannot be a space character between an option and  the
  833.      option's  argument (e.g. you'll have to use "-gfoo.bar", not
  834.      "-g foo.bar").
  835.  
  836.      Pep will only filter "regular" files.  It will  skip  direc-
  837.      tories, sockets and "special" files.
  838.  
  839.      Links are the GOTOs of file systems.   If  you  run  a  hard
  840.      linked  file  through pep using the -o option, the link will
  841.      not be preserved.  Pep will just skip soft linked files.
  842.  
  843.      Pep searches for the conversion tables requested with the -g
  844.      option  in the following order: first the current directory,
  845.      then the directory of the file PEP.EXE  (MS-DOS  only),  and
  846.      finally  the  directory  pointed  to  by the PEP environment
  847.      variable.
  848.  
  849.      Pep knows nothing about the COFF-format and the -s option is
  850.      primitive  compared  to  the UNIX command strings(1).  So if
  851.      you are on a UNIX-system - forget about the  -s  option  and
  852.  
  853.  
  854.  
  855. Version 2.1       Last change: 28 December 1989                13
  856.  
  857.  
  858.  
  859.  
  860.  
  861.  
  862. PEP(1L)                  LOCAL COMMANDS                   PEP(1L)
  863.  
  864.  
  865.  
  866.      use strings(1) instead.
  867.  
  868.      Pep will not  convert  Word  Perfect  documents  into  plain
  869.      ASCII.  This much requested function is, however, built into
  870.      Word Perfect.  It  is  named  "store  as  DOS-text"  and  is
  871.      activated  by  pressing  CTRL-F5  (at  least in Word Perfect
  872.      4.2).
  873.  
  874.  
  875.  
  876.  
  877.  
  878.  
  879.  
  880.  
  881.  
  882.  
  883.  
  884.  
  885.  
  886.  
  887.  
  888.  
  889.  
  890.  
  891.  
  892.  
  893.  
  894.  
  895.  
  896.  
  897.  
  898.  
  899.  
  900.  
  901.  
  902.  
  903.  
  904.  
  905.  
  906.  
  907.  
  908.  
  909.  
  910.  
  911.  
  912.  
  913.  
  914.  
  915.  
  916.  
  917.  
  918.  
  919.  
  920.  
  921. Version 2.1       Last change: 28 December 1989                14
  922.  
  923.  
  924.  
  925.