home *** CD-ROM | disk | FTP | other *** search
/ HAM Radio 1 / HamRadio.cdr / misc / src0131 / files.c < prev    next >
C/C++ Source or Header  |  1991-01-27  |  7KB  |  155 lines

  1. /* System-dependent definitions of various files, spool directories, etc */
  2. #include "global.h"
  3. #include "files.h"
  4.  
  5. #ifdef    MSDOS
  6. char *Startup = "/autoexec.net";    /* Initialization file */
  7. char *Userfile = "/ftpusers";    /* Authorized FTP users and passwords */
  8. char *Maillog = "/spool/mail.log";    /* mail log */
  9. char *Mailspool = "/spool/mail";    /* Incoming mail */
  10. char *Mailqdir = "/spool/mqueue";        /* Outgoing mail spool */
  11. char *Mailqueue = "/spool/mqueue/*.wrk";    /* Outgoing mail work files */
  12. char *Routeqdir = "/spool/rqueue";        /* queue for router */
  13. char *Alias = "/alias";        /* the alias file */
  14. char *Dfile = "/domain.txt";    /* Domain cache */
  15. char *Fdir = "/finger";        /* Finger info directory */
  16. char *Arealist = "/spool/areas";/* List of message areas */
  17. char *Helpdir = "/spool/help";    /* Mailbox help file directory */
  18. char *Rewritefile = "/spool/rewrite"; /* Address rewrite file */
  19. char *Newsdir = "/spool/news";        /* News messages and NNTP data */
  20. char *Signature = "/spool/signatur"; /* Mail signature file directory */
  21. char *Forwardfile = "/spool/forward.bbs"; /* Mail forwarding file */
  22. char *Historyfile = "/spool/history"; /* Message ID history file */
  23. char *PPPhosts = "/ppphosts";    /* peer ID to IP address lookup table */
  24. char Eol[] = "\r\n";
  25. #define    SEPARATOR    "/"
  26. #endif
  27.  
  28. #ifdef    UNIX
  29. char *Startup = "./startup.net";    /* Initialization file */
  30. char *Config = "./config.net";    /* Device configuration list */
  31. char *Userfile = "./ftpusers";
  32. char *Mailspool = "./mail";
  33. char *Maillog = "./mail.log";    /* mail log */
  34. char *Mailqdir = "./mqueue";
  35. char *Mailqueue = "./mqueue/*.wrk";
  36. char *Routeqdir = "./rqueue";        /* queue for router */
  37. char *Alias = "./alias";    /* the alias file */
  38. char *Dfile = "./domain.txt";    /* Domain cache */
  39. char *Fdir = "./finger";        /* Finger info directory */
  40. char *Arealist = "./areas";        /* List of message areas */
  41. char *Helpdir = "./help";    /* Mailbox help file directory */
  42. char *Rewritefile = "./rewrite"; /* Address rewrite file */
  43. char *Newsdir = "./news";        /* News messages and NNTP data */
  44. char *Signature = "./signatur"; /* Mail signature file directory */
  45. char *Forwardfile = "./forward.bbs"; /* Mail forwarding file */
  46. char *Historyfile = "./history"; /* Message ID history file */
  47. char *PPPhosts = "./ppphosts";    /* peer ID to IP address lookup table */
  48. #define    SEPARATOR    "/"
  49. char Eol[] = "\n";
  50. #endif
  51.  
  52. #ifdef    AMIGA
  53. char *Startup = "TCPIP:net-startup";
  54. char *Config = "TCPIP:config.net";    /* Device configuration list */
  55. char *Userfile = "TCPIP:ftpusers";
  56. char *Mailspool = "TCPIP:spool/mail";
  57. char *Maillog = "TCPIP:spool/mail.log";
  58. char *Mailqdir = "TCPIP:spool/mqueue";
  59. char *Mailqueue = "TCPIP:spool/mqueue/#?.wrk";
  60. char *Routeqdir = "TCPIP:spool/rqueue";        /* queue for router */
  61. char *Alias = "TCPIP:alias";    /* the alias file */
  62. char *Dfile = "TCPIP:domain.txt";    /* Domain cache */
  63. char *Fdir = "TCPIP:finger";        /* Finger info directory */
  64. char *Arealist = "TCPIP:spool/areas";    /* List of message areas */
  65. char *Helpdir = "TCPIP:spool/help";    /* Mailbox help file directory */
  66. char *Rewritefile = "TCPIP:spool/rewrite"; /* Address rewrite file */
  67. char *Newsdir = "TCPIP:spool/news";    /* News messages and NNTP data */
  68. char *Signature = "TCPIP:spool/signatur"; /* Mail signature file directory */
  69. char *Forwardfile = "TCPIP:spool/forward.bbs"; /* Mail forwarding file */
  70. char *Historyfile = "TCPIP:spool/history"; /* Message ID history file */
  71. char *PPPhosts = "TCPIP:ppphosts";    /* peer ID to IP address lookup table */
  72. #define    SEPARATOR    "/"
  73. char Eol[] = "\r\n";
  74. #endif
  75.  
  76. #ifdef    MAC
  77. char *Startup ="Mikes Hard Disk:net.start";
  78. char *Config = "Mikes Hard Disk:config.net";    /* Device configuration list */
  79. char *Userfile = "Mikes Hard Disk:ftpusers";
  80. char *Mailspool = "Mikes Hard Disk:spool:mail:";
  81. char *Maillog = "Mikes Hard Disk:spool:mail.log:";
  82. char *Mailqdir = "Mikes Hard Disk:spool:mqueue:";
  83. char *Mailqueue = "Mikes Hard Disk:spool:mqueue:*.wrk";
  84. char *Routeqdir = "Mikes Hard Disk:spool/rqueue:";    /* queue for router */
  85. char *Alias = "Mikes Hard Disk:alias";    /* the alias file */
  86. char *Dfile = "Mikes Hard Disk:domain:txt";    /* Domain cache */
  87. char *Fdir = "Mikes Hard Disk:finger";        /* Finger info directory */
  88. char *Arealist = "Mikes Hard Disk:spool/areas";    /* List of message areas */
  89. char *Helpdir = "Mikes Hard Disk:spool/help"; /* Mailbox help file directory */
  90. char *Rewritefile = "Mikes Hard Disk:spool/rewrite"; /* Address rewrite file */
  91. char *Newsdir = "Mikes Hard Disk:spool/news"; /* News messages and NNTP data */
  92. char *Signature = "Mikes Hard Disk:spool/signatur"; /* Mail signature file directory */
  93. char *Forwardfile = "Mikes Hard Disk:spool/forward.bbs"; /* Mail forwarding file */
  94. char *Historyfile = "Mikes Hard Disk:spool/history"; /* Message ID history file */
  95. char *PPPhosts = "Mikes Hard Disk:ppphosts";    /* peer ID to IP address lookup table */
  96. #define    SEPARATOR    ":"
  97. char Eol[] = "\r";
  98. #endif
  99.  
  100. static char *strcatdup __ARGS((char *a,char *b,char *c));
  101.  
  102. /* Establish a root directory other than the default. Can only be called
  103.  * once, at startup time
  104.  */
  105. void
  106. initroot(root)
  107. char *root;
  108. {
  109.     Startup = strcatdup(root,SEPARATOR,Startup);
  110.     Userfile = strcatdup(root,SEPARATOR,Userfile);
  111.     Maillog = strcatdup(root,SEPARATOR,Maillog);
  112.     Mailspool = strcatdup(root,SEPARATOR,Mailspool);
  113.     Mailqdir = strcatdup(root,SEPARATOR,Mailqdir);
  114.     Mailqueue = strcatdup(root,SEPARATOR,Mailqueue);
  115.     Routeqdir = strcatdup(root,SEPARATOR,Routeqdir);
  116.     Alias = strcatdup(root,SEPARATOR,Alias);
  117.     Dfile = strcatdup(root,SEPARATOR,Dfile);
  118.     Fdir = strcatdup(root,SEPARATOR,Fdir);
  119.     Arealist = strcatdup(root,SEPARATOR,Arealist);
  120.     Helpdir = strcatdup(root,SEPARATOR,Helpdir);
  121.     Rewritefile = strcatdup(root,SEPARATOR,Rewritefile);
  122.     Newsdir = strcatdup(root,SEPARATOR,Newsdir);
  123.     Signature = strcatdup(root,SEPARATOR,Signature);
  124.     Forwardfile = strcatdup(root,SEPARATOR,Forwardfile);
  125.     Historyfile = strcatdup(root,SEPARATOR,Historyfile);
  126.     PPPhosts = strcatdup(root,SEPARATOR,PPPhosts);
  127. }
  128.  
  129. /* Concatenate root, separator and arg strings into a malloc'ed output
  130.  * buffer, then remove repeated occurrences of the separator char
  131.  */
  132. static char *
  133. strcatdup(a,b,c)
  134. char *a,*b,*c;
  135. {
  136.     char *out,*p1,*p2;
  137.  
  138.     out = mallocw(strlen(a) + strlen(b) + strlen(c) + 1);
  139.     strcpy(out,a);
  140.     strcat(out,b);
  141.     strcat(out,c);
  142.     if(*b != '\0'){
  143.         /* Remove any repeated occurrences of the separator char */
  144.         p1 = p2 = out;
  145.         while(*p2 != '\0'){
  146.             *p1++ = *p2++;
  147.             while(p2[0] == p2[-1] && p2[0] == b[0])
  148.                 p2++;
  149.         }
  150.         *p1 = '\0';
  151.     }
  152.     return out;
  153. }
  154.  
  155.