home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 2 BBS / 02-BBS.zip / VP2SRC.ZIP / ARC_E.C < prev    next >
Text File  |  1991-04-24  |  21KB  |  659 lines

  1. /*
  2.   $Header: arc_e.c 3.3 87/12/12 00:39:56 Bob Exp $
  3.  
  4.                           The Conference Mail System
  5.  
  6.               This module was originally written by Bob Hartman
  7.                        Sysop of FidoNet node 1:132/101
  8.  
  9.    Spark Software, 427-3 Amherst St, CS 2032, Suite 232, Nashua, NH 03061
  10.  
  11.  The Conference Mail System  is a  complete Echomail processing package.  It
  12.  is a superset of the original  Echomail utilities created by Jeff Rush, and
  13.  also contains ideas gleaned from the  ARCmail,  Renum,  oMMM, MGM, and Opus
  14.  programs that were created by various software authors.
  15.  
  16.  This program source code is being released with the following provisions:
  17.  
  18.  1.  You are  free to make  changes to this source  code for use on your own
  19.  machine,  however,  altered source files may not be distributed without the
  20.  consent of Spark Software.
  21.  
  22.  2.  You may distribute "patches"  or  "diff" files for any changes that you
  23.  have made, provided that the "patch" or "diff" files are also sent to Spark
  24.  Software for inclusion in future releases of the entire package.   A "diff"
  25.  file for the source archives may also contain a compiled version,  provided
  26.  it is  clearly marked as not  being created  from the original source code.
  27.  No other  executable  versions may be  distributed without  the  consent of
  28.  Spark Software.
  29.  
  30.  3.  You are free to include portions of this source code in any program you
  31.  develop, providing:  a) Credit is given to Spark Software for any code that
  32.  may is used, and  b) The resulting program is free to anyone wanting to use
  33.  it, including commercial and government users.
  34.  
  35.  4.  There is  NO  technical support  available for dealing with this source
  36.  code, or the accompanying executable files.  This source  code  is provided
  37.  as is, with no warranty expressed or implied (I hate legalease).   In other
  38.  words, if you don't know what to do with it,  don't use it,  and if you are
  39.  brave enough to use it, you're on your own.
  40.  
  41.  Spark Software may be contacted by modem at (603) 888-8179 (node 1:132/101)
  42.  on the public FidoNet network, or at the address given above.
  43.  
  44.  To use this code you will need Microsoft C version 4.0, and also Microsoft
  45.  Macro Assembler version 4.0.
  46.  
  47. */
  48.  
  49. /*
  50.    $Log:    arc_e.c $
  51.  * Revision 3.3  87/12/12  00:39:56  Bob
  52.  * Source code release
  53.  *
  54. */
  55.  
  56. #include <stdio.h>
  57. #include <dos.h>
  58. #include <ctype.h>
  59. #include <fcntl.h>
  60. #include <io.h>
  61. #include <time.h>
  62. #include <string.h>
  63. #include <malloc.h>
  64. #include <stdlib.h>
  65. #include <process.h>
  66. #include <sys\types.h>
  67. #include <sys\stat.h>
  68. #include "fastecho.h"
  69.  
  70. #define DEBUG 0
  71.  
  72. static char *asuffix[] =
  73.     { "SU?", "MO?", "TU?", "WE?", "TH?", "FR?", "SA?", NULL };
  74. extern SEACONFIG config;
  75. extern AREAS_PTR areas[];
  76. extern char board_name[], sysop_name[];
  77. extern int tot_areas;
  78. extern char bbsfile[];
  79. extern char *arc_cmd[];
  80. extern int nread;
  81. extern int arc_args;
  82. extern int last_msg;
  83. extern int high_one;
  84. extern int convert;
  85. extern int dup_size;
  86. extern struct tm *t2;
  87. extern struct _stamp cur_stamp;
  88. extern int pass_thru;
  89. extern int route_thru;
  90. extern int toss_net, toss_node;
  91. extern int num_pw;
  92. extern PW_PTR pw[];
  93. extern int got_a;
  94. extern int kill_null;
  95. int bad_pkt = 0;
  96. int bad_pw = 0;
  97. extern int bad_msgs;
  98. extern int msgs_tossed;
  99. extern WBUFFER wbuffs[];
  100. extern KILLPTR killer;
  101. extern long secs_from_1980();
  102. extern int last_toss_area;
  103. extern int dup_msgs;
  104. extern int dup_file;
  105. extern char dup_name[];
  106.  
  107. int arcmail ()
  108. {
  109.     int i, j, k, l, done;
  110.     char archive[80];
  111.     char arcname[64];
  112.     char cmd[80];
  113.     char tnet[5];
  114.     char tnode[5];
  115.  
  116.     for (i = 0; asuffix[i]; i++)
  117.         {
  118.         sprintf (archive, "%s\\*.%s", config.filepath, asuffix[i]);
  119.         j = 0;
  120.         (void) filedir (archive, j, arcname, 0);
  121.         done = 0;
  122.         while (arcname[0] != '\0')
  123.             {
  124. #if DEBUG
  125.             printf ("Got filename '%s' for j = %d\n", arcname, j);
  126. #endif
  127.             for (k = 0; k < 8; k++)
  128.                 {
  129.                 if (isdigit (arcname[k]) ||
  130.                      ((arcname[k] >= 'A') && (arcname[k] <= 'F')))
  131.                     {
  132.                     continue;
  133.                     }
  134.                 else
  135.                     {
  136.                     done = 1;
  137.                     break;
  138.                     }
  139.                 }
  140.             if ((done) || ((i != 7) && (!isalnum(arcname[strlen(arcname)-1]))))
  141.                 {
  142. #if DEBUG
  143.                 printf ("Not an arcmail style packet\n");
  144. #endif
  145.                 done = 0;
  146.                 ++j;
  147.                 }
  148.             else
  149.                 {
  150.                 sprintf (cmd, "%s\\%s", config.filepath, arcname);
  151. /*          sscanf (arcname, "%04x%04x.", &toss_net, &toss_node); */
  152.             sscanf (arcname, "%4s%4s.", tnet, tnode);
  153.             sscanf (tnet, "%04x", &toss_net);
  154.             sscanf (tnode, "%04x", &toss_node);
  155.             toss_net += config.net[1];
  156.             toss_node += config.node[1];
  157.                 printf ("Unpacking packet '%s' from %d/%d\n", cmd, toss_net, toss_node);
  158.                 strcpy (arc_cmd[arc_args], cmd);
  159.                 if (spawnvp (P_WAIT, arc_cmd[0], arc_cmd))
  160.                     {
  161.                     printf ("\nError while attempting to unARC '%s'\n", cmd);
  162.                     printf ("If packets were unARC'd, then '%s' will be deleted\n", cmd);
  163.                     printf ("otherwise it will be left intact for future processing\n");
  164.                     }
  165.                 if (tosspkt ("."))
  166.                     {
  167.                     printf ("\nNo ARCmail packets from '%s' - ARCHIVE NOT REMOVED!\n", cmd);
  168.                     ++j;
  169.                     }
  170.                 else
  171.                     {
  172.                     printf ("\nTossing successful - deleting ARCmail packet '%s'\n", cmd);
  173.                     unlink (cmd);
  174.                     }
  175.                 for (l = 0; l < j; l++)
  176.                     {
  177.                     (void) filedir (archive, l, arcname, 0);
  178.                     }
  179.                 }
  180.             (void) filedir (archive, j, arcname, 0);
  181.             }
  182.         }
  183.     return (0);
  184.     }
  185.  
  186. void netit (
  187.    MSG_PTR header,
  188.    char   *holder,
  189.    int     body_count,
  190.    char   *netpath,
  191.    int    *high_one)
  192. {
  193.     int f, j;
  194.     char junk[80];
  195.  
  196. #if DEBUG
  197.     printf ("in netit() with body_count = %d\n", body_count);
  198. #endif
  199.  
  200.    /* Determine if it is to us */
  201.    for (j = 1; j <= config.num_addrs; j++)
  202.         {
  203.         if (  (config.net[j] == header->dest_net)
  204.              &&(config.node[j] == header->dest   ))
  205.             {
  206.             /* It matches one of our addresses! */
  207.             break;
  208.         }
  209.         }
  210.     if (j > config.num_addrs)
  211.         {
  212. #if DEBUG
  213.         printf ("Putting in MSGFWD bit\n");
  214. #endif
  215.       header->attr |= MSGFWD;
  216.         }
  217.  
  218.     ++(*high_one);
  219.     sprintf (junk, "%s\\%d.MSG", netpath, *high_one);
  220. #if DEBUG
  221.     printf ("attempting to open '%s'\n", junk);
  222. #endif
  223.  
  224.     if ((f = open (junk, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY, S_IREAD|S_IWRITE)) == -1)
  225.         {
  226.         printf ("Cannot open file '%s' for message.  Message lost\n", junk);
  227.         return;
  228.         }
  229. #if DEBUG
  230.     printf ("attempting to write header\n");
  231. #endif
  232.     if (write_header (f, header) != sizeof (MSG))
  233.         {
  234.         printf ("Could not write to file '%s'.  Message lost\n", junk);
  235.         (void) fast_close (f);
  236.         return;
  237.         }
  238. #if DEBUG
  239.     printf ("attempting to write body\n");
  240. #endif
  241.     if (fast_write (f, holder, body_count) != body_count)
  242.         {
  243.         printf ("Could not write to file '%s'.  Message lost\n", junk);
  244.         (void) fast_close (f);
  245.         return;
  246.         }
  247. #if DEBUG
  248.     printf ("returning from netit\n");
  249. #endif
  250.     (void) fast_close (f);
  251.    ++msgs_tossed;
  252.     return;
  253.     }
  254.  
  255. int unpackpkt (char *pktname)
  256. {
  257.     int i, j, foo, foo1, foo2, foo3, v;
  258.     int body_count;
  259.     char *q1;
  260.     char *holder;
  261.     char *holder1;
  262.     static char header[sizeof(MSG)+10000];
  263.     MSG_PTR h;
  264.     int f, err;
  265.     PKTHDR p;
  266.     PACKED p1;
  267.     extern last_loc;
  268.  
  269.     /* Read in the Packet header */
  270.     if ((f = open (pktname, O_RDONLY|O_BINARY)) == -1)
  271.         {
  272.         printf ("Could not open packet '%s'\n", pktname);
  273.         return (1);
  274.         }
  275. #if DEBUG
  276.    printf ("Got Packet opened\n");
  277. #endif
  278.    if (wbuffs[f].wbuff == NULL)
  279.       {
  280.       wbuffs[f].wbuff = wbuffs[f].wptr = _fmalloc (BIGSIZE);
  281.       if (wbuffs[f].wbuff != NULL)
  282.          wbuffs[f].wsize = 0;
  283.       }
  284. #if DEBUG
  285.    printf ("Got buffer\n");                         /*DEBUG*/
  286. #endif
  287.  
  288.     if (fast_read (f, (char *) &p, sizeof (PKTHDR)) != sizeof (PKTHDR))
  289.         {
  290.       _ffree (wbuffs[f].wbuff);
  291.       wbuffs[f].wbuff = wbuffs[f].wptr = NULL;
  292.       wbuffs[f].wsize = -1;
  293.         (void) fast_close (f);
  294.         printf ("Packet '%s' was a short packet\n", pktname);
  295.         return (0);
  296.         }
  297. #if DEBUG
  298.    printf ("Got full header\n");                         /*DEBUG*/
  299. #endif
  300.    /* Make sure it is addressed to us */
  301.    for (i = 1; i <= config.num_addrs; i++)
  302.       {
  303.       if ((p.dest_net == config.net[i]) && (p.dest_node == config.node[i]))
  304.          break;
  305.       }
  306.  
  307.    /*AK*/
  308.    if (toss_net == 0 && toss_node == 0)
  309.    {
  310.        toss_net  = p.orig_net;
  311.        toss_node = p.orig_node;
  312.    }
  313.  
  314.    else if (toss_net != p.orig_net || toss_node != p.orig_node)
  315.    {
  316.        (void) fast_close (f);
  317.        printf ("Packet '%s' origin differs from arcmail origin.  Packet ignored\n", pktname);
  318.        return (0);
  319.    }
  320.  
  321.    /* It was to us */
  322.    if (i <= config.num_addrs)
  323.    {
  324. #if DEBUG
  325.    printf ("Its addressed to us\n");                         /*DEBUG*/
  326. #endif
  327.       for (i = 0; i < num_pw; i++)
  328.       {
  329.          /* Find out if we have a password for this guy */
  330.          if ((pw[i]->net == p.orig_net) && (pw[i]->node == p.orig_node))
  331.          {
  332.             /* We do, so uppercase it */
  333.             for (j = 0; j < 8; j++)
  334.             {
  335.                p.password[j] = (char) toupper (p.password[j]);
  336.             }
  337.             /* Do they match? */
  338.             if (strcmp (p.password, pw[i]->password))
  339.             {
  340.                /* No match!  Bad news */
  341.                printf ("Packet '%s' does not have proper password for node %d/%d\n",
  342.                   pktname, p.orig_net, p.orig_node);
  343.                _ffree (wbuffs[f].wbuff);
  344.                wbuffs[f].wbuff = wbuffs[f].wptr = NULL;
  345.                wbuffs[f].wsize = -1;
  346.                (void) fast_close (f);
  347.                bad_pw = 1;
  348.                return (1);
  349.             }
  350.          }
  351.       }
  352.    }
  353. #if DEBUG
  354.    printf ("Passed PW check    \n");                         /*DEBUG*/
  355. #endif
  356.    last_toss_area = -1;
  357.    dup_msgs = 0;
  358.    holder1 = malloc ((unsigned) (NUMBLOCKS*1024 + sizeof (MSG)));
  359.    if (holder1 == NULL)
  360.         {
  361.         (void) fast_close (f);
  362.         printf ("Could not malloc() message space, aborting\n");
  363.         exit (2);
  364.         }
  365. #if DEBUG
  366.    printf ("Passed msg space   \n");                         /*DEBUG*/
  367. #endif
  368.     killer = (KILLPTR) calloc (dup_size, sizeof(KILL));
  369.    if (killer == NULL)
  370.       {
  371.       v = _freect (50*sizeof (KILL));
  372.       printf ("Not enough memory to kill dups based on last %d messages\n", dup_size);
  373.       printf ("Try using '-D %d' on the command line - exiting\n", v*50);
  374.       exit (2);
  375.       }
  376.  
  377.     holder = holder1+sizeof(MSG);
  378.     h = (MSG_PTR) header;
  379.  
  380.     /* while version != 0 */
  381.     if (fast_read (f, (char *) &p1, 2) != 2)
  382.         {
  383.         p1.ver = 0;
  384.         printf ("Packet '%s' was a short packet\n", pktname);
  385.         }
  386.  
  387.     i = 0;
  388.     while (p1.ver == PKTVER)
  389.        {
  390.        ++i;
  391.        if (fast_read (f, (char *) &(p1.orig_node), sizeof (PACKED) - 2) != sizeof (PACKED) -2)
  392.           {
  393.           printf ("Packet '%s' was a short packet\n", pktname);
  394.           break;
  395.           }
  396.       /* Fill in the message structure and read in message */
  397.       memset ((char *) h, 0, sizeof (MSG));
  398.       if (get_to_null (f, h->date, &foo)
  399.           || get_to_null (f, h->to, &foo1)
  400.           || get_to_null (f, h->from, &foo2)
  401.           || get_to_null (f, h->subj, &foo3)
  402.           || get_to_null (f, holder, &body_count))
  403.          {
  404.          printf ("Packet '%s' was a short packet\n", pktname);
  405.          break;
  406.          }
  407.       if ((foo > 20) || (foo1 > 36) || (foo2 > 36) || (foo3 > 72))
  408.          {
  409.          printf ("Packet '%s' contains invalid data - aborting packet\n", pktname);
  410.          break;
  411.          }
  412. #if DEBUG
  413.    printf ("Passed hdr check   \n");                         /*DEBUG*/
  414. #endif
  415.  
  416.         /* Fill in the rest of the message header */
  417.         do_date (h);
  418. #if DEBUG
  419.    printf ("Passed do_date (h) \n");                         /*DEBUG*/
  420. #endif
  421.         h->times = 0;
  422.         h->dest = p1.dest_node;
  423.         h->orig = p1.orig_node;
  424.         h->cost = p1.cost;
  425.         h->orig_net = p1.orig_net;
  426.         h->dest_net = p1.dest_net;
  427.         h->reply = 0;
  428.         h->attr = p1.attr&(int)NO_CLEAR;
  429.         h->up = 0;
  430. #if DEBUG
  431.    printf ("Header filled in   \n");                         /*DEBUG*/
  432. #endif
  433.  
  434.         /* See if we should toss it */
  435.       got_a = 0;
  436.  
  437.         q1 = holder;
  438.         if (*q1 == 1)
  439.             {
  440.             ++q1;
  441.             --body_count;
  442.          got_a = 1;
  443.             }
  444.         while ((isspace ((*q1)&0x7f)) || (*q1 == 1))
  445.             {
  446.             ++q1;
  447.             --body_count;
  448.             }
  449. #if DEBUG
  450.    printf ("Body contains %d bytes\n", body_count);                         /*DEBUG*/
  451. #endif
  452.  
  453.         /* Is it an AREA: file */
  454.       if ((body_count == 0) && (kill_null))
  455.          {
  456.          printf ("MAIL PKT %s:MSG %d -> NULL MSG - DELETED\n", pktname, i);
  457.          }
  458.         else if (strncmp (q1, "AREA:", 5) != 0)
  459.             {
  460. #if DEBUG
  461.             printf ("not echomail\n");
  462. #endif
  463.             /* Just write it into the netmail area */
  464.             printf ("MAIL PKT %s:MSG %d -=> MAIL:%d.MSG from %d/%d\n",
  465.             pktname, i, high_one+1, ((MSG *) h)->orig_net, ((MSG *) h)->orig);
  466.             netit (h, holder, body_count, config.mailpath, &high_one);
  467.             }
  468.         /* It is echomail, but is it to us? */
  469.         else
  470.             {
  471. #if DEBUG
  472.             printf ("It is echomail\n");
  473. #endif
  474.             for (j = 1; j <= config.num_addrs; j++)
  475.                 {
  476.                 if (  (config.net[j] == h->dest_net)
  477.                      &&(config.node[j] == h->dest   ))
  478.                     {
  479.                     /* It matches one of our addresses! */
  480. #if DEBUG
  481.                     printf ("It is addressed to us as %d/%d\n", h->dest_net, h->dest);
  482. #endif
  483.                     break;
  484.                     }
  485.                 }
  486.             if (j > config.num_addrs)
  487.                 {
  488. #if DEBUG
  489.             printf ("Not to us\n");
  490. #endif
  491.             if (route_thru < 0)
  492.                {
  493.                 /* Just write it into the netmail area */
  494.                 printf ("MAIL PKT %s:MSG %d -=> MAIL:%d.MSG\n", pktname, i, high_one+1);
  495.                 netit (h, holder, body_count, config.mailpath, &high_one);
  496.                 }
  497.             else
  498.                {
  499.                 /* Just write it into the routethru area */
  500.                 if (*(areas[route_thru]->msgs_in_area) == -1)
  501.                     {
  502.                     /* Need to get high message number here */
  503.                      /* First go to the proper directory */
  504.                     (void) high_msg (areas[route_thru]->msg_path,
  505.                      areas[route_thru]->msgs_in_area, &foo);
  506.                      printf ("Found %d messages in area %s\n",
  507.                         *(areas[route_thru]->msgs_in_area),
  508.                       areas[route_thru]->area_name);
  509.                   if (*areas[route_thru]->msgs_in_area == 0)
  510.                      *areas[route_thru]->msgs_in_area = 1;
  511.                     }
  512.  
  513.                 printf ("MAIL PKT %s:MSG %d -=> ROUTETHRU:%d.MSG\n", pktname,
  514.                   i, *(areas[route_thru]->msgs_in_area) + 1);
  515.                 netit (h, holder, body_count, areas[route_thru]->msg_path,
  516.                   areas[route_thru]->msgs_in_area);
  517.                }
  518.             }
  519.             else
  520.                 {
  521.                 /* Toss it properly */
  522. #if DEBUG
  523.                 printf ("Tossing it\n");
  524. #endif
  525.                 if ((err = tossit (pktname, header, q1, body_count-5, f, i, 5-sizeof(MSG), 1)) < 0)
  526.                     {
  527.                     printf (" in message %d in packet '%s'\n", i, pktname);
  528.                if (bad_msgs < 0)
  529.                   {
  530.                   if (err != -2)
  531.                      {
  532.                     /* Just write it into the netmail area */
  533.                         printf ("*** Message rerouted to netmail area as MAIL:%d.MSG ***\n", high_one+1);
  534.                         netit (h, holder, body_count, config.mailpath, &high_one);
  535.                      }
  536.                   else
  537.                      {
  538.                      printf ("*** Message skipped\n");
  539.                      }
  540.                    }
  541.                else
  542.                   {
  543.                 /* Just write it into the bad_msgs area */
  544.                     if (*(areas[bad_msgs]->msgs_in_area) == -1)
  545.                     {
  546.                     /* Need to get high message number here */
  547.                         /* First go to the proper directory */
  548.                         (void) high_msg (areas[bad_msgs]->msg_path,
  549.                         areas[bad_msgs]->msgs_in_area, &foo);
  550.                      printf ("Found %d messages in area %s\n",
  551.                             *(areas[bad_msgs]->msgs_in_area),
  552.                          areas[bad_msgs]->area_name);
  553.                      if (*areas[bad_msgs]->msgs_in_area == 0)
  554.                         *areas[bad_msgs]->msgs_in_area = 1;
  555.                        }
  556.  
  557.                 printf ("MAIL PKT %s:MSG %d -=> BAD_MSGS:%d.MSG\n", pktname,
  558.                      i, *(areas[bad_msgs]->msgs_in_area) + 1);
  559.                     netit (h, holder, body_count, areas[bad_msgs]->msg_path,
  560.                      areas[bad_msgs]->msgs_in_area);
  561.                   }
  562.                     }
  563.                 }
  564.             }
  565.         if (fast_read (f, (char *) &p1, 2) != 2)
  566.             {
  567.             printf ("Packet '%s' was a short packet\n", pktname);
  568.             break;
  569.             }
  570.         }
  571.  
  572.    if (last_toss_area >= 0)
  573.       {
  574.       /* Write out old killer data */
  575.       sprintf (dup_name, "%s\\CONFDUPS.DAT", areas[last_toss_area]->msg_path);
  576.       dup_file = open (dup_name, O_WRONLY|O_CREAT|O_BINARY, S_IREAD|S_IWRITE);
  577.       (void) fast_write (dup_file, (unsigned char *)&dup_msgs, sizeof (int));
  578.       v = MAGIC;
  579.       (void) fast_write (dup_file, (unsigned char *)&v, sizeof (int));
  580.       (void) fast_write (dup_file, (unsigned char *)killer, dup_size * sizeof (KILL));
  581.       (void) fast_close (dup_file);
  582.       }
  583.  
  584.    _ffree (wbuffs[f].wbuff);
  585.    wbuffs[f].wbuff = wbuffs[f].wptr = NULL;
  586.    wbuffs[f].wsize = -1;
  587.     (void) fast_close (f);
  588.     free (holder1);
  589.    free (killer);
  590.     /* Else return 0 */
  591.     return (0);
  592.     }
  593.  
  594. int tosspkt (char *dir)
  595. {
  596.     int j, k, ret, ct;
  597.     char pktname[20];
  598.    char pktname1[64];
  599.    char pktn[64];
  600. /* char pktsave[20]; */
  601.  
  602.     j = 0;
  603.     ret = 1;
  604.    sprintf (pktn, "%s\\*.PKT", dir);
  605.    ct = strlen (dir) + 1;
  606.     (void) filedir (pktn, j, pktname, 0);
  607.     while (pktname[0] != '\0')
  608.         {
  609.       sprintf (pktname1, "%s\\%s", dir, pktname);
  610.         printf ("Tossing packet '%s'\n", pktname1);
  611.         if (unpackpkt (pktname1))
  612.             {
  613.          bad_pkt = 1;
  614.             printf ("Problem with packet '%s' ", pktname1);
  615.          if (pktname[8] != '.')
  616.             {
  617.             printf ("- continuing\n");
  618.             ++j;
  619.             }
  620.          else
  621.             {
  622.             strcpy (&pktname[9], "BAD");
  623.             sprintf (pktn, "%s\\%s", dir, pktname);
  624.             if (rename (pktname1, pktn) == 0)
  625.                {
  626.             printf ("renamed '%s'\n", pktn);
  627.                }
  628.             else
  629.                {
  630.                printf ("rename failed, packet removed\n");
  631.                unlink (pktname1);
  632.                }
  633.             sprintf (pktn, "%s\\*.PKT", dir);
  634.             for (k = 0; k < j; k++)
  635.             {
  636.                (void) filedir (pktn, k, pktname, 0);
  637.                     }
  638.             }
  639.             }
  640.         else
  641.             {
  642.             ret = 0;
  643.             unlink (pktname1);
  644.             for (k = 0; k < j; k++)
  645.                 {
  646.                 (void) filedir (pktn, k, pktname, 0);
  647.                 }
  648.             }
  649.         (void) filedir (pktn, j, pktname, 0);
  650.         }
  651.     return (ret);
  652.     }
  653.  
  654. void arc_e ()
  655. {
  656.     /* Now unARC all the other ARCmail and toss that stuff */
  657.     (void) arcmail();
  658. }
  659.