home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / dos / communic / pcmail / main / path.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-06-05  |  5.3 KB  |  164 lines

  1. /*++
  2. /* NAME
  3. /*    path
  4. /* SUMMARY
  5. /*    system-dependent file name definitions
  6. /* PROJECT
  7. /*    pc-mail
  8. /* PACKAGE
  9. /*    general
  10. /* SYNOPSIS
  11. /*    #include "path.h"
  12. /* DESCRIPTION
  13. /*    File-system dependent definitions should be changed here.
  14. /* .nf
  15.  
  16.  /* the minmal number of open files we think we need */
  17.  
  18. #define    MINFILES    10
  19.  
  20.  /* system-dependent defaults */
  21.  
  22. #ifdef    unix
  23. #define    THISDIR        "."        /* current directory */
  24. #define    PATHSEP        "/"        /* path-element separator */
  25. #define    DEFSPOOL    "./spool"    /* default spool directory */
  26. #define    DEFEDIT        "vi"        /* default editor */
  27. #ifdef SIII
  28. #define    DEFPRINT    "lp"        /* printer spooler */
  29. #else
  30. #define    DEFPRINT    "lpr"        /* printer spooler */
  31. #endif
  32. #define    MAILFILE    "mail.msg"    /* temporary message file */
  33. #define    TMPALIAS    "tmp.alias"    /* temp alias file */
  34. #define    NULLDEV        "/dev/null"    /* bit dump */
  35. #endif
  36.  
  37. #ifdef    MSDOS
  38. #define    THISDIR        "."        /* current directory */
  39. #define    PATHSEP        "\\"        /* path-element separator */
  40. #define    DEFSPOOL    "\\spool"    /* spool directory */
  41. #define    DEFEDIT        "edlin"        /* default editor */
  42. #define DEFPRINT    "PRN"        /* default printer */
  43. #define    MAILFILE    "mail.msg"    /* temp message file */
  44. #define    TMPALIAS    "alias.tmp"    /* temp alias file */
  45. #define    NULLDEV        "NUL"        /* bit dump */
  46. #endif
  47.  
  48.  /* system-dependent function calls for file & printer access */
  49.  
  50. #ifdef unix
  51. #define    propen()    popen(mailprn,"w")    /* open print stream */
  52. #define    prclose(p)    pclose(p)    /* close print stream */
  53. #define    fspool(file)    strcons("%s/%s",maildir,file)
  54. #endif
  55.  
  56. #ifdef MSDOS
  57. #define    propen()    fopen(mailprn,"a")    /* open print stream */
  58. #define    prclose(p)    (putc('\014',p),fclose(p))    /* close print stream */
  59. #define    fspool(file)    strcons("%s\\%s",maildir,file)
  60. #endif
  61.  
  62. #if (!defined(unix)&& !defined(MSDOS))
  63. "Specify here how things should be handled with your compiler"
  64. #endif
  65.  
  66.  /* system-independent file names */
  67.  
  68. #define    SMAIL    "smail"            /* queues a mail message */
  69. #define    CICO    "cico"            /* file transfer program */
  70. #define    NMAIL    "nmail"            /* extract originator address */
  71.  
  72.  /*
  73.   * The spool directory is used for storage of all files manipulated by the
  74.   * mail programs. Message files should always have a meta file with
  75.   * information about the destination or origin of a message file.
  76.   * 
  77.   * Message/meta file names are of the form <letter><sequence number>.
  78.   * Corresponding message/meta files have the same sequene number. The
  79.   * following definitions are for the <letter> part of spool files.
  80.   */
  81.  
  82. #define    LOGFILE        "LOGFILE"    /* transaction logs */
  83. #define    HEADER        "header"    /* template message header */
  84. #define    TRAILER     "trailer"    /* template message trailer */
  85.  
  86. #define    NEW_MESG    'n'        /* received message */
  87. #define    NEW_META    'h'        /* originator of new mail */
  88.  
  89. #define    OLD_MESG    'n'        /* received message */
  90. #define    OLD_META    'o'        /* originator of old mail */
  91.  
  92. #define    OUT_MESG    'd'        /* message ready to be sent */
  93. #define    OUT_META    'x'        /* its destination */
  94.  
  95. #define    SENT_MESG    'q'        /* delivered message */
  96. #define    SENT_META    'r'        /* its destination */
  97.  
  98. #define    WORK_MESG    'e'        /* message being worked on */
  99. #define    WORK_META    'c'        /* its description */
  100.  
  101. #define    SETUP        's'        /* system parameter file */
  102.  
  103. #define    ALIAS        'a'        /* alias data base */
  104.  
  105. #define    SPOOLFMT    "%c%05u"    /* spool-file name format */
  106. #define    NAMELEN        6        /* length of spool file name */
  107.  
  108. unsigned newseqno();            /* generate sequence number */
  109. unsigned seqno();            /* extract seq. nr. from name */
  110.  
  111.  /*
  112.   * The following macros provide convenient access of spool files, so we
  113.   * don't have to remember the spool file name format and prefix stuff.
  114.   */
  115.  
  116. #define    sendmail(file,to)    spoolfil(file,to,OUT_MESG,OUT_META)
  117. #define    workon(fname,meta)    spoolfil(fname,meta,WORK_MESG,WORK_META)
  118.  
  119. #define    parm_file()        fspool(strcons(SPOOLFMT,SETUP,0))
  120. #define    aliases()        fspool(strcons(SPOOLFMT,ALIAS,0))
  121. #define logfile()        fspool(LOGFILE)
  122. #define    header_file()        fspool(HEADER)
  123. #define    trailer_file()        fspool(TRAILER)
  124.  
  125. #define meta_file(type,id)    fspool(strcons(SPOOLFMT,type,id))
  126. #define mesg_file(type,id)    fspool(strcons(SPOOLFMT,type,id))
  127.  
  128. #define    work_meta(id)        fspool(strcons(SPOOLFMT,WORK_META,id))
  129. #define    work_mesg(id)        fspool(strcons(SPOOLFMT,WORK_MESG,id))
  130.  
  131. #define    old_mesg(id)        fspool(strcons(SPOOLFMT,OLD_MESG,id))
  132. #define    old_meta(id)        fspool(strcons(SPOOLFMT,OLD_META,id))
  133.  
  134. #define    new_mesg(id)        fspool(strcons(SPOOLFMT,NEW_MESG,id))
  135. #define    new_meta(id)        fspool(strcons(SPOOLFMT,NEW_META,id))
  136.  
  137. #define    out_mesg(id)        fspool(strcons(SPOOLFMT,OUT_MESG,id))
  138. #define out_meta(id)        fspool(strcons(SPOOLFMT,OUT_META,id))
  139.  
  140. #define    sent_mesg(id)        fspool(strcons(SPOOLFMT,SENT_MESG,id))
  141. #define sent_meta(id)        fspool(strcons(SPOOLFMT,SENT_META,id))
  142.  
  143.  /* stuff taken from the environment */
  144.  
  145. extern char *editor;            /* path to editor */
  146. extern char *maildir;            /* spool directory */
  147. extern char *mailprn;            /* how to print */
  148. extern char *mailcmd;            /* do this on exit */
  149.  
  150. extern int pathinit();            /* get path info from environment */
  151.  
  152. /* AUTHOR(S)
  153. /*    W.Z. Venema
  154. /*    Eindhoven University of Technology
  155. /*    Department of Mathematics and Computer Science
  156. /*    Den Dolech 2, P.O. Box 513, 5600 MB Eindhoven, The Netherlands
  157. /* CREATION DATE
  158. /*    Sun Apr  5 13:23:45 GMT+1:00 1987
  159. /* LAST MODIFICATION
  160. /*    90/01/22 13:02:27
  161. /* VERSION/RELEASE
  162. /*    2.1
  163. /*--*/
  164.