home *** CD-ROM | disk | FTP | other *** search
/ Beijing Paradise BBS Backup / PARADISE.ISO / software / BBSDOORW / SMAILSRC.ZIP / SMAIL.ZIP / MSDOS.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-05-05  |  1.7 KB  |  80 lines

  1. /*
  2.  *      msdos.c: MS-DOS specific functions for smail 2.5
  3.  *
  4.  *      Stephen Trier
  5.  *      March 26, 1990
  6.  *
  7.  *      This file is in the public domain.
  8.  *
  9.  */
  10.  
  11. /*
  12.  *      This is where the UUPC dependencies come out of the woodwork.
  13.  */
  14.  
  15. #include <stdio.h>
  16. #include <string.h>
  17. #include <stdlib.h>
  18. #include <pwd.h>
  19. #include "config.h"
  20.  
  21. char *ms_hostname = "host",
  22.      *ms_hostdomain = "host.domain",
  23.      *ms_smarthost = "smart-host",
  24.      *ms_alias = "/usr/lib/aliases",
  25.      *ms_fullnames = "/usr/lib/fullnames",
  26.      *ms_paths = "/usr/lib/uucp/paths",
  27.      *ms_username = "noone",
  28.      *ms_logfile = "/usr/spool/uucp/mail.log",
  29.      *ms_passwd = NULL,
  30.      *ms_lmail = "lmail",
  31.      *ms_tmpdir = NULL;
  32.  
  33. static struct table_entry table[] = {
  34.     "nodename", &ms_hostname,
  35.     "domain", &ms_hostdomain,
  36.     "mailserv", &ms_smarthost,
  37.     "aliases", &ms_alias,
  38.     "fullnames", &ms_fullnames,
  39.     "paths", &ms_paths,
  40.     "mailbox", &ms_username,
  41.     "smaillog", &ms_logfile,
  42.     "passwd", &ms_passwd,
  43.     "localmail", &ms_lmail,
  44.     "tempdir", &ms_tmpdir,
  45.     NULL
  46.     } ;
  47.  
  48. extern char *pathfile, *aliasfile, *fnlist;  /* Imported from main.c */
  49.  
  50. void config(void)
  51. {
  52.     ms_config(table);
  53.  
  54.     pw_openfile(ms_passwd);  /* Defaults to NULL, default file. */
  55.     pathfile = ms_paths;
  56.     aliasfile = ms_alias;
  57.     fnlist = ms_fullnames;
  58.     if (ms_tmpdir == NULL)
  59.     if ((ms_tmpdir = getenv("TMP")) == NULL)
  60.         if ((ms_tmpdir = getenv("TMPDIR")) == NULL)
  61.         ms_tmpdir = "/tmp";
  62. }
  63.  
  64.  
  65. /*
  66.  *      getuid:  Look up uupc.rc username in password file and return uid
  67.  */
  68.  
  69. int getuid(void)
  70. {
  71.     struct passwd *pwbuf;
  72.  
  73.     pwbuf = getpwnam(ms_username);
  74.     if (pwbuf)
  75.     return pwbuf->pw_uid;
  76.     else
  77.     return -1;
  78. }
  79.  
  80.