home *** CD-ROM | disk | FTP | other *** search
/ ftp.uv.es / 2014.11.ftp.uv.es.tar / ftp.uv.es / pub / unix / elm-2.4-pl20.tar.Z / elm-2.4-pl20.tar / lib / mk_aliases.c < prev    next >
C/C++ Source or Header  |  1993-01-12  |  18KB  |  702 lines

  1.  
  2. static char rcsid[] = "@(#)$Id: mk_aliases.c,v 5.7 1993/01/05 17:52:14 syd Exp $";
  3.  
  4. /*******************************************************************************
  5.  *  The Elm Mail System  -  $Revision: 5.7 $   $State: Exp $
  6.  *
  7.  *            Copyright (c) 1988-1992 USENET Community Trust
  8.  *            Copyright (c) 1986,1987 Dave Taylor
  9.  *******************************************************************************
  10.  * Bug reports, patches, comments, suggestions should be sent to:
  11.  *
  12.  *    Syd Weinstein, Elm Coordinator
  13.  *    elm@DSI.COM            dsinc!elm
  14.  *
  15.  *******************************************************************************
  16.  * $Log: mk_aliases.c,v $
  17.  * Revision 5.7  1993/01/05  17:52:14  syd
  18.  * Add missing quote check to whitespace error check loop
  19.  * From: "Robert L. Howard" <robert.howard@matd.gatech.edu>
  20.  *
  21.  * Revision 5.6  1992/12/11  02:10:24  syd
  22.  * Make Elm complain about spaces that are not after commas in
  23.  * alias and address lists
  24.  * From: "Robert L. Howard" <robert.howard@matd.gatech.edu>
  25.  *
  26.  * Revision 5.5  1992/12/11  02:09:06  syd
  27.  * Fix where the user creates a first new alias, then deletes it, the
  28.  * alias stays on screen, but the file really will be empty if it was the
  29.  * last alias, so the retry to delete gives 'cannot open ...file' messages
  30.  * From: "Robert L. Howard" <robert.howard@matd.gatech.edu>
  31.  *
  32.  * Revision 5.4  1992/11/15  01:15:28  syd
  33.  * The alias message_count isn't set to zero if the last alias has
  34.  * been deleted from the alias table. As no aliases are reread from
  35.  * the aliases database the message_count is left as it was before.
  36.  *
  37.  * Fixed that the function do_newalias() sometimes returns without freeing
  38.  * the buffer allocated before. The patch adds these free calls.
  39.  *
  40.  * When you erroneously type a number in your folder elm asks you for
  41.  * a new current message number. But now if you erase this one number
  42.  * and leave the string empty elm will set the new current message to
  43.  * the second message on our sun4! The patch adds a check for an empty
  44.  * string and returns the current number if no number was entered.
  45.  * From: vogt@isa.de (Gerald Vogt)
  46.  *
  47.  * Revision 5.3  1992/11/07  16:32:14  syd
  48.  * comments should be allowed anywhere in the alias file.
  49.  * From: "Robert L. Howard" <robert.howard@matd.gatech.edu>
  50.  *
  51.  * Revision 5.2  1992/10/11  01:46:35  syd
  52.  * change dbm name to dbz to avoid conflicts with partial call
  53.  * ins from shared librarys, and from mixing code with yp code.
  54.  * From: Syd via prompt from Jess Anderson
  55.  *
  56.  * Revision 5.1  1992/10/03  22:41:36  syd
  57.  * Initial checkin as of 2.4 Release at PL0
  58.  *
  59.  *
  60.  ******************************************************************************/
  61.  
  62. /** Install a new set of aliases for the 'Elm' mailer. 
  63.  
  64.     This code is shared with newalias and elm so that
  65.   it is easier to do updates while in elm.  The main routine
  66.   here is do_newalias().  If the third argument is TRUE then
  67.   we were called from elm.  That means that we will need to 
  68.   sleep() between error messages....  The fourth arguement
  69.   controls whether or not we should warn about missing aliases.text
  70.   files.  For the newalias program that's an error, for elm it's
  71.   ok.  Warning -- this last is a *hack* to get elm2.4b out the
  72.   door -- do_newalias should really return an error value and
  73.   the caller should generate the message.
  74.  
  75. **/
  76.  
  77. #include "headers.h"
  78. #include "s_newalias.h"
  79. #include <ctype.h>
  80. #include "ndbz.h"
  81.  
  82. #ifdef BSD
  83. #  include <sys/file.h>
  84. #  undef tolower
  85. #  undef toupper
  86. #endif
  87.  
  88. #define group(string)        (index(string,',') != NULL)
  89.  
  90. int  buff_loaded;        /* for file input overlap... */
  91. int  err_flag;            /* if errors, don't save!    */
  92. int  al_count;            /* how many aliases so far?  */
  93. char msg_buff[SLEN];        /* buffer for error messages */
  94. DBZ  *aliases_hash;             /* current alias file        */
  95. char *buffer;            /* alias line buffer         */
  96. long buffer_size;        /* size of alias buffer      */
  97. long file_offset = 0;        /* offset into file so far   */
  98.  
  99. extern int  is_system;        /* system file updating?     */
  100.  
  101. #ifdef DEBUG
  102. extern FILE *debugfile;
  103. extern int  debug;
  104. #endif
  105.  
  106. int
  107. get_alias(file, fromelm)
  108. FILE *file;
  109. int fromelm;
  110. {
  111.     /* load buffer with the next complete alias from the file.
  112.        (this can include reading in multiple lines and appending
  113.        them all together!)  Returns EOF after last entry in file.
  114.     
  115.     Lines that start with '#' are assumed to be comments and are
  116.      ignored.  White space as the first field of a line is taken
  117.     to indicate that this line is a continuation of the previous. */
  118.  
  119.     static char mybuffer[LONG_STRING];
  120.     int    done = 0, len;
  121.     char   *s;
  122.  
  123.     /** get the first line of the entry... **/
  124.  
  125.     buffer[0] = '\0';            /* zero out line */
  126.     len = 0;
  127.  
  128.     if (get_line(file, mybuffer, TRUE, fromelm) == -1) 
  129.         return(-1);
  130.     strcpy(buffer, mybuffer);
  131.     len = strlen(buffer);
  132.  
  133.     /** now read in the rest (if there is any!) **/
  134.  
  135.     do {
  136.       if (get_line(file, mybuffer, FALSE, fromelm) == -1) {
  137.           if (err_flag)
  138.               return(-1);
  139.           buff_loaded = 0;    /* force a read next pass! */
  140.           return(0);    /* okay. let's just hand 'buffer' back! */
  141.       }
  142.       done = (! whitespace(mybuffer[0]));
  143.       if (! done) {
  144.           for (s = mybuffer; *s && whitespace(*s); s++) ;
  145.           *--s = ' ';
  146.           len += strlen(s);
  147.           if (len >= buffer_size) {
  148.               sprintf(msg_buff, catgets(elm_msg_cat,
  149.                       NewaliasSet, NewaliasLineToLong,
  150.                   "Line + continuations exceeds maximum length of %ld:"),
  151.                   buffer_size);
  152.               error(msg_buff);
  153.               if (fromelm)
  154.                   sleep(2);
  155.               sprintf(msg_buff, "%.40s", buffer);
  156.               error(msg_buff);
  157.           err_flag++;
  158.           } else
  159.           strcat(buffer, s);
  160.       }
  161.     } while (! done);
  162.     
  163.     return(0);    /* no sweat! */
  164. }
  165.  
  166. int
  167. get_line(file, buffer, first_line, fromelm)
  168. FILE *file;
  169. char *buffer;
  170. int  first_line, fromelm;
  171. {
  172. /*
  173.  *    Read line from file.
  174.  *    If first_line and buff_loaded, then just return!
  175.  *    All comment and blank lines are just ignored (never passed back).
  176.  */
  177.     int len;
  178.  
  179.     if (first_line && buff_loaded) {
  180.       buff_loaded = 1;
  181.       return(0);
  182.     }
  183.  
  184.     buff_loaded = 1;    /* we're going to get SOMETHING in the buffer */
  185.  
  186.     do {
  187.        /*
  188.     * We will just ignore any line that begins with comment (no
  189.     * matter how long).
  190.     */
  191.       do {
  192.         len = mail_gets(buffer, LONG_STRING, file);
  193.       } while (buffer[0] == '#');
  194.  
  195.       if (len > 0) {
  196.         if (buffer[len - 1] != '\n') {
  197.           if (fromelm) {
  198.           error(catgets(elm_msg_cat, NewaliasSet, NewaliasSplitShort,
  199.           "Line too long, split using continuation line format:"));
  200.           sleep(2);
  201.           sprintf(msg_buff, "%.40s", buffer);
  202.           }
  203.           else {
  204.           sprintf(msg_buff, catgets(elm_msg_cat,
  205.               NewaliasSet, NewaliasSplit,
  206.           "Line too long, split using continuation line format (starting line\nwith whitespace):\n%.40s\n"), buffer);
  207.           }
  208.           error(msg_buff);
  209.           err_flag++;
  210.           return(-1);
  211.         }
  212.       }
  213.       else {
  214.         return(-1);
  215.       }
  216.       no_ret(buffer);
  217. /*
  218.  *    If the buffer is zero length after returns are stripped (and
  219.  *    len was > 0) we need to go ahead and get another line.
  220.  */
  221.     } while (strlen(buffer) == 0);
  222.  
  223.     return(0);
  224. }
  225.  
  226. void
  227. de_escape(the_string)
  228. char *the_string;
  229. {
  230.     register char *s, *out;
  231.  
  232.     for (s = the_string, out = the_string; *s; s++) {
  233.         if (*s != '\\')
  234.         *out++ = *s;
  235.         else
  236.         *out++ = *++s;
  237.     }
  238.     *out = '\0';
  239.  
  240.     return;
  241. }
  242.  
  243. void
  244. add_to_hash_table(word, offset)
  245. char *word;
  246. long  offset;
  247. {
  248.     datum    key, value, ovalue;
  249.     long    off;
  250.     
  251.     key.dptr = word;
  252.     key.dsize = strlen(word);
  253.     off = offset;
  254.     value.dptr = (char *) &off;
  255.     value.dsize = sizeof(off);
  256.  
  257.     ovalue = dbz_fetch(aliases_hash, key);
  258.     if (ovalue.dptr != NULL) {
  259.         sprintf(msg_buff, catgets(elm_msg_cat,
  260.                 NewaliasSet, NewaliasDupAlias,
  261.             "** Duplicate alias '%s' in file.  Multiples ignored."),
  262.         word);
  263.         error(msg_buff);
  264.         return;
  265.     }
  266.  
  267.     if (dbz_store(aliases_hash, key, value) < 0) {
  268.         sprintf(msg_buff, catgets(elm_msg_cat,
  269.                 NewaliasSet, NewaliasErrWrite,
  270.             "** Error writing alias '%s'."), word);
  271.         error(msg_buff);
  272.         err_flag++;
  273.     }
  274. }
  275.  
  276. void
  277. add_to_table(data, aliases, lastn, firstn, comment, addresses)
  278. FILE *data;
  279. register char *aliases, *lastn, *firstn, *comment, *addresses;
  280. {
  281.     struct alias_rec    alias;
  282.     register char    *s;
  283. /*
  284.  *    crack the information into an alias_rec structure, then add the entry
  285.  *    each alias at a time to the dbz file.
  286.  */
  287.     alias.status = 0;
  288.     alias.alias = 0;
  289. /*
  290.  *    loop over each alias in aliases (split at the ,)
  291.  */
  292.     while (aliases != NULL) {
  293.         if ((s = index(aliases, ',')) != NULL)
  294.         *s++ = '\0';
  295.  
  296.         alias.last_name = alias.alias + strlen(aliases) + 1;
  297.         alias.name = alias.last_name + strlen(lastn) + 1;
  298.         alias.comment = alias.name + strlen(lastn) + 1;
  299.         if (firstn)
  300.         alias.comment += strlen(firstn) + 1;
  301.         if (comment)
  302.             alias.address = alias.comment + strlen(comment) + 1;
  303.         else
  304.             alias.address = alias.comment + 1;
  305.         alias.type = is_system ? SYSTEM : USER;
  306.         alias.type |= group(addresses) ? GROUP : PERSON;
  307.         alias.length = ((int) alias.address) + strlen(addresses) + 1;
  308.  
  309. /*
  310.  *    write the entry to the data file, followed by its data
  311.  */
  312.         fwrite((char *)&alias, sizeof(alias), 1, data);
  313.         fwrite(aliases, strlen(aliases) + 1, 1, data);
  314.         fwrite(lastn, strlen(lastn) + 1, 1, data);
  315.         if (firstn) {
  316.         fwrite(firstn, strlen(firstn), 1, data);
  317.         fwrite(" ", 1, 1, data);
  318.         }
  319.         fwrite(lastn, strlen(lastn) + 1, 1, data);
  320.         if (comment)
  321.             fwrite(comment, strlen(comment) + 1, 1, data);
  322.         else
  323.             fwrite("\0", 1, 1, data);
  324.         fwrite(addresses, strlen(addresses) + 1, 1, data);
  325.  
  326.         add_to_hash_table(aliases, file_offset + sizeof(alias));
  327.         al_count++;
  328.  
  329.         file_offset += alias.length + sizeof(alias);
  330.         aliases = s;
  331.         fflush(data);
  332.     }
  333.  
  334. }    
  335.  
  336. void
  337. put_alias(data)
  338. FILE *data;
  339. {
  340. /*
  341.  *    parse the buffer into aliases, names, comments and addresses
  342.  *    and then add the alias
  343.  */
  344.     register char *s, *aliases, *lastn, *firstn, *comment, *addresses, *out;
  345.     int    in_quote = FALSE;
  346.  
  347. /*
  348.  *    extract the alias name, its the part up to the first =, less the
  349.  *    white space on the end.
  350.  */
  351.     aliases = buffer;
  352.     if ((s = index(buffer, '=')) == NULL) {
  353.         sprintf(msg_buff, catgets(elm_msg_cat,
  354.                 NewaliasSet, NewaliasNoFieldSep,
  355.                 "Error - alias \"%.40s\" missing '=' field seperator."),
  356.             aliases);
  357.         error(msg_buff);
  358.         err_flag++;
  359.         return;
  360.     }
  361.  
  362.     lastn = s + 1;
  363.     while (--s >= buffer && whitespace(*s) ) ;
  364.     *++s = '\0';
  365.  
  366. /*
  367.  *    Now strip out any whitespace (and make sure it was
  368.  *    legal whitespace).  Legal whitespace follows ','.
  369.  */
  370.     for (s = aliases, out = aliases; *s; s++) {
  371.         if (whitespace(*s)) {
  372.             if (*(out-1) != ',') {
  373.                 err_flag++;            /* Keep going for now */
  374.             *out++ = *s;
  375.             }
  376.         }
  377.         else {
  378.         *out++ = *s;
  379.         }
  380.     }
  381.     *out = '\0';
  382.  
  383. /*
  384.  *    We have to delay reporting the error until the (legal)
  385.  *    spaces are striped, otherwise aliases is all screwed
  386.  *    up and doesn't display well at all.
  387.  */
  388.     if (err_flag) {
  389.         sprintf(msg_buff, catgets(elm_msg_cat,
  390.             NewaliasSet, NewaliasAliasWSNotAllowed,
  391.             "Error - whitespace in alias '%.30s' is not allowed."),
  392.             aliases);
  393.         error(msg_buff);
  394.         return;
  395.     }
  396.  
  397.  
  398.     /* verify the alias name is valid */
  399.     for ( s = buffer ; *s != '\0' && (ok_alias_char(*s)||*s==',') ; ++s ) ;
  400.     if ( *s != '\0' ) {
  401.         MCsprintf(msg_buff, catgets(elm_msg_cat,
  402.                 NewaliasSet, NewaliasCharNotSupported,
  403.             "Error - character '%c' in alias '%s' is not supported."),
  404.             *s, aliases);
  405.         error(msg_buff);
  406.         err_flag++;
  407.         return;
  408.     }
  409.     
  410. /*
  411.  *    get the second field into "lastn" - putting stuff after ','
  412.  *    into "comment".  skip over white space after = and before last =
  413.  */
  414.     while (*lastn != '\0' && whitespace(*lastn) )
  415.         lastn++;
  416.  
  417.     for (s = lastn; *s; s++) {
  418.         if (*s == '\\') {
  419.         s++;
  420.         continue;
  421.         }
  422.  
  423.         if (*s == '"')
  424.         in_quote = !in_quote;
  425.  
  426.         if (in_quote)
  427.         continue;
  428.  
  429.         if (*s == '=') {
  430.         addresses = s + 1;
  431.         break;
  432.         }
  433.     }
  434.  
  435.     if (*s != '=') {
  436.         sprintf(msg_buff, catgets(elm_msg_cat,
  437.                 NewaliasSet, NewaliasNoFieldSep,
  438.             "Error - alias \"%.40s\" missing '=' field seperator."),
  439.         aliases);
  440.         error(msg_buff);
  441.         err_flag++;
  442.         return;
  443.     }
  444.  
  445. /*
  446.  *    Remove trailing whitespace from second field
  447.  */
  448.     while (--s >= lastn && whitespace(*s) ) ;
  449.     *++s = '\0';
  450. /*
  451.  *    now get anything after a comma (marks comment within name field)
  452.  */
  453.     for (s = lastn, comment = NULL; *s; s++) {
  454.         if (*s == '\\') {
  455.         s++;
  456.         continue;
  457.         }
  458.  
  459.         if (*s == '"')
  460.         in_quote = !in_quote;
  461.  
  462.         if (in_quote)
  463.         continue;
  464.  
  465.         if (*s == ',') {
  466.         comment = s + 1;
  467.         while (--s >= lastn && whitespace(*s) ) ;
  468.             *++s = '\0';        /* Trailing whitespace... */
  469.         break;
  470.         }
  471.     }
  472.  
  473. /*
  474.  *    strip leading whitespace from comment
  475.  */
  476.     if (comment) {
  477.       while (*comment != '\0' && whitespace(*comment) )
  478.         comment++;
  479.     }
  480.  
  481. /*
  482.  *    remainder of line is the addresses, remove leading and
  483.  *    trailing whitespace
  484.  */
  485.     while (*addresses != '\0' && whitespace(*addresses) )
  486.         addresses++;
  487.  
  488.     s = addresses + strlen(addresses);
  489.     while (--s >= addresses && whitespace(*s) ) ;
  490.     *++s = '\0';
  491.  
  492. /*
  493.  *    Now strip out any whitespace (and make sure it was
  494.  *    legal whitespace).  Legal whitespace follows ','.
  495.  *    Don't mess with white space in quotes.
  496.  */
  497.     in_quote = FALSE;            /* Just for safety */
  498.     for (s = addresses, out = addresses; *s; s++) {
  499.         if (*s == '"')
  500.         in_quote = !in_quote;
  501.  
  502.         if (!in_quote && whitespace(*s)) {
  503.             if (*(out-1) == ',') {
  504.                 continue;
  505.             }
  506.             else {
  507.                 err_flag++;            /* Keep going for now */
  508.             }
  509.         }
  510.         *out++ = *s;
  511.     }
  512.     *out = '\0';
  513.  
  514. /*
  515.  *    We have to delay reporting the error until the (legal)
  516.  *    spaces are striped, otherwise addresses is all screwed
  517.  *    up and doesn't display well at all.
  518.  */
  519.     if (err_flag) {
  520.         sprintf(msg_buff, catgets(elm_msg_cat,
  521.             NewaliasSet, NewaliasAddressWSNotAllowed,
  522.             "Error - whitespace in address '%.30s' is not allowed."),
  523.             addresses);
  524.         error(msg_buff);
  525.         return;
  526.     }
  527.  
  528. /*
  529.  *    split the lastn field into firstn and lastn
  530.  */
  531.     for (s = lastn, firstn = NULL; *s; s++) {
  532.         if (*s == '\\') {
  533.         s++;
  534.         continue;
  535.         }
  536.  
  537.         if (*s == '"')
  538.         in_quote = !in_quote;
  539.  
  540.         if (in_quote)
  541.         continue;
  542.  
  543.         if (*s == ';') {
  544.         firstn = s + 1;
  545.         while (--s >= lastn && whitespace(*s) ) ;
  546.         *++s = '\0';        /* Trailing whitespace... */
  547.         break;
  548.         }
  549.     }
  550.  
  551. /*
  552.  *    strip leading whitespace from firstn
  553.  */
  554.     if (firstn) {
  555.         while (*firstn && whitespace(*firstn))
  556.         firstn++;
  557.     }
  558.  
  559. /*
  560.  *    now remove 'escapes' from name/comment and aliases fields, in place
  561.  */
  562.     de_escape(lastn);
  563.     if (firstn) {
  564.         de_escape(firstn);
  565.     }
  566.     if (comment) {
  567.         de_escape(comment);
  568.     }
  569.     de_escape(addresses);
  570.  
  571.     add_to_table(data, aliases, lastn, firstn, comment, addresses);
  572. }
  573.  
  574. int
  575. do_newalias(inputname, dataname, fromelm, textwarn)
  576. char *inputname, *dataname;
  577. int fromelm, textwarn;
  578. {
  579.     FILE *in, *data;
  580.  
  581. /*
  582.  *    try and allocate a big buffer (larger than a 64k segment...
  583.  *        if it succeeds, mark dbz to run in-core
  584.  *        if not, allocate a smaller buffer
  585.  */
  586.     if ((buffer = malloc(20 * VERY_LONG_STRING)) == NULL) {
  587.         if ((buffer = malloc(2 * VERY_LONG_STRING)) == NULL) {
  588.             error(catgets(elm_msg_cat, NewaliasSet, NewaliasNoAlloc,
  589.                     "Unable to allocate space for alias buffer!"));
  590.             return(-1);
  591.         }
  592.         buffer_size = 2 * VERY_LONG_STRING;
  593.         dbz_incore(FALSE);
  594.     }
  595.     else {
  596.         buffer_size = 20 * VERY_LONG_STRING;
  597.         dbz_incore(TRUE);
  598.     }
  599.  
  600.     if ((in = fopen(inputname,"r")) == NULL) {
  601.         if ( textwarn )
  602.         {
  603.             sprintf(msg_buff, catgets(elm_msg_cat,
  604.                 NewaliasSet, NewaliasNoOpenIn,
  605.                 "Couldn't open %s for input!"), inputname);
  606.             error(msg_buff);
  607.         }
  608.         free(buffer);
  609.         return(-1);
  610.     }
  611.  
  612.     if ((aliases_hash = dbz_fresh(dataname, 4999, 0, 0)) == NULL) {
  613.         MCsprintf(msg_buff, catgets(elm_msg_cat,
  614.                 NewaliasSet, NewaliasNoOpendbz,
  615.             "Couldn't open %s.pag or %s.dir for output!"),
  616.             dataname, dataname);
  617.         error(msg_buff);
  618.         free(buffer);
  619.         return(-1);
  620.     }
  621.  
  622.     if ((data = fopen(dataname, "w")) == NULL) {
  623.         sprintf(msg_buff, catgets(elm_msg_cat,
  624.                 NewaliasSet, NewaliasNoOpenOut,
  625.                 "Couldn't open %s for output!"), dataname);
  626.         error(msg_buff);
  627.         free(buffer);
  628.         return(-1);
  629.     }
  630.  
  631.     buff_loaded = 0;     /* file buffer empty right now! */
  632.     al_count = 0;
  633.     err_flag = 0;
  634.  
  635.     while (get_alias(in, fromelm) != -1) {
  636.         put_alias(data);
  637.         if (err_flag) break;
  638.     }
  639.  
  640.     if (err_flag) {
  641.         if (fromelm) sleep(2);
  642.         error(catgets(elm_msg_cat, NewaliasSet, NewaliasNoSave,
  643.                 "** Not saving tables!  Please fix and re-run!"));
  644.         free(buffer);
  645.         return(-1);
  646.     }
  647.     else {
  648.         dbz_close(aliases_hash);
  649.         fclose(data);
  650.         fclose(in);
  651.         free(buffer);
  652.     
  653.         if (al_count == 0) {
  654.             delete_alias_files(dataname, fromelm);
  655.         }
  656.  
  657.         return(al_count);
  658.     }
  659.     /*NOTREACHED*/
  660. }
  661.  
  662. delete_alias_files(dataname, fromelm)
  663. char *dataname;
  664. int fromelm;
  665. {
  666. /*
  667.  *    This routine remove all the alias hash and data files.
  668.  *    This is called from do_newalias() when there are no user
  669.  *    aliases to be kept.
  670.  */
  671.  
  672.     char fname[SLEN];
  673.  
  674.     if (unlink(dataname)) {
  675.       sprintf(msg_buff,
  676.         catgets(elm_msg_cat, NewaliasSet, NewaliasCouldntDeleteData,
  677.         "Could not delete alias data file %s!"), fname);
  678.       error(msg_buff);
  679.       if (fromelm) sleep(2);
  680.     }
  681.  
  682.     sprintf(fname,"%s.dir", dataname);
  683.     if (unlink(fname)) {
  684.       sprintf(msg_buff,
  685.         catgets(elm_msg_cat, NewaliasSet, NewaliasCouldntDeleteHash,
  686.         "Could not delete alias hash file %s!"), fname);
  687.       error(msg_buff);
  688.       if (fromelm) sleep(2);
  689.     }
  690.  
  691.     sprintf(fname,"%s.pag", dataname);
  692.     if (unlink(fname)) {
  693.       sprintf(msg_buff,
  694.         catgets(elm_msg_cat, NewaliasSet, NewaliasCouldntDeleteHash,
  695.         "Could not delete alias hash file %s!"), fname);
  696.       error(msg_buff);
  697.       if (fromelm) sleep(2);
  698.     }
  699.  
  700. }
  701.  
  702.