home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d0xx / d050 / unixarc.lha / UnixArc / xarc.c < prev   
Encoding:
C/C++ Source or Header  |  1987-01-17  |  3.1 KB  |  83 lines

  1. #define MAIN
  2. /*  XARC - Archive extraction utility
  3.  
  4. (C) COPYRIGHT 1985 by System Enhancement Associates; ALL RIGHTS RESERVED
  5.  
  6.     By:  Thom Henderson
  7.  
  8.     Description:
  9.          This program is used to extract files from archives which were
  10.          created using the ARC general archive maintenance program.
  11.          Please refer to the ARC source for a description of archives
  12.          and archive formats.
  13.  
  14.     Instructions:
  15.          Run this program with no arguments for complete instructions.
  16.  
  17.     Programming notes:
  18.          This is essentially a stripped down version of ARC, including only
  19.          those routines required to extract files.
  20.  
  21.     Language:
  22.          Computer Innovations Optimizing C86
  23. */
  24. #include <stdio.h>
  25. #include "arc.h"
  26.  
  27. main(num,arg)                          /* system entry point */
  28. int num;                               /* number of arguments */
  29. char *arg[];                           /* pointers to arguments */
  30. {
  31.     char *makefnam();                  /* filename fixup routine */
  32.     char buf[STRLEN];                 /* fixed filename storage */
  33.     char *d, *dir();                   /* file directory stuff */
  34.     int nomatch;                       /* true when no matching archive */
  35.     int n;                             /* argument index */
  36.  
  37.     if(num<2)
  38.     {    printf("XARC - Archive extractor, %s\n",VERSION);
  39.          printf("(C) COPYRIGHT 1985 by System Enhancement Associates;");
  40.          printf(" ALL RIGHTS RESERVED\n\n");
  41. #if 0
  42.          printf("Please refer all inquiries to:\n\n");
  43.          printf("  System Enhancement Associates\n");
  44.          printf("  21 New Street, Wayne NJ 07470\n\n");
  45.          printf("You may copy and distribute this program freely,");
  46.          printf(" provided that:\n");
  47.          printf("    1)   No fee is charged for such copying and");
  48.          printf(" distribution, and\n");
  49.          printf("    2)   It is distributed ONLY in its original,");
  50.          printf(" unmodified state.\n\n");
  51.          printf("If you like this program, and find it of use, then your");
  52.          printf(" contribution will\n");
  53.          printf("be appreciated.  If you are using this product in a");
  54.          printf(" commercial environment,\n");
  55.          printf("then the contribution is not voluntary.\n\n");
  56.          printf("If you fail to abide by the terms of this license, then");
  57.          printf(" your conscience\n");
  58.          printf("will haunt you for the rest of your life.\n\n");
  59. #endif
  60.          printf("Usage: XARC <arcname> [<arcname>. . .]\n\n");
  61.          printf("Where <arcname> is the name of an archive.");
  62.          printf("  If no filename extension is\n");
  63.          printf("supplied, then .ARC is assumed.\n");
  64.          return 1;
  65.     }
  66.  
  67.     for(n=1; n<num; n++)               /* for each argument */
  68.     {    makefnam(arg[n],".ARC",buf);
  69.          nomatch = 1;
  70.          for(d=dir(buf,0); *d; d=dir(NULL,0))
  71.          {    makefnam(d,buf,arcname);
  72.               printf("Archive: %s\n",arcname);
  73.               extarc();           /* extract all files */
  74.               free(d);
  75.               nomatch = 0;
  76.          }
  77.          if(nomatch)
  78.               printf("No such archive: %s\n",buf);
  79.     }
  80.  
  81.     return nerrs;
  82. }
  83.