home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 9 Archive / 09-Archive.zip / PXOS221A.LZH / POLYXARC.DOC < prev    next >
Text File  |  1991-04-14  |  42KB  |  856 lines

  1.  
  2.                                                                 page 1
  3.  
  4.  
  5.                                     PolyXarc
  6.                                v2.1  5 April 1991
  7.                        Public domain by Jeffrey J. Nonken
  8.                             OS/2 port by Bill Andrus
  9.  
  10.         By  giving this away, complete with source code and docs, I  hope 
  11.         to  encourage others to do likewise. I think we can all  gain  in 
  12.         the long run by sharing. Public Domain means that nobody owns it. 
  13.         You  can  give  it away, sell it,  incorporate  bits  into  other 
  14.         programs, whatever you want. However, in the interests of program 
  15.         management,  I request that if you make changes that may  benefit 
  16.         others, you
  17.          1) Share them with us;
  18.          2) Send me a copy of source so I can make an 'official' release.
  19.  
  20.         Warranty: none.
  21.  
  22.         Address  netmail to 1:273/715 in Fidonet. If you wish to log  on, 
  23.         call (215)279-9799 (300/1200/2400/9600/14400 HST/V.32),  PCPable. 
  24.         You  can get the latest distribution version of PolyXarc by  file 
  25.         requesting POLYXARC from 1:273/715. If you wish to send  anything 
  26.         via U.S. Snail, write to:
  27.  
  28.                                Jeffrey J. Nonken
  29.                                1706 Cherrie Circle
  30.                                Blue Bell, Pa. 19422-3412
  31.  
  32.         NOTE:  Version  2.0 has major changes in the  configuration  file 
  33.         syntax. VERSION 1.x CONFIGURATION FILES WILL NOT WORK WITH 2.x! I 
  34.         have  made  no  attempts to detect old  configuration  files  and 
  35.         provide correction or warning; that would complicate and  enlarge 
  36.         PolyXarc  unnecessarily.  It  is  up to you  to  make  sure  your 
  37.         configuration  files have been replaced or updated.  Version  2.0 
  38.         configuration files will work just peachy with version 2.1.
  39.  
  40.         WHAT IT IS
  41.         ==========
  42.         "Poly"  means  "many",  and  "Xarc"  means  "archive  extractor". 
  43.         PolyXarc  is a program that permits automatic extraction of  most 
  44.         known  archive formats. By "Xarc" I do not specifically refer  to 
  45.         SEA's  ARC or XARC programs or the file format supported  by  ARC 
  46.         (which  I  will  refer  to as  ".ARC  format"  herein),  although 
  47.         PolyXarc  supports both. The purpose of this program is to  allow 
  48.         Fidonet  BBS  system operators to automatically  extract  bundles 
  49.         that have been made with various archive programs.  Traditionally 
  50.         sysops  have used one .ARC format program or another. But  recent 
  51.         improvements  in  compression techniques, along  with  a  rapidly 
  52.         climbing  volume of echomail, have encouraged sysops to  look  at 
  53.         other programs.
  54.  
  55.         It  is  not  my purpose to praise or encourage  the  use  of  one 
  56.         archive  format  over  another. In fact,  the  whole  purpose  of 
  57.         PolyXarc is to support as wide a variety as possible. 
  58.  
  59.  
  60.  
  61.  
  62.            PolyXarc 2.1: multiple-format archive extractor executive
  63.                                                                 page 2
  64.  
  65.  
  66.         PolyXarc   does  not  itself  extract  archive  files;   PolyXarc 
  67.         identifies   which  format  is  being  used  and  calls  on   the 
  68.         appropriate  archive extractor program to do the actual work.  In 
  69.         this  lies  its  flexibility. Think of PolyXarc  as  an  "Archive 
  70.         Extractor Executive".
  71.  
  72.         PolyXarc is a direct replacement for SPAZ v1.40 (developed by Dan 
  73.         Thomson  and Andrew Farmer), except that PolyXarc is much  larger 
  74.         (about 35k vs. 6k) and may not work in cases where memory is at a 
  75.         premium.  However,  PolyXarc  is more  versatile  and  much  more 
  76.         flexible.
  77.  
  78.         PolyXarc's main features are:
  79.          - Automatic stand-alone mail bundle extraction;
  80.          - Small and fast;
  81.          - Flexible and adaptable.
  82.  
  83.         PolyXarc  can find all mail bundles in a specified directory  and 
  84.         de-archive  all of them. In addition, PolyXarc can  sort  version 
  85.         5 .ARC files by their date/timestamps before beginning extraction 
  86.         to assure that the packets are, as much as possible, extracted in 
  87.         the correct order. PolyXarc also gives you the choice of limiting 
  88.         the number of archives that it extracts in a session so that  you 
  89.         can process them a few at a time instead of all at once.
  90.  
  91.         I  tried to write PolyXarc to be as flexible and expandable as  I 
  92.         could  within reason. Unlike most multi-archive mail  unbundlers, 
  93.         except  for some .ARC format recognition, PolyXarc does not  have 
  94.         any specific format recognition built in. Instead, PolyXarc has a 
  95.         configuration  file that contains signature strings  and  command 
  96.         line  templates, allowing you to expand  PolyXarc's  capabilities 
  97.         without having to write any code. In addition, you can  customize 
  98.         PolyXarc's recognition of .ARC format compression flags, and tell 
  99.         it  which  program to use for which flag. However,  if  all  else 
  100.         fails,  and you come upon a format for which PolyXarc  cannot  be 
  101.         configured, you can alter the source to accomodate it, for I have 
  102.         released  the  source  code  to the  public  domain.  This  gives 
  103.         unlimited  permission  for  anybody  to  alter  it,  providing  a 
  104.         permanent upgrade path.
  105.  
  106.         If  the  explanations in this document don't make sense,  take  a 
  107.         look at POLYXPLN.DOC; it picks apart the config file and explains 
  108.         some details about the archivers.
  109.  
  110.         HOW TO USE IT
  111.         =============
  112.         PolyXarc's syntax is:
  113.  
  114.           PolyXarc [switches] archive [name [name...]] [switches]
  115.  
  116.         Recognized switches are:
  117.           -Cconfig               -I                     -O                     
  118.           -D                     -Maddr                 -R                     
  119.           -F[n]                  -N                     -Q                     
  120.           -#
  121.  
  122.  
  123.            PolyXarc 2.1: multiple-format archive extractor executive
  124.                                                                 page 3
  125.  
  126.  
  127.  
  128.         archive
  129.  
  130.         This is the name of the archive file you wish to extract from, or 
  131.         if  you  specify the -F switch, the path where mail  bundles  are 
  132.         kept. In the former case (not using -F) wildcards are  supported, 
  133.         and  if you do not supply an extension, PolyXarc will  assume  an 
  134.         extension  of  ".*".  In the latter case  (using  -F),  you  must 
  135.         specify a path ONLY, not a file name. Also, if you specify -F you 
  136.         may leave the archive path out completely and it will default  to 
  137.         the current directory.
  138.  
  139.         name...
  140.  
  141.         This  is  one or more names of files within the archive.  If  you 
  142.         list  more  than one name, they should be  separated  by  spaces. 
  143.         These are optional. If left off, most extractors will assume that 
  144.         you  want  to extract all files. You must list the  archive  name 
  145.         (above) before listing individual file names. PolyXarc  considers 
  146.         any parameter that does not start with a switch character ('-' or 
  147.         '/') to be a file name or archive name.
  148.  
  149.         -Cconfig
  150.  
  151.         This  is  the  file  that  contains  signature  information   for 
  152.         PolyXarc.  If  it is not in your current  subdirectory  you  must 
  153.         supply a path to it as well. The file name must follow the switch 
  154.         with  no  intervening  spaces. If you do not specify  -C  on  the 
  155.         command  line, PolyXarc will look first for POLYXARC.CFG  in  the 
  156.         current directory, then in the directory of the .EXE file, and if 
  157.         not found will then look for a PENGUIN file (described later).
  158.  
  159.         -D
  160.  
  161.         Specifying this will cause PolyXarc to delete any archive file it 
  162.         successfully has extracted. Specifying the /F parameter causes /D 
  163.         to be enabled unconditionally.
  164.  
  165.         -F[n]
  166.  
  167.         -F  will  cause PolyXarc to extract all the mail bundles  it  can 
  168.         find in the subdirectory specified by 'archive'. If you specify a 
  169.         number after the F (like "-F2"), PolyXarc will extract up to that 
  170.         number of mail bundles. In this case 'archive' (above) must be  a 
  171.         path,  not a filename. Specifying -F also forces -D and  -O,  and 
  172.         disables -N.
  173.  
  174.         -I
  175.  
  176.         I really mostly intended this for use in some manual modes.  This 
  177.         switch  will  cause PolyXarc to ignore errors returned  from  the 
  178.         archivers.
  179.  
  180.  
  181.  
  182.  
  183.  
  184.            PolyXarc 2.1: multiple-format archive extractor executive
  185.                                                                 page 4
  186.  
  187.  
  188.         -Maddr
  189.  
  190.         This causes PolyXarc to calculate and display the net address  of 
  191.         the  sender of each bundle. 'addr' is your netmail  address,  net 
  192.         and node only. Example: -M273/715.
  193.  
  194.         -N
  195.  
  196.         Specifying  this causes PolyXarc not to attempt to  sort  an .ARC 
  197.         format file. Normal action is to sort all .ARC format files  (the 
  198.         files inside the archive) by the date and time stamps. Specifying 
  199.         -F  will override -N and cause PolyXarc to sort the  files.  Note 
  200.         that PolyXarc will not sort ARC version 6 files.
  201.  
  202.         -O
  203.  
  204.         This is the overwrite flag. If the archiver finds that a file  it 
  205.         is  extracting  already  exists,  this  flag  will  cause  it  to 
  206.         overwrite  the  old  file without prompting.  Specifying  the  -F 
  207.         parameter causes -O to be enabled unconditionally.
  208.  
  209.         -R
  210.  
  211.         This  is  the same as -O. I included it to maintain  ARCE  syntax 
  212.         compatibility  for people who want to call PolyXarc  from  within 
  213.         other programs (such as Opus 1.0).
  214.  
  215.         -Q
  216.  
  217.         Specifying  -Q  causes PolyXarc not to display  most  status  and 
  218.         configuration messages. Error messages will still be displayed.
  219.  
  220.         -#
  221.  
  222.         Normally  when you invoke the -F switch, PolyXarc  will  unbundle 
  223.         files  with  extensions starting with .MO, .TU, etc.  and  ending 
  224.         with any character. If you add the -# switch, PolyXarc will  only 
  225.         unbundle files ending with a decimal digit (0-9).
  226.  
  227.              NOTE:  None of these switches is position dependent  or 
  228.              case sensitive. Any may be specified with a hyphen  (-) 
  229.              or  a slash (/). If you specify a question mark (?)  as 
  230.              the first parameter, you will get a brief help  message 
  231.              and no processing will be done.
  232.  
  233.         PolyXarc  requires a single configuration file. This  file  gives 
  234.         PolyXarc enough information to recognize various archive  formats 
  235.         by  looking  for specific 'signatures'. There are three  ways  to 
  236.         specify the configuration file name:
  237.          - just  have  POLYXARC.CFG in the current directory, or  in  the 
  238.            directory with POLYXARC.EXE;
  239.          - use the -C switch to specify it on the command line;
  240.          - use a PENGUIN file.
  241.  
  242.  
  243.  
  244.  
  245.            PolyXarc 2.1: multiple-format archive extractor executive
  246.                                                                 page 5
  247.  
  248.  
  249.         Doug  Boone  has  proposed  an idea  that  I  like;  rather  than 
  250.         proliferate configuration files, gather as many as possible  into 
  251.         one file. His implementation requires you to specify the file  in 
  252.         an  environment  variable called PENGUIN. PolyXarc  may  use  the 
  253.         PENGUIN technique if you have set the environment variable.
  254.  
  255.         This  is  how  PolyXarc decides which technique to  use:  if  you 
  256.         specify  a  file  on the command line  using  the  -C  parameter, 
  257.         PolyXarc  will  use  that  file. If  you  don't  specify  the  -C 
  258.         parameter,  PolyXarc  will look for POLYXARC.CFG in  the  current 
  259.         directory.  If it doesn't exist, PolyXarc will then look  in  the 
  260.         directory  that it was executed from. If it isn't  there  either, 
  261.         PolyXarc  will look for the PENGUIN environment variable.  If  it 
  262.         exists, PolyXarc will use that file; otherwise, it will exit with 
  263.         an error. 
  264.  
  265.         To  set the environment variable, you would put a statement  like 
  266.         this into your AUTOEXEC.BAT file:
  267.  
  268.           SET PENGUIN=D:\OPUS\PENGUIN.CFG
  269.  
  270.         There  are three  keywords  that  PolyXarc  recognizes  in   the 
  271.         configuration file, one of which has three variations, plus BEGIN 
  272.         and  END  statements. PolyXarc will not  recognize  any  keywords 
  273.         until  it  sees  a  BEGIN POLYXARC  statement,  and  will  ignore 
  274.         anything  after an END POLYXARC statement until it  sees  another 
  275.         BEGIN  POLYXARC, if any. You may have as many of these blocks  as 
  276.         you  want in the configuration file, and they may  overlap  other 
  277.         programs'  blocks if you wish. PolyXarc will ignore  anything  it 
  278.         doesn't recognize. The keywords are:
  279.  
  280.           ARC
  281.           ARC5 (same as ARC)
  282.           ARC6
  283.           SIGNATURE
  284.           NOSORT
  285.  
  286.         Before  I  describe  the keyword syntaxes,  let  me  explain  the 
  287.         command  templates they use. A command template is a  description 
  288.         of  the command line used to call a certain program. The  general 
  289.         syntax of a command line consists of the command, followed by one 
  290.         or more parameters, the overwrite flag key, the extract flag key, 
  291.         the filename key, and/or the extractname key. The parameters  and 
  292.         keys  may be in different orders depending on the syntax  of  the 
  293.         particular archive extractor you are using.
  294.  
  295.         The  command  is the actual DOS command used to run  the  program 
  296.         (such  as  "ZOO" or "ARCE"). The parameters  are  any  parameters 
  297.         needed  to cause an extraction. The extract flag key is  actually 
  298.         an  'insert  flag' that tells PolyXarc where to put  the  extract 
  299.         switch  if  it  is  needed. The extract flag  key  is  "%1".  The 
  300.         overwrite  flag  key,  "%2",  tells PolyXarc  where  to  put  the 
  301.         overwrite switch if it is needed. The filename key, "%3", is  the 
  302.         name of the archive to extract from, and is also an insert  flag. 
  303.         The extractname key, "%4", is a list of names of files to extract 
  304.  
  305.  
  306.            PolyXarc 2.1: multiple-format archive extractor executive
  307.                                                                 page 6
  308.  
  309.  
  310.         from  the archive. Another way of looking at it is that you  take 
  311.         the general syntax for the particular archiver, put a %1 in place 
  312.         of the extract switch (if any... most archivers will not actually 
  313.         use this field), a %2  in place of the overwrite switch, a %3  in 
  314.         place  of the archive filename, and a %4 where the list of  files 
  315.         would  be  if you wanted to specify which files to  extract.  The 
  316.         actual order of these parameters depends on what each  particular 
  317.         archiver expects to see.
  318.  
  319.         As  mentioned  above, most extractors will not need  the  extract 
  320.         flag  key. In most cases, the extractors have an extract  command 
  321.         (either  explicit  or  implied) that is  used  whether  you  want 
  322.         automatic  overwrite or not; to overwrite, you use the  overwrite 
  323.         command  in addition to the extract command. I have not seen  any 
  324.         archive  extractor  that  uses a separate  command  for  extract-
  325.         without-overwrite versus extract-with-overwrite; nevertheless,  I 
  326.         would  rather include support for a redundant parameter now  than 
  327.         have  to 'fix' it later. In any case, the extract flag  key  will 
  328.         only  be  used if overwrite option is not invoked  on  PolyXarc's 
  329.         command line, and the overwrite flag key will only be used if the 
  330.         overwrite option is invoked. If there is an extract command  that 
  331.         is  used  whether or not overwrite is invoked,  then  you  should 
  332.         include it as a permanent part of the template for that command.
  333.  
  334.         General syntax for the ARC keywords:
  335.  
  336.           ARC level overwrite extract command_template
  337.           ARC5 level overwrite extract command_template
  338.           ARC6 level overwrite extract command_template
  339.  
  340.         PolyXarc recognizes .ARC format files internally. The ARC command 
  341.         spec  defines  a  level (known as a  'header  type'  by  the .ARC 
  342.         compatible  programs)  at  which  a  certain  program  should  be 
  343.         executed.  ARC  programs  will generally  extract  any  level  of 
  344.         compression up to the level they are capable of. For example, ARC 
  345.         version  5  and ARCE will extract up to level 8; ARC  version  6, 
  346.         PKXARC, and PKUNPAK will extract up to level 9; PAK will  extract 
  347.         up to level 11. Specify the appropriate level for each  extractor 
  348.         you  will  be  using.  Note that you  need  not  supply  all  the 
  349.         extractors you have available; for example, PAK will extract  all 
  350.         your  version 5 .ARC files. However, due to speed or  memory  you 
  351.         may  want  to specify several archivers so that the  smallest  or 
  352.         fastest may be used whenever possible.
  353.  
  354.         ARC  version  6  is a special case. SEA  introduced  an  extended 
  355.         header  format  that  allows non-file information  to  be  added. 
  356.         Version  5 programs such as PKPAK and PAK cannot deal with  these 
  357.         formats  and  will exit with an error if you try to use  them  on 
  358.         version  6 files. Version 2.0 of Polyxarc also does not know  how 
  359.         to deal with these files. However, even version 6 ARC files  have 
  360.         different  levels, and PAK, a strictly version 5  archiver,  uses 
  361.         compression  levels  that  are incompatible with  ARC  version  6 
  362.         ARC+PLUS.  So  if PolyXarc 2.1 detects version 6  information  in 
  363.         an .ARC file, it will look for an archiver with an ARC6 keyword.
  364.  
  365.  
  366.  
  367.            PolyXarc 2.1: multiple-format archive extractor executive
  368.                                                                 page 7
  369.  
  370.  
  371.         ARC version 6 programs can extract version 5 files. Unfortunatly, 
  372.         PAK level 10 is incompatible with ARC+PLUS level 10. So  PolyXarc 
  373.         tries to use version 5 archivers for version 5 files if they  are 
  374.         specified.  If  no version 5 archiver in your  config  file  will 
  375.         extract  the version 5 archive, PolyXarc will attempt to apply  a 
  376.         version  6  archiver to the file. Note that PolyXarc  will  never 
  377.         attempt  to  use  a version 5 archiver to  extract  a  version  6 
  378.         archive.
  379.  
  380.         Please  note that unlike PolyXarc version 2.0,  PolyXarc  version 
  381.         2.1  does not need the .ARC format signature lines listed in  any 
  382.         particular  order.  Version  2.1  now  automatically  sorts   the 
  383.         signatures  once it reads them in. All you have to do is get  the 
  384.         levels and versions right.
  385.  
  386.         If  this is confusing to you, imagine how difficult it is  trying 
  387.         to  describe it! But if you use the commands in  the  distributed 
  388.         POLYXARC.CFG   file  you  should  be  ok.  You  may   also   read 
  389.         POLYXPLN.DOC for some more detailed explanations.
  390.  
  391.         An  example  of mixed ARC lines (remember, ARC and ARC5  are  the 
  392.         same):
  393.  
  394.            ARC5       8    /r ""  arce %3 %4 %2
  395.            ARC       11   /WA ""  pak /e %2 %3 %4
  396.            ARC6      10    /o ""  xarc %2 %3 %4
  397.  
  398.         Ok,  back  to  the syntax descriptions. A reminder  of  what  the 
  399.         signature lines look like:
  400.  
  401.           ARC level overwrite extract command_template
  402.           ARC5 level overwrite extract command_template
  403.           ARC6 level overwrite extract command_template
  404.  
  405.         Overwrite is the parameter this particular archive program  needs 
  406.         in   order  to  automatically  overwrite  existing  files   while 
  407.         extracting. The overwrite parameter must be 5 characters or less.
  408.  
  409.         Extract is the parameter this particular archive program needs in 
  410.         order to extract files. This is only used for programs which  use 
  411.         different  commmands for 'extract' and 'extract  overwrite'.  The 
  412.         extract parameter must be 5 characters or less.
  413.  
  414.         In  most cases you will not need the extract parameter.  However, 
  415.         there  must  be something defined for each field, whether  it  is 
  416.         used or not. In my distributed configuration file I simply put in 
  417.         an empty string ("") as a place holder.
  418.  
  419.         The command template defines the command line (including the name 
  420.         of  the arc file) used to invoke the necessary de-archiver.  
  421.  
  422.         Here are some examples from the distributed configuration file:
  423.  
  424.  
  425.  
  426.  
  427.  
  428.            PolyXarc 2.1: multiple-format archive extractor executive
  429.                                                                 page 8
  430.  
  431.  
  432.            ARC        8    /r  ""  arce %3 %4 %2
  433.            ARC        9    /r  ""  pkunpak %2 %3 %4
  434.            ARC6      10    /o  ""  xarc %2 %3 %4
  435.            ARC       11   /WA /WO  pak /e %1%2 %3 %4
  436.  
  437.         Here is the PAK command line that PolyXarc might generate,  first 
  438.         with overwrite enabled, then without:
  439.  
  440.           pak /e /WA 0000FFFB.MO2 
  441.           pak /e /WO 0000FFFB.MO2 
  442.  
  443.         Here is the PKUNPAK command line in the same order:
  444.  
  445.           pkunpak /r 0000FFFB.MO2
  446.           pkunpak  0000FFFB.MO2
  447.  
  448.         General syntax for the SIGNATURE keyword:
  449.  
  450.           SIGNATURE type offset signature overwrite extract template
  451.  
  452.         This command allows PolyXarc to automatically recognize different 
  453.         compressor   archive  formats  without  being  locked  into   any 
  454.         particular format or set of formats. Note that you should not try 
  455.         to  define  a  SIGNATURE  for .ARC  format  files,  as  they  are 
  456.         recognized  internally. The different signatures will  be  looked 
  457.         for in order of definition, with .ARC files coming last. 
  458.  
  459.         Offset is the offset into the file of the signature. If offset is 
  460.         preceeded  by a '-' (minus sign), PolyXarc will  count  backwards 
  461.         from the end of the file. 
  462.  
  463.         Signature  is the text of the signature. The signature  parameter 
  464.         must be 5 characters or less.
  465.  
  466.         Overwrite is the parameter this particular archive program  needs 
  467.         in   order  to  automatically  overwrite  existing  files   while 
  468.         extracting. The overwrite parameter must be 5 characters or less.
  469.  
  470.         Extract is the parameter this particular archive program needs in 
  471.         order to extract files. This is only used for programs which  use 
  472.         different  commmands for 'extract' and 'extract  overwrite'.  The 
  473.         extract parameter must be 5 characters or less.
  474.  
  475.         In  most cases you will not need the extract parameter.  However, 
  476.         there  must  be something defined for each field, whether  it  is 
  477.         used or not. In my distributed configuration file I simply put in 
  478.         an empty string ("") as a place holder.
  479.  
  480.         The command template defines the command line (including the name 
  481.         of the arc file) used to invoke the necessary de-archiver.
  482.  
  483.  
  484.  
  485.  
  486.  
  487.  
  488.  
  489.            PolyXarc 2.1: multiple-format archive extractor executive
  490.                                                                 page 9
  491.  
  492.  
  493.         Here are some examples from the distributed configuration file:
  494.  
  495.            SIGNATURE  -3   DWC      w   ""    dwc e%2 %3 %4
  496.            SIGNATURE   2  -lh     /mc   ""    lharc e %2 %3 %4
  497.            SIGNATURE   0   ZOO      O   ""    zoo x%2 %3 %4
  498.            SIGNATURE   0   PK      -o   ""    pkunzip %2 %3 %4
  499.            SIGNATURE   0   PK     /WA  /WO    pak /e /z %1%2 %3 %4
  500.            SIGNATURE   0 <60EA>    -y   ""    arj e %2 %3 %4
  501.  
  502.         An expanded Zoo command line would look like this, first without, 
  503.         then with overwrite:
  504.  
  505.           zoo x 0000FFFB.MO2 
  506.           zoo xO 0000FFFB.MO2 
  507.  
  508.         The NOSORT keyword syntax is:
  509.  
  510.           NOSORT
  511.  
  512.         If specified, NOSORT causes PolyXarc not to attempt to sort  .ARC 
  513.         format  files.  (Notice that PolyXarc will not  attempt  to  sort 
  514.         version  6  archive files in any case. That is because  only  one 
  515.         obsolete  version  5 program, PKARC/PKPAK,  sorts  alphabetically 
  516.         when  adding to an archive, and because some extended  version  6 
  517.         headers are position dependent.) This is almost identical to  the 
  518.         -N switch on the command line. If neither is specified,  PolyXarc 
  519.         will  attempt to sort the files in .ARC format archives  by  date 
  520.         and  time in order to keep mail packets in  chronological  order. 
  521.         This is in case the sender used PKPAK or PKARC to pack his  mail; 
  522.         they  will  sort the files in the archive  alphabetically,  which 
  523.         occasionally causes messages to get out of order. Note that while 
  524.         the  -F  switch will override the -N switch, the  NOSORT  keyword 
  525.         overrides the -F switch, causing PolyXarc never to sort.
  526.  
  527.         PolyXarc  allows some special character sequences in  the  config 
  528.         file.  The  two  main  sequences are:  quoted  strings,  and  hex 
  529.         numbers.  These are a lot easier to use than to explain,  but  if 
  530.         you  want  to skip ahead there is a summary at the  end  of  this 
  531.         explanation.
  532.  
  533.         Normally  PolyXarc  just treats a character as a  character.  For 
  534.         example, this line:
  535.  
  536.            SIGNATURE   0   PK     /WA  /WO    pak /e /z %1%2 %3 %4
  537.  
  538.         is interpreted exactly as you would think. One or more spaces  or 
  539.         tabs  separate each parameter on the line. Since the template  is 
  540.         the  last parameter on the line, we always know where it  starts, 
  541.         and  everything  after that is part of the template,  so  we  can 
  542.         imbed spaces into the template with impunity. However, there  are 
  543.         times  when you may need to imbed spaces into a  parameter  other 
  544.         than the template. In that case you must enclose the parameter in 
  545.         quotes. For example, if you had a signature with a space: 
  546.  
  547.            NEW 1 
  548.  
  549.  
  550.            PolyXarc 2.1: multiple-format archive extractor executive
  551.                                                                 page 10
  552.  
  553.  
  554.  
  555.         You  would  have  to put quotes around it  in  the  config  file, 
  556.         something like this:
  557.  
  558.            SIGNATURE   0   "NEW 1"  -o  -e  NEW %1%2 %3 %4
  559.  
  560.         This  also  allows you to include an empty string in  the  config 
  561.         file. For example:
  562.  
  563.            SIGNATURE   0   PK      -o   ""    pkunzip %2 %3 %4
  564.  
  565.         Notice  that  instead of an extraction parameter, there  are  two 
  566.         double-quotes.  PolyXarc  sees  the quotes and  knows  there's  a 
  567.         parameter there, but since there's nothing between them, PolyXarc 
  568.         will store an empty string. That way if you accidentally  include 
  569.         that parameter in the template, nothing will happen; and even  if 
  570.         you don't, the parameter will not take up any room in memory.
  571.  
  572.         Note  that you don't have to put the whole string in quotes.  For 
  573.         example,  you can put "NEW 1" as NEW" 1"; once PolyXarc sees  the 
  574.         first  quote, it will continue ignoring spaces until it sees  the 
  575.         second  quote. Also note that you MUST have a closing  quote,  or 
  576.         PolyXarc will keep going until the end of the line, and the  rest 
  577.         of the parameters on that line will be lost.
  578.  
  579.         Besides  using  quotes,  you  can also imbed  hex  numbers  in  a 
  580.         parameter  instead  of  just  using  printable  characters.   For 
  581.         example:
  582.  
  583.            SIGNATURE   0 <60EA>    -y   ""    arj e %2 %3 %4
  584.  
  585.         This program's signature consists of two characters, one of  them 
  586.         unprintable, at the beginning of the file. Instead of making  you 
  587.         try  to imbed the second character directly into the config  file 
  588.         with  a fancy editor, I've allowed you to describe the  character 
  589.         by  giving its ASCII value in hexadecimal. When PolyXarc  sees  a 
  590.         less-than  character  (<),  it  goes into  Hex  mode  and  starts 
  591.         interpreting  the following characters as hex numbers,  until  it 
  592.         sees a greater-than character (>) or reaches the end of the line. 
  593.         Notice  that  this is like the quote feature, in that  you  don't 
  594.         have to make the entire parameter hex if you have some  printable 
  595.         characters. In the example above, the first character is actually 
  596.         printable; you could define it like this instead:
  597.  
  598.            SIGNATURE   0  `<EA>    -y   ""    arj e %2 %3 %4
  599.  
  600.         Now  there  are a few more rules for hex digits.  First  of  all, 
  601.         PolyXarc  expects that the hex digits will be in pairs. One  pair 
  602.         of digits describes a character. You can define an odd number  of 
  603.         digits, but you may not get the results you expect. For  example, 
  604.         <615>  is  not the same as <0615> or <6150>; it is  the  same  as 
  605.         <6105>. Your best bet is to use character pairs, or see the  next 
  606.         rule. 
  607.  
  608.  
  609.  
  610.  
  611.            PolyXarc 2.1: multiple-format archive extractor executive
  612.                                                                 page 11
  613.  
  614.  
  615.         Another  rule  is that anything that isn't a (>) or a  hex  digit 
  616.         will  break a character description, assume that  it's  finished, 
  617.         and start on the next character. For example, <6 15> is the  same 
  618.         as  <0615>  is the same as <06 15> is the same as  <  6,15>.  The 
  619.         spaces and commas act as separators. This provides a handy visual 
  620.         breakup.
  621.  
  622.         Now,  it is possible that you will want to have the characters  " 
  623.         or  < in one of your signatures. To accomodate that I  added  the 
  624.         "literal"  character, which is a backslash (\). When  encountered 
  625.         in normal mode or inside a quote, the backslash tells PolyXarc to 
  626.         take  the  next character literally. This way you can  imbed  the 
  627.         quote or less-than characters without having to go into hex  mode 
  628.         and  describe  them  in hex. If you want to  imbed  a  backslash, 
  629.         simply  include two backslashes: \\. PolyXarc will see the  first 
  630.         one as a directive ("take the next character literally") and then 
  631.         take the second one as a character.
  632.  
  633.         Limitations:  You cannot change modes between hex and quoting  in 
  634.         the  middle  of  a quote or hex sequence. If you  are  in  a  hex 
  635.         sequence  and  want to start a quote you must first end  the  hex 
  636.         sequence.  If  you are in a quote string you cannot imbed  a  hex 
  637.         sequence; you must end the quote. A '<' in the middle of a  quote 
  638.         is treated as a normal character. For example:
  639.  
  640.           <4142>  converts to "AB"
  641.           <41>B   converts to "AB"
  642.           A<42>   converts to "AB"
  643.           "A"<42> converts to "AB"
  644.           <41>"B" converts to "AB"
  645.           "A<41>" converts to "A<41>"
  646.           <41"B"> converts to "A." (where . is actually an unprintable
  647.                                     character with a numeric value of 0B)
  648.  
  649.         Here is a summary of the rules:
  650.  
  651.          - A whitespace character is a space or tab.
  652.          - Normally, each non-whitespace character is simply treated as a 
  653.            character.
  654.          - If  you place double-quotes (") around a string or part  of  a 
  655.            string,  that  string  will  be  accepted  intact,   including 
  656.            whitespace.
  657.          - If  you imbed a backslash ('\'), the backslash will be  thrown 
  658.            away  and the next character will be accepted as a  character. 
  659.            This  allows you to imbed the double-quote (")  and  less-than 
  660.            (<)  characters as regular characters. To use a  backslash  as 
  661.            part  of a string you must imbed two backslashes ('\\');  this 
  662.            will translate to a single backslash.
  663.          - If  you place a less-than sign (<) in a string, the  following 
  664.            characters will be considered to be 2-digit hex numbers  until 
  665.            a greater-than sign (>) is reached. A hex digit is any numeric 
  666.            digit  (0-9) or any letter from A to F (a-f or A-F).  Normally 
  667.            the  hex  digits  will be taken in pairs,  but  if  any  other 
  668.            character  is imbedded, it will be considered to be  a  number 
  669.            break and the next digit will start the next number.
  670.  
  671.  
  672.            PolyXarc 2.1: multiple-format archive extractor executive
  673.                                                                 page 12
  674.  
  675.  
  676.  
  677.         TECHNICAL SECTION
  678.         =================
  679.         PolyXarc  figures  out what format is being used by  looking  for 
  680.         certain  characteristics  in the file. For  example,  each  PKZIP 
  681.         format file has "PK" as the first two bytes in the file. All .ARC 
  682.         format files have a hex 1A value as the first byte. The SIGNATURE 
  683.         lines in the configuration file describe what to look for,  where 
  684.         to look for it, and what command syntax to use if PolyXarc  finds 
  685.         it.
  686.  
  687.          ...except for .ARC files. Over the years .ARC files have added a 
  688.         number  of  different formats. Each time one is  added,  it  gets 
  689.         assigned  a  level. The standard programs (ARC, ARCA,  and  ARCE) 
  690.         support up to level 8. PKPAK added level 9, and PAK added  levels 
  691.         10  and 11. Due to program size and other considerations,  people 
  692.         often  prefer  to use the minimum program required for  the  job. 
  693.         Also, some archive extractors are faster than others. Either way, 
  694.         the  ARC  lines in the configuration file describe what  to  look 
  695.         for,  and what command syntax to use if PolyXarc finds  it.  Each 
  696.         ARC  line  has a level number. That number is the  highest  level 
  697.         that  program  will support, not just the only  number.  PolyXarc 
  698.         always  uses the minimum specified program for the highest  level 
  699.         found in the archive.
  700.  
  701.         The  exceptions, as explained before, are ARC6 programs.  Because 
  702.         they  support an extended set of ARC formats, their archives  are 
  703.         readily   identifiable  and  are  incompatible  with  version   5 
  704.         archives. If you have both an ARC5 and an ARC6 program supporting 
  705.         a compression level, the ARC5 program will always be used for  an 
  706.         ARC5  file using that level. An ARC6 program will always be  used 
  707.         to extract an ARC6 file.
  708.  
  709.         EXAMPLES
  710.         ========
  711.         I have my incoming and outgoing mail on two different drives.  To 
  712.         optimize  space  usage  on my outgoing  drive,  I  have  PolyXarc 
  713.         extract  the  archives into the incoming directory before  I  let 
  714.         QMail loose on them. Therefore my batch file looks something like 
  715.         this:
  716.  
  717.            C:
  718.            CD \NET\FILE
  719.            PolyXarc -F -M273/715
  720.            E:
  721.            QM TOSS etc.
  722.  
  723.         If you want to run PolyXarc directly from Opus 1.0 on a  barefoot 
  724.         Opus  system,  simply  rename POLYXARC.EXE to  ARCE.EXE.  If  you 
  725.         already  have the real ARCE someplace on your system,  make  sure 
  726.         that  the  renamed  PolyXarc is either earlier in  the  path,  or 
  727.         replaces  ARCE, or is in the directory you are running  it  from. 
  728.         Otherwise,  it  will quite likely find the original  ARCE  first. 
  729.         Remember  also,  if you have ARCE.COM and ARCE.EXE  in  the  same 
  730.         directory, DOS will always run ARCE.COM. Also remember to  either 
  731.  
  732.  
  733.            PolyXarc 2.1: multiple-format archive extractor executive
  734.                                                                 page 13
  735.  
  736.  
  737.         remove the ARCE control line from PolyXarc's configuration  file, 
  738.         or  else  specify  ARCE's path in  the  control  line;  otherwise 
  739.         PolyXarc will end up trying to execute itself and you will end up 
  740.         with what is known in the business as 'a mess'.
  741.  
  742.         To use PolyXarc from Confmail, add the -A parameter to the end of 
  743.         Confmail's command line:
  744.  
  745.            Confmail import blah blah blah -A PolyXarc -o -m273/715
  746.  
  747.         RETURN CODES &c.
  748.         ================
  749.            0 = No error.
  750.            1 = Can't open/read source (missing or invalid file).
  751.            2 = Can't create/write dest (maybe disk or directory full).
  752.            3 = Can't delete old source file (read-only).
  753.            4 = Can't rename temp file to source name.
  754.            5 = Out of memory.
  755.            6 = Cannot determine archive type.
  756.            7 = Configuration file syntax error.
  757.            8 = Error was returned from the archive extractor.
  758.            9 = File was zero-length.
  759.           10 = DOS error while trying to execute the extractor.
  760.  
  761.         Note that if you use the -f switch, not all of these errors  will 
  762.         be returned. In the case of a zero-length file, PolyXarc -f  will 
  763.         simply give a warning message, delete the file, and go on. In the 
  764.         cases  of  errors 3, 6 and 8, PolyXarc will rename  the  file  to 
  765.         BAD_ARC.???  (where ??? is an ascending decimal  number  starting 
  766.         from 000) and go on.
  767.  
  768.         CAVEATS
  769.         =======
  770.         If  a  file has been transferred via XMODEM, the last  record  of 
  771.         that  file  will  be  padded with nulls.  In  the  case  of  DWC-
  772.         compressed files, this can be a problem. Since PolyXarc looks for 
  773.         "DWC"  at  the  end  of the file, the  null  padding  will  cause 
  774.         PolyXarc  not to recognize a DWC file. I could add enough  smarts 
  775.         into  PolyXarc  to have it search backwards  through  the  nulls. 
  776.         However,  DWC  is not used by many sysops, and  there  are  other 
  777.         archivers that work just as well, so it doesn't seem  worthwhile. 
  778.         This  is a potential problem for any archiver whose signature  is 
  779.         at the end of the file, though at the moment I don't know of  any 
  780.         besides DWC.
  781.  
  782.         ACKNOWLEDGEMENTS
  783.         ================
  784.         Thanks to Mike Housky for the entire .ARC format  search-and-sort 
  785.         section.  I  shamelessly  stole it straight out  of  his  PAKSORT 
  786.         program.  Thanks  also  to Dan Thomson for  coming  up  with  the 
  787.         original  program,  SPAZ,  and saving me a lot  of  research  and 
  788.         planning. (There is probably no easier program to design than one 
  789.         for which you have a working model!)
  790.  
  791.  
  792.  
  793.  
  794.            PolyXarc 2.1: multiple-format archive extractor executive
  795.                                                                 page 14
  796.  
  797.  
  798.         Many  thanks  to John Lull and Clay Tinsley, two of  my  original 
  799.         beta  testers. They faithfully ran every revision I put  out  and 
  800.         let  me  know whenever something went wrong. (Which  was  often.) 
  801.         Clay  was also responsible for convincing me to  write  PolyXarc. 
  802.         David   Page,  another  beta  tester,  also  gave  some   helpful 
  803.         criticism.
  804.  
  805.         Thanks  to  Steve Palm, who ported PolyXarc over to  use  on  his 
  806.         Amiga, and Bill Andrus, who ported PolyXarc over to OS/2. Between 
  807.         us  we  came up with a set of source files and  definitions  that 
  808.         allow  us  to  compile  the  same  source  under  our  respective 
  809.         operating systems.
  810.  
  811.         Thanks to Peter Stern for helping track down some subtle bugs  in 
  812.         version  2.0.
  813.  
  814.         Thanks in no particular order to Thom Henderson, Phil Katz, Rahul 
  815.         Dhesi,  David W. Cooper, Nogate Consulting,  Haruyasu  Yoshizaki, 
  816.         Vernon  Buerg,  Wayne  Chin, Robert K. Jung, and  all  the  other 
  817.         archive  program  authors for all their hard work.  Keep  it  up, 
  818.         guys!
  819.  
  820.         And as always, thanks to Ward Christensen for everything. 
  821.  
  822.                         Jeffrey J. Nonken
  823.                         1706 Cherrie Circle
  824.                         Blue Bell, Pa.   19422-3412
  825.                         BBS: (215)279-9799 HST/v.32
  826.                         Fidonet: 1:273/715
  827.                         Internet: Jeffrey.Nonken@f715.n273.z1.fidonet.org
  828.  
  829.         Note: the above Snailmail address and phone number may change  in 
  830.         the  next few months. Please use my Fidonet or Internet  address, 
  831.         or check the latest Nodelist for the current information.
  832.  
  833.  
  834.  
  835.  
  836.  
  837.  
  838.  
  839.  
  840.  
  841.  
  842.  
  843.  
  844.  
  845.  
  846.  
  847.  
  848.  
  849.  
  850.  
  851.  
  852.  
  853.  
  854.  
  855.            PolyXarc 2.1: multiple-format archive extractor executive
  856.