static char SccsId
[] = "@(#)conf.c 1.4 %G%";
** CONF.C -- Delivermail Configuration Tables.
** Defines the configuration of this installation.
** The first table describes available mailers. This is
** just a list of argument vectors, with the following
** $u -- insert the user name.
** $h -- insert the host name.
** $f -- insert the from person name.
** $c -- insert the hop count.
** This stuff is interpreted in buildmail. There are two
** important conventions here: entry zero must be the
** local mailer & entry one must be the shell.
** The second table gives a list of special characters. This
** table is scanned linearly by parse() until an entry is
** found using one of the magic characters. Other fields
** give more information on how to handle it.
** M_* -- indices into Mailer, used only in this module.
** Mailer -- the mailer descriptor table.
** ParseTab -- the parse table.
** 3/5/80 -- Generalized to use <whoami.h>.
** 12/26/79 -- written for Ingres 11/70.
static char *BerkLocal
[] = { "i", "ingres", "ing70", NULL
};
char *MyLocNam
= "Ing70";
static char *BerkLocal
[] = { "j", "ingvax", NULL
};
char *MyLocNam
= "IngVax";
static char *BerkLocal
[] = { "v", "csvax", "vax", NULL
};
char *MyLocNam
= "CSVax";
static char *BerkLocal
[] = { "y", "cory", NULL
};
static char *BerkLocal
[] = { "m", "image", NULL
};
char *MyLocNam
= "Image";
static char *BerkLocal
[] = { "o", "esvax", NULL
};
char *MyLocNam
= "ESVax";
static char *BerkLocal
[] = { "z", "eecs40", NULL
};
char *MyLocNam
= "EECS40";
/* local mail -- must be #0 */
M_ROPT
|M_NOHOST
|M_STRIPQ
, EX_NOUSER
, NULL
,
{ "...local%mail", "-d", "$u", NULL
}
/* pipes through programs -- must be #1 */
M_HDR
|M_NOHOST
, EX_UNAVAIL
, NULL
,
{ "...prog%mail", "-fc", "$u", NULL
}
/* local berkeley mail */
"/usr/net/bin/sendberkmail",
M_FOPT
|M_HDR
|M_STRIPQ
, EX_UNAVAIL
, BerkLocal
,
{ "...berk%mail", "-m", "$h", "-t", "$u", "-h", "$c", NULL
}
{ "...arpa%mail", "$f", "$h", "$u", NULL
}
/* uucp mail (cheat & use Bell's v7 mail) */
M_ROPT
|M_NOHOST
|M_STRIPQ
, EX_NOUSER
, NULL
,
{ "...uucp%mail", "$h!$u", NULL
}
{ "...uucp%mail", "-d", "$h!$u", NULL
}
struct parsetab ParseTab
[] =
':', M_BERK
, P_ONE
, NULL
,
'@', M_ARPA
, P_HLAST
|P_USR_UPPER
, NULL
,
'@', M_BERK
, P_HLAST
|P_USR_UPPER
|P_MOVE
, "ing70",
'!', M_BERK
, P_MOVE
, "csvax",
'.', -1, P_MAP
|P_ONE
, ":",
'\0', M_LOCAL
, P_MOVE
, "",
** GETNAME -- Get the current users login name.
** This is in config.c because it is somewhat machine dependent.
** Examine it carefully for your installation.
** See if the person is logged in. If so, return
** the name s/he is logged in as.
** Look up the user id in /etc/passwd. If found,
** The login name of this user.
** NULL if this person is noone.
register struct passwd
*w
;
extern struct passwd
*getpwuid();
if (p
!= NULL
&& p
[0] != '\0')
w
= getpwuid(getuid() & 0377);
strcpy(namebuf
, w
->pw_name
);
** TTYPATH -- Get the path of the user's tty -- Version 6 version.
** Returns the pathname of the user's tty. Returns NULL if
** the user is not logged in or if s/he has write permission
** pathname of the user's tty.
** NULL if not logged in or write permission denied.
** Return value is in a local buffer.
static char pathn
[] = "/dev/ttyx";
/* compute the pathname of the controlling tty */
if ((i
= ttyn(2)) == 'x' && (i
= ttyn(1)) == 'x' && (i
= ttyn(0)) == 'x')
/* see if we have write permission */
if (stat(pathn
, &stbuf
) < 0 || !flagset(02, stbuf
.st_mode
))
/* see if the user is logged in */
** FDOPEN -- Open a stdio file given an open file descriptor.
** This is included here because it is standard in v7, but we
** Open /dev/null to create a descriptor.
** Close that descriptor.
** Copy the existing fd into the descriptor.
** fd -- the open file descriptor.
** type -- "r", "w", or whatever.
** The file descriptor it creates.
** The mode of fd must match "type".
f
= fopen("/dev/null", type
);
** INDEX -- Return pointer to character in string
** s -- a string to scan.
** c -- a character to look for.
** If c is in s, returns the address of the first
** NULL if c is not in s.
** TTYPATH -- Get the path of the user's tty -- Version 7 version.
** Returns the pathname of the user's tty. Returns NULL if
** the user is not logged in or if s/he has write permission
** pathname of the user's tty.
** NULL if not logged in or write permission denied.
** Return value is in a local buffer.
/* compute the pathname of the controlling tty */
if ((pathn
= ttyname(2)) == NULL
&& (pathn
= ttyname(1)) == NULL
&& (pathn
= ttyname(0)) == NULL
)
/* see if we have write permission */
if (stat(pathn
, &stbuf
) < 0 || !flagset(02, stbuf
.st_mode
))
/* see if the user is logged in */