home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 2 BBS / 02-BBS.zip / VP2SRC.ZIP / ARC_A.C next >
Text File  |  1991-04-20  |  20KB  |  673 lines

  1. /*
  2.   $Header: arc_a.c 3.3 87/12/12 00:39:38 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_a.c $
  51.  * Revision 3.3  87/12/12  00:39:38  Bob
  52.  * Source code release
  53.  *
  54. */
  55.  
  56. #include <stdio.h>
  57. #include <ctype.h>
  58. #include <fcntl.h>
  59. #include <io.h>
  60. #include <time.h>
  61. #include <string.h>
  62. #include <stdlib.h>
  63. #include <process.h>
  64. #include <sys/types.h>
  65. #include <sys/stat.h>
  66. #include "fastecho.h"
  67.  
  68. #define DEBUG 0
  69.  
  70. extern char *_months[];
  71. extern SEACONFIG config;
  72. extern AREAS_PTR areas[];
  73. extern char board_name[], sysop_name[];
  74. extern int tot_areas;
  75. extern char bbsfile[];
  76. extern char *arc_cmd[];
  77. extern int nread;
  78. extern int arc_args;
  79. extern int last_msg;
  80. extern int high_one;
  81. extern int convert;
  82. extern struct tm *t2;
  83. extern struct _stamp cur_stamp;
  84. extern int *msg_nums;
  85. extern char *holder1;
  86. extern int mail_low, mail_high;
  87. extern int seen_byl;
  88. extern int cminternal;
  89. extern int to_netmail;
  90. extern PACKED p_msg;
  91. extern PKTHDR pkt_hdr;
  92. extern char cur_dir[];
  93. extern char pkt_dir[];
  94. extern char tmpjunk[], tmpjunk1[], tmpjunk2[];
  95. extern unsigned def_attr;
  96. extern int seahome;
  97. extern MSG msg_tmp;
  98. int arc_compat = 1;
  99. int num_arc = -1;
  100. int arc_net[100];
  101. int arc_node[100];
  102. int arc_msg[100];
  103. char *asuffix[] =
  104.     { "SU1", "MO1", "TU1", "WE1", "TH1", "FR1", "SA1", NULL };
  105. char *weekday[] =
  106.     { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", NULL };
  107.  
  108. void arc_a ()
  109. {
  110.     int err;
  111.     char retname[15];
  112.  
  113.     /* First of all do we have any packets to do? */
  114.     sprintf (tmpjunk, "%s*.FS$", pkt_dir);
  115.     (void) filedir (tmpjunk, 0, retname, 0);
  116.     find_old();
  117.     zap_old ();
  118.     if (retname[0] == '\0')
  119.     {
  120.         /* We had no packets to ARCmail */
  121.         printf ("No packets generated\n");
  122.         return;
  123.     }
  124.  
  125.     /* Find all of the ARCmail that we already have out there */
  126.  
  127.     /* Get the first one to ARCmail */
  128.     (void) filedir (tmpjunk, 0, retname, 0);
  129.     while (retname[0])
  130.     {
  131.         /* Now for each packet ARC it up */
  132.         err = arc_to (retname);
  133.         if (err)
  134.         {
  135.             /* This is bad news - we did not finish the packet */
  136.             printf ("Errorlevel %d for ARCmail of '%s' - exiting\n", err, retname);
  137.             exit (3);
  138.         }
  139.  
  140.         /* Now get the next packet name */
  141.         (void) filedir (tmpjunk, 0, retname, 0);
  142.     }
  143. }
  144.  
  145. int arc_to (char retname[])
  146. {
  147.     int tonet, tonode;
  148.     int netdiff, nodediff;
  149.     int err, needmsg;
  150.     char newname[64];
  151.     char arcext[4];
  152.     char tnet[5];
  153.     char tnode[5];
  154.     long tt1;
  155.     struct tm *tt2;
  156.  
  157.     /* Find out who we were going to */
  158. /*  sscanf (retname, "%04x%04x", &tonet, &tonode); */
  159.     sscanf (retname, "%4s%4s", tnet, tnode);
  160.     sscanf (tnet, "%04x", &tonet);
  161.     sscanf (tnode, "%04x", &tonode);
  162.  
  163. #if DEBUG
  164.     printf ("filename is '%s' extracted %d/%d\n", retname, tonet, tonode);
  165. #endif
  166.  
  167.     /* Now create the actual new packet name (must end in .PKT) */
  168.     tt1 = time(NULL);
  169.     tt2 = localtime (&tt1);
  170.     sprintf (tmpjunk1, "%s%s", pkt_dir, retname);
  171.     errno = 0;
  172.     do {
  173.         sprintf (newname,"%s%02d%02d%02d%02d.PKT", pkt_dir, tt2->tm_mday,
  174.             tt2->tm_hour, tt2->tm_min, tt2->tm_sec);
  175.         errno = 0;
  176.         (void) rename(tmpjunk1, newname);
  177.         ++(tt2->tm_sec);
  178.     } while (errno==13);
  179.  
  180.     /* Now get the differences in net and node numbers to generate ARCmail */
  181.     netdiff = config.net[1] - tonet;
  182.     nodediff = config.node[1] - tonode;
  183.  
  184.     printf ("ARCmailing to %d/%d\n", tonet, tonode);
  185.  
  186.     /* Find the extension to use */
  187.     needmsg = suffix (tonet, tonode, arcext, 1);
  188.  
  189.     /* Create the new filename */
  190.     sprintf (tmpjunk1, "%s%04x%04x.%s", cur_dir, netdiff, nodediff, arcext);
  191.  
  192. #if DEBUG
  193.     printf ("Using filename '%s'\n", tmpjunk1);
  194. #endif
  195.  
  196. #if DEBUG
  197.     printf ("Packet renamed to '%s'\n", newname);
  198. #endif
  199.  
  200.     /* Now actually create the archive */
  201.     strcpy (arc_cmd[arc_args], tmpjunk1);
  202.     strcpy (arc_cmd[arc_args+1], newname);
  203. /*   strcpy (tmpjunk3, arc_cmd[0]);
  204.     for (i = 1; i <= arc_args+1; i++)
  205.     {
  206.         strcat (tmpjunk3, " ");
  207.         strcat (tmpjunk3, arc_cmd[i]);
  208.     } */
  209.  
  210. #if DEBUG
  211.     printf ("Before ARC call:\n");
  212.     printf ("   needmsg = '%d'\n", needmsg);
  213.     printf ("   config.mailpath = '%s'\n", config.mailpath);
  214.     printf ("   netdiff = %d nodediff = %d\n", netdiff, nodediff);
  215. #endif
  216.     err = spawnvp (P_WAIT, arc_cmd[0], arc_cmd);
  217.     if (err)
  218.     {
  219.         /* Ooops */
  220.         sprintf (tmpjunk1, "%s%s", pkt_dir, retname);
  221. #if DEBUG
  222.         printf ("ARC error\n  Trying to rename %s to %s\n", newname, tmpjunk1);
  223. #endif
  224.         (void) rename (newname, tmpjunk1);
  225.         return (err);
  226.     }
  227.  
  228. #if DEBUG
  229.     printf ("After ARC call:\n");
  230.     printf ("   needmsg = '%d'\n", needmsg);
  231.     printf ("   config.mailpath = '%s'\n", config.mailpath);
  232.     printf ("   netdiff = %d nodediff = %d\n", netdiff, nodediff);
  233. #endif
  234.     /* create a file attach message */
  235.     if (seahome)
  236.         sprintf (tmpjunk1, "%04x%04x.%s", netdiff, nodediff, arcext);
  237.  
  238.     do_attach (needmsg, tonet, tonode, tmpjunk1);
  239.  
  240.     /* If we completed with no errors then unlink the packet */
  241.     unlink (newname);
  242.  
  243.     /* Return that all was ok */
  244.     return (0);
  245. }
  246.  
  247. void do_attach (
  248.    int  msg_no,
  249.    int  tonet,
  250.    int  tonode,
  251.    char filename[])
  252. {
  253.     int f;
  254.     char fname1[64];
  255.     char *p1;
  256.     FILE *fin;
  257.  
  258. #if DEBUG
  259.     printf ("Doing file attach message\n");
  260. #endif
  261.  
  262.     if (cminternal)
  263.     {
  264.         if (!msg_no)
  265.             return;
  266.  
  267.         /* Set up the .FLO filename */
  268.         sprintf (fname1, "%s%04x%04x.FLO", cur_dir, tonet, tonode);
  269.  
  270.         if ((fin = fopen (fname1, "a")) == NULL)
  271.         {
  272.             printf ("Cannot open '%s' - exiting\n", fname1);
  273.             exit (2);
  274.         }
  275.         fprintf (fin, "#%s\n", filename);
  276.         fclose (fin);
  277.     }
  278.     else
  279.     {
  280.         memset ((char *) &msg_tmp, 0, sizeof (MSG));
  281.         strcpy (msg_tmp.from, "ARCmail");
  282.         strcpy (msg_tmp.to, "SysOp");
  283.         strcpy (msg_tmp.subj, filename);
  284.  
  285.         /* Convert it to uppercase */
  286.         p1 = msg_tmp.subj;
  287.         while (*p1)
  288.         {
  289.             *p1 = (char) toupper (*p1);
  290.             ++p1;
  291.         }
  292.  
  293.         sprintf (msg_tmp.date, "%3.3s %2d %3.3s %02d %02d:%02d",
  294.         weekday[t2->tm_wday], t2->tm_mday, _months[t2->tm_mon],
  295.            t2->tm_year, t2->tm_hour, t2->tm_min);
  296.         msg_tmp.date[8] = (char) tolower (msg_tmp.date[8]);
  297.         msg_tmp.date[9] = (char) tolower (msg_tmp.date[9]);
  298.  
  299.         msg_tmp.times = 0;
  300.         msg_tmp.dest = tonode;
  301.         msg_tmp.orig = config.node[1];
  302.         msg_tmp.cost = 0;
  303.         msg_tmp.orig_net = config.net[1];
  304.         msg_tmp.dest_net = tonet;
  305.         msg_tmp.reply = 0;
  306.         msg_tmp.attr = MSGLOCAL|MSGPRIVATE|MSGFILE|MSGKILL|def_attr;
  307.         msg_tmp.up = 0;
  308.         msg_tmp._date_written.date = 0;
  309.         msg_tmp._date_written.time = 0;
  310.         msg_tmp._date_arrived.date = 0;
  311.         msg_tmp._date_arrived.time = 0;
  312.  
  313.         /* Create the message file name */
  314.         sprintf (fname1, "%s\\%d.MSG", config.mailpath, msg_no);
  315.  
  316. #if DEBUG
  317.         printf ("placing it in '%s'\n", fname1);
  318. #endif
  319.  
  320.         /* Open up new message file */
  321.         if((f = open (fname1, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY, S_IREAD|S_IWRITE)) == -1)
  322.         {
  323.             printf ("\n'%s' could not be opened for file attach - exiting\n", fname1);
  324.             exit (2);
  325.         }
  326.  
  327.         /* Write out the header information */
  328.         (void )fast_write (f, (char *) &msg_tmp, sizeof (MSG));
  329.  
  330.        /* Now close the file */
  331.        (void) fast_close (f);
  332.     }
  333. }
  334.  
  335. int suffix (
  336.    int  tonet,
  337.    int  tonode,
  338.    char arcext[],
  339.    int  del)
  340. {
  341.     int i;
  342.     char curarc[15];
  343.     struct stat stbuf;
  344.  
  345.     /* First find out what archives we have out there for him */
  346.     sprintf (tmpjunk2, "%s%04x%04x.*", cur_dir,
  347.         config.net[1]-tonet, config.node[1]-tonode);
  348.     (void) filedir (tmpjunk2, 0, curarc, 0);
  349.  
  350.     /* Lets be optimistic */
  351.     strcpy (arcext, asuffix[t2->tm_wday]);
  352.  
  353.     /* Now if we have no archive to him, then just return the easy way */
  354.     if (curarc[0] == '\0')
  355.     {
  356.         printf ("Creating new archive '%s%04x%04x.%s'",
  357.            cur_dir, config.net[1]-tonet, config.node[1]-tonode, arcext);
  358.         if (cminternal)
  359.         {
  360.             printf ("\n");
  361.         }
  362.         else
  363.         {
  364.             printf ("and new MAIL:%04d.MSG\n", mail_high+1);
  365.         }
  366.         return (++mail_high);
  367.     }
  368.  
  369.     strcpy (arcext, &curarc[9]);
  370.     sprintf (tmpjunk2, "%s%s", cur_dir, curarc);
  371.  
  372.     find_old();
  373.  
  374.     /* Now find if this node is in the list */
  375.     if (!cminternal)
  376.     {
  377.         for (i = 0; i < num_arc; i++)
  378.         {
  379.            if ((arc_node[i] == tonode) && (arc_net[i] == tonet))
  380.            {
  381.             /* We found an archive to this guy already */
  382.             if (del)
  383.                 printf ("Adding to archive '%s' for node %d/%d (MAIL:%04d.MSG)\n",
  384.                     tmpjunk2, tonet, tonode, arc_msg[i]);
  385.             return (arc_msg[i]);
  386.             }
  387.         }
  388.  
  389.         arc_net[num_arc] = tonet;
  390.         arc_node[num_arc] = tonode;
  391.         arc_msg[num_arc] = ++mail_high;
  392.         ++num_arc;
  393.         if (!del)
  394.             return (mail_high);
  395.     }
  396.     else
  397.     {
  398.         stat (tmpjunk2, &stbuf);
  399.         if (stbuf.st_size > 0)
  400.         {
  401.             if (del)
  402.                 printf ("Adding to archive '%s' for node %d/%d\n",
  403.                   tmpjunk2, tonet, tonode);
  404.             return (0);
  405.         }
  406.     }
  407.  
  408.     /* No archive to him any more, delete the old archive */
  409.     printf ("Deleting SENT archive '%s'", tmpjunk2);
  410.     if (cminternal)
  411.         printf ("\n");
  412.     else
  413.         printf (" creating new MAIL:%04d.MSG\n", mail_high);
  414.     unlink (tmpjunk2);
  415.  
  416.     /* Increment the new archive */
  417.     if (strncmp (arcext, asuffix[t2->tm_wday], 2) == 0)
  418.     {
  419.        if ((arcext[2] == '0') && (arc_compat))
  420.        {
  421.            arcext[2] = 'A';
  422.        }
  423.        else if (arcext[2] == '9')
  424.        {
  425.            arcext[2] = '0';
  426.        }
  427.        else if (arcext[2] == 'Z')
  428.        {
  429.            /* Oh well, take our chances and start again */
  430.           arcext[2] = '1';
  431.        }
  432.        else
  433.        {
  434.            ++(arcext[2]);
  435.        }
  436.    }
  437.    else
  438.        strcpy (arcext, asuffix[t2->tm_wday]);
  439.  
  440.    /* Return the easy way */
  441.    return (mail_high);
  442. }
  443.  
  444. int set_bits (
  445.    int          tonet,
  446.    int          tonode,
  447.    unsigned int bits)
  448. {
  449.     int needmsg, netdiff, nodediff, omailhigh;
  450.     char arcext[5];
  451.  
  452.     /* set the bits used by the do_attach() routine */
  453.     def_attr = bits;
  454.  
  455.     /* Now get the differences in net and node numbers to generate ARCmail */
  456.     netdiff = config.net[1] - tonet;
  457.     nodediff = config.node[1] - tonode;
  458.  
  459.     printf ("Changing ARCmailing to %d/%d to %s/%s\n", tonet, tonode,
  460.       (bits&MSGCRASH)?"Crash":"NoCrash", (bits&MSGHOLD)?"Hold":"NoHold");
  461.  
  462.     omailhigh = mail_high;
  463.  
  464.     /* Find the extension to use */
  465.     if ((needmsg = suffix (tonet, tonode, arcext, 0)) > omailhigh)
  466.     {
  467.         mail_high = omailhigh;
  468.         printf ("No archive found for %d/%d\n", tonet, tonode);
  469.         return (0);
  470.     }
  471.  
  472.     /* Create the new filename */
  473.     if (seahome)
  474.         sprintf (tmpjunk1, "%04x%04x.%s", netdiff, nodediff, arcext);
  475.     else
  476.         sprintf (tmpjunk1, "%s%04x%04x.%s", cur_dir, netdiff, nodediff, arcext);
  477.  
  478.     /* create a file attach message */
  479.     do_attach (needmsg, tonet, tonode, tmpjunk1);
  480.  
  481.     /* Return that all was ok */
  482.     return (0);
  483. }
  484.  
  485. void find_old ()
  486. {
  487.     int i, f;
  488.     char *t1;
  489.     char msgname[64];
  490.  
  491.     if (cminternal)
  492.         return;
  493.  
  494.     /* Otherwise we have to see if the mail was already sent */
  495.     if (num_arc == -1)
  496.     {
  497.         /* Mark that we executed this part already */
  498.         num_arc = 0;
  499.  
  500.         /* Find all of the mail that has been sent */
  501.         printf ("Scanning for old ARCmail\n");
  502.  
  503.         strcpy (msgname, config.mailpath);
  504.         t1 = msgname+strlen(msgname);
  505.  
  506.         /* For each message in the netmail area */
  507.         for (i = 1; i <= mail_high; i++)
  508.         {
  509.             sprintf (t1, "\\%d.MSG", i);
  510.  
  511.             /* If we can't open it then continue on */
  512.             if ((f = open (msgname, O_RDONLY|O_BINARY)) == -1)
  513.                 continue;
  514.  
  515.             /* Otherwise read in a message full */
  516.             if (fast_read (f, (char *) &msg_tmp, sizeof (MSG)) != sizeof (MSG))
  517.             {
  518.                 /* If it is the wrong size, then continue */
  519.                 (void) fast_close (f);
  520.                 continue;
  521.             }
  522.  
  523.             /* Close the file */
  524.             (void) fast_close (f);
  525.  
  526.             /* If it does not have a file attached then continue */
  527.             if (!(msg_tmp.attr & MSGFILE))
  528.                 continue;
  529.  
  530.             /* If it is not to SysOp then continue */
  531.             if (strcmp (msg_tmp.to, "SysOp") != 0)
  532.                 continue;
  533.  
  534.             /* If it is not from ARCmail then continue */
  535.             if (strcmp (msg_tmp.from, "ARCmail") != 0)
  536.                 continue;
  537.  
  538.             /* If it is to us then continue */
  539.             if ((msg_tmp.dest == config.node[1]) && (msg_tmp.dest_net == config.net[1]))
  540.                 continue;
  541.  
  542.             /* Make sure it was generated here */
  543.             if (!(msg_tmp.attr & MSGLOCAL))
  544.                 continue;
  545.  
  546.             /* Otherwise save the pertinent data */
  547. #if DEBUG
  548.             printf ("Found archive to %d/%d at message %d\n", msg_tmp.dest_net, msg_tmp.dest, i);
  549. #endif
  550.             arc_net[num_arc] = msg_tmp.dest_net;
  551.             arc_node[num_arc] = msg_tmp.dest;
  552.             arc_msg[num_arc] = i;
  553.             ++num_arc;
  554.         }
  555.     }
  556. }
  557.  
  558. void zap_old ()
  559. {
  560.     int i, f;
  561.     int j, k;
  562.     int tnet, tnode;
  563.     char nett[5], nodet[5];
  564.     char curarc[15];
  565.     char aname[64];
  566.     struct stat st_stat;
  567.  
  568.     if (cminternal)
  569.         return;
  570.  
  571.     /* Now clean out the old ARCmail by zapping it to 0 length */
  572.     printf("Zapping sent ARCmail to 0 length\n");
  573.  
  574.     /* loop through *.SU? *.MO? ... */
  575.     for (i = 0; asuffix[i] != NULL; i++)
  576.     {
  577.         /* Set up the .....\*.MO? filename to look for */
  578.         sprintf (tmpjunk2, "%s*.%s", cur_dir, asuffix[i]);
  579.         tmpjunk2[strlen(tmpjunk2)-1] = '?';
  580.  
  581.         (void) filedir (tmpjunk2, 0, curarc, 0);
  582.  
  583.         k = 0;
  584.         while (curarc[0] != '\0')
  585.         {
  586.             ++k;
  587.  
  588.             /* Is it a real archive */
  589.             sprintf (aname, "%s%s", cur_dir, curarc);
  590.             if (stat (aname, &st_stat))
  591.             {
  592.                 goto next_one;
  593.             }
  594.  
  595.             if (strlen (curarc) != 12)
  596.             {
  597.                 goto next_one;
  598.             }
  599.  
  600.             if (arc_compat && !isdigit(curarc[11]))
  601.             {
  602.                 goto next_one;
  603.             }
  604.             else if ((!arc_compat) && (!isalnum(curarc[11])))
  605.             {
  606.                 goto next_one;
  607.             }
  608.  
  609.             for (j = 0; j < 8; j++)
  610.             {
  611.                 if ((curarc[j] <= '9') && (curarc[j] >= '0'))
  612.                     continue;
  613.                 if ((curarc[j] <= 'F') && (curarc[j] >= 'A'))
  614.                     continue;
  615.                 goto next_one;
  616.             }
  617.  
  618.             if (st_stat.st_size > 0)
  619.             {
  620.                 /* Each time we find something, see if it still has to go */
  621. /*              sscanf (curarc, "%04x%04x", &tnet, &tnode); */
  622.                 sscanf (curarc, "%4s%4s", nett, nodet);
  623.                 sscanf (nett, "%04x", &tnet);
  624.                 sscanf (nodet, "%04x", &tnode);
  625.                 tnet = config.net[1] - tnet;
  626.                 tnode = config.node[1] - tnode;
  627.  
  628.                 /* Now find if this node is in the list */
  629.                 for (j = 0; j < num_arc; j++)
  630.                 {
  631.                     if ((arc_node[j] == tnode) && (arc_net[j] == tnet))
  632.                     {
  633.                         break;
  634.                     }
  635.                 }
  636.  
  637.             /* If not, then zap it down to 0 size */
  638.             if (j == num_arc)
  639.             {
  640.                 printf ("Archive '%s' to %d/%d sent, ", aname, tnet, tnode);
  641.                 unlink (aname);
  642.                 if (i != t2->tm_wday)
  643.                 {
  644.                     printf ("deleting\n");
  645.                 }
  646.                 else
  647.                 {
  648.                     printf ("zapping\n");
  649.                     f = open (aname, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY, S_IREAD|S_IWRITE);
  650.                     fast_close (f);
  651.                 }
  652.  
  653.                 /* Set up the .....\*.MO? filename to look for again */
  654.                 sprintf (tmpjunk2, "%s*.%s", cur_dir, asuffix[i]);
  655.                 tmpjunk2[strlen(tmpjunk2)-1] = '?';
  656.  
  657.                 --k;
  658.  
  659.                 for (j = 0; j < k; j++)
  660.                 {
  661.                     (void) filedir (tmpjunk2, j, curarc, 0);
  662.                 }
  663.             }
  664.         }
  665.  
  666.         /* Now get the next one */
  667. next_one:
  668.         filedir (tmpjunk2, k, curarc, 0);
  669.         }
  670.     }
  671. }
  672.  
  673.