home *** CD-ROM | disk | FTP | other *** search
/ Super Net 1 / SUPERNET_1.iso / PC / OTROS / EXTRAS / UUCODE / UUPC / TEST / UPC12ES1.ZIP / LIB / mkmbox.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-10-11  |  3.3 KB  |  93 lines

  1. /*--------------------------------------------------------------------*/
  2. /*    m k m b o x . c                                                 */
  3. /*--------------------------------------------------------------------*/
  4.  
  5. /*--------------------------------------------------------------------*/
  6. /*    Changes Copyright (c) 1990-1993 by Kendra Electronic            */
  7. /*    Wonderworks.                                                    */
  8. /*                                                                    */
  9. /*    All rights reserved except those explicitly granted by the      */
  10. /*    UUPC/extended license agreement.                                */
  11. /*--------------------------------------------------------------------*/
  12.  
  13. /*--------------------------------------------------------------------*/
  14. /*                          RCS Information                           */
  15. /*--------------------------------------------------------------------*/
  16.  
  17. /*
  18.  *    $Id: mkmbox.c 1.3 1993/10/12 00:46:16 ahd Exp $
  19.  *
  20.  *    Revision history:
  21.  *    $Log: mkmbox.c $
  22.  *     Revision 1.3  1993/10/12  00:46:16  ahd
  23.  *     Normalize comments
  24.  *
  25.  *     Revision 1.2  1993/07/13  01:13:32  ahd
  26.  *     Limit directory names for users to eight characters
  27.  *
  28.  *
  29.  *       21Nov1991 Break out of hlib.c                         ahd
  30.  */
  31.  
  32. #include <stdio.h>
  33. #include <stdlib.h>
  34. #include <string.h>
  35. #include <time.h>
  36.  
  37. /*--------------------------------------------------------------------*/
  38. /*                    UUPC/extended include files                     */
  39. /*--------------------------------------------------------------------*/
  40.  
  41. #include "lib.h"
  42. #include "hlib.h"
  43.  
  44. /*--------------------------------------------------------------------*/
  45. /*                          Global variables                          */
  46. /*--------------------------------------------------------------------*/
  47.  
  48. currentfile();
  49.  
  50. /*--------------------------------------------------------------------*/
  51. /*    m k m a i l b o x                                               */
  52. /*                                                                    */
  53. /*    Build a mailbox name                                            */
  54. /*--------------------------------------------------------------------*/
  55.  
  56. char *mkmailbox(char *buf, const char *userid)
  57. {
  58.    boolean append = ( E_mailext != NULL );
  59.  
  60.    if (buf == NULL)           /* Do we need to allocate buffer?       */
  61.    {
  62.       buf = malloc( FILENAME_MAX );
  63.       checkref(buf);
  64.    } /* if */
  65.  
  66.    if (bflag[F_DIRECT])
  67.    {
  68.       sprintf(buf,"%s%c%.8s%c%s", E_maildir, SEPCHAR,
  69.                                userid, SEPCHAR,"newmail");
  70.    } /* if (bflag[F_DIRECT]) */
  71.    else {
  72.       char tuser[FILENAME_MAX];
  73.       strcpy( tuser, userid );
  74.  
  75.       if (strchr(userid, '.') == NULL )
  76.          tuser[8] = '\0';        /* Auto-truncate mbox name           */
  77.       else
  78.          append = FALSE;
  79.  
  80.       mkfilename(buf, E_maildir, tuser);
  81.    } /* else */
  82.  
  83. /*--------------------------------------------------------------------*/
  84. /*              If we need a mailbox extension, add one               */
  85. /*--------------------------------------------------------------------*/
  86.  
  87.    if ( append )
  88.       strcat( strcat(buf,".") , E_mailext );
  89.  
  90.    return buf;
  91.  
  92. } /* mkmailbox */
  93.