#include <h/mh.h> /* for snprintf() */
#include <h/nmh.h>
#include <h/utils.h>
-
-#define nmhetcdir(file) NMHETCDIR#file
-
#include <ctype.h>
#include <stdio.h>
#include <h/mts.h>
/*
** static prototypes
*/
-static char *tailor_value (unsigned char *);
-static void getuserinfo (void);
+static char *tailor_value(unsigned char *);
+static void getuserinfo(void);
static const char *get_mtsconf_pathname(void);
static const char *get_mtsuserconf_pathname(void);
-static void mts_read_conf_file (FILE *fp);
+static void mts_read_conf_file(FILE *fp);
/*
** *mmdfldir and *uucpldir are the maildrop directories. If maildrops
/*
** nmh mail transport interface customization file
*/
-static char *mtsconf = nmhetcdir(/mts.conf);
+static char *mtsconf = NMHETCDIR"/mts.conf";
char *mmdfldir = MAILSPOOL;
char *mmdflfil = "";
/*
** Global MailDelivery file
*/
-char *maildelivery = nmhetcdir(/maildelivery);
+char *maildelivery = NMHETCDIR"/maildelivery";
/*
*/
void
-mts_init (char *name)
+mts_init(char *name)
{
const char *cp;
FILE *fp;
static int inited = 0;
- if (inited++ || (fp = fopen (get_mtsconf_pathname(), "r")) == NULL)
+ if (inited++ || (fp = fopen(get_mtsconf_pathname(), "r")) == NULL)
return;
mts_read_conf_file(fp);
- fclose (fp);
+ fclose(fp);
cp = get_mtsuserconf_pathname();
if (cp != NULL &&
- ((fp = fopen (get_mtsuserconf_pathname(), "r")) != NULL)) {
+ ((fp = fopen(get_mtsuserconf_pathname(), "r")) != NULL)) {
mts_read_conf_file(fp);
- fclose (fp);
+ fclose(fp);
}
- Everyone = atoi (everyone);
+ Everyone = atoi(everyone);
if (strstr(masquerade, "draft_from") != NULL)
draft_from_masquerading = TRUE;
*/
static char *
-tailor_value (unsigned char *s)
+tailor_value(unsigned char *s)
{
int i, r;
char *bp;
break;
default:
- if (!isdigit (*s)) {
+ if (!isdigit(*s)) {
*bp++ = QUOTE;
*bp = *s;
}
r = *s != '0' ? 10 : 8;
- for (i = 0; isdigit (*s); s++)
+ for (i = 0; isdigit(*s); s++)
i = i * r + *s - '0';
s--;
- *bp = toascii (i);
+ *bp = toascii(i);
break;
}
}
}
*bp = 0;
- len = strlen (buffer) + 1;
- bp = mh_xmalloc (len);
- memcpy (bp, buffer, len);
+ len = strlen(buffer) + 1;
+ bp = mh_xmalloc(len);
+ memcpy(bp, buffer, len);
return bp;
}
*/
char *
-LocalName (void)
+LocalName(void)
{
static char buffer[BUFSIZ] = "";
struct addrinfo hints, *res;
if (buffer[0])
return buffer;
- mts_init ("mts");
+ mts_init("mts");
memset(buffer, 0, sizeof(buffer));
#ifdef HAVE_UNAME
/* first get our local name */
- uname (&name);
- strncpy (buffer, name.nodename, sizeof(buffer) - 1);
+ uname(&name);
+ strncpy(buffer, name.nodename, sizeof(buffer) - 1);
#else
/* first get our local name */
- gethostname (buffer, sizeof(buffer) - 1);
+ gethostname(buffer, sizeof(buffer) - 1);
#endif
/* now fully qualify our name */
*/
char *
-SystemName (void)
+SystemName(void)
{
static char buffer[BUFSIZ] = "";
if (buffer[0])
return buffer;
- mts_init ("mts");
+ mts_init("mts");
#ifdef HAVE_UNAME
- uname (&name);
- strncpy (buffer, name.nodename, sizeof(buffer));
+ uname(&name);
+ strncpy(buffer, name.nodename, sizeof(buffer));
#else
- gethostname (buffer, sizeof(buffer));
+ gethostname(buffer, sizeof(buffer));
#endif
return buffer;
*/
char *
-getusername (void)
+getusername(void)
{
if (username[0] == '\0')
getuserinfo();
*/
char *
-getfullname (void)
+getfullname(void)
{
if (username[0] == '\0')
getuserinfo();
*/
static void
-getuserinfo (void)
+getuserinfo(void)
{
register unsigned char *cp;
register char *np;
register struct passwd *pw;
- if ((pw = getpwuid (getuid ())) == NULL
+ if ((pw = getpwuid(getuid())) == NULL
|| pw->pw_name == NULL
|| *pw->pw_name == '\0') {
- strncpy (username, "unknown", sizeof(username));
- snprintf (fullname, sizeof(fullname), "The Unknown User-ID (%d)",
- (int) getuid ());
+ strncpy(username, "unknown", sizeof(username));
+ snprintf(fullname, sizeof(fullname), "The Unknown User-ID (%d)",
+ (int) getuid());
return;
}
for (cp = fullname;
*np != '\0' && *np != ',' && *np != '<';) {
if (*np == '&') { /* blech! */
- strcpy (cp, pw->pw_name);
+ strcpy(cp, pw->pw_name);
*cp = toupper(*cp);
while (*cp)
cp++;
*/
for (cp = fullname; *np != '\0' && *np != ',';) {
if (*np == '&') { /* blech! */
- strcpy (cp, pw->pw_name);
+ strcpy(cp, pw->pw_name);
*cp = toupper(*cp);
while (*cp)
cp++;
*cp = '\0';
}
if (!mmailid_masquerading || *np == '\0')
- strncpy (username, pw->pw_name, sizeof(username));
+ strncpy(username, pw->pw_name, sizeof(username));
/*
** The $SIGNATURE environment variable overrides the GECOS field's
** idea of your real name.
*/
- if ((cp = getenv ("SIGNATURE")) && *cp)
- strncpy (fullname, cp, sizeof(fullname));
+ if ((cp = getenv("SIGNATURE")) && *cp)
+ strncpy(fullname, cp, sizeof(fullname));
if (strchr(fullname, '.')) { /* quote any .'s */
char tmp[BUFSIZ];
/* should quote "'s too */
- snprintf (tmp, sizeof(tmp), "\"%s\"", fullname);
- strncpy (fullname, tmp, sizeof(fullname));
+ snprintf(tmp, sizeof(tmp), "\"%s\"", fullname);
+ strncpy(fullname, tmp, sizeof(fullname));
}
return;
}
static const char*
-get_mtsconf_pathname (void)
+get_mtsconf_pathname(void)
{
- const char *cp = getenv ( "MHMTSCONF ");
+ const char *cp = getenv( "MHMTSCONF ");
if (cp != NULL && *cp != '\0') {
return cp;
}
}
static const char*
-get_mtsuserconf_pathname (void)
+get_mtsuserconf_pathname(void)
{
- const char *cp = getenv ( "MHMTSUSERCONF" );
+ const char *cp = getenv( "MHMTSUSERCONF" );
if (cp != NULL && *cp != '\0') {
return cp;
}
}
static void
-mts_read_conf_file (FILE *fp)
+mts_read_conf_file(FILE *fp)
{
unsigned char *bp;
char *cp, buffer[BUFSIZ];
struct bind *b;
- while (fgets (buffer, sizeof(buffer), fp)) {
+ while (fgets(buffer, sizeof(buffer), fp)) {
if (!(cp = strchr(buffer, '\n')))
break;
*cp = 0;
if (!(bp = strchr(buffer, ':')))
break;
*bp++ = 0;
- while (isspace (*bp))
+ while (isspace(*bp))
*bp++ = 0;
for (b = binds; b->keyword; b++)
- if (!strcmp (buffer, b->keyword))
+ if (!strcmp(buffer, b->keyword))
break;
- if (b->keyword && (cp = tailor_value (bp)))
+ if (b->keyword && (cp = tailor_value(bp)))
*b->value = cp;
}
}