X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=sbr%2Fmts.c;h=3313aef235f6b95502d3178c9bccc4848a96aef2;hp=55c0f0237602757ef3df6583dfc2f3b3a5d0d9f8;hb=714b5c530ece27ea2835a313013f5b770163403c;hpb=ced6090a330d3d83d0bce709f756aa3d7d65fea4 diff --git a/sbr/mts.c b/sbr/mts.c index 55c0f02..3313aef 100644 --- a/sbr/mts.c +++ b/sbr/mts.c @@ -28,11 +28,11 @@ /* ** 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 @@ -109,25 +109,25 @@ static struct bind binds[] = { */ 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; @@ -148,7 +148,7 @@ mts_init (char *name) */ static char * -tailor_value (unsigned char *s) +tailor_value(unsigned char *s) { int i, r; char *bp; @@ -171,24 +171,24 @@ tailor_value (unsigned char *s) 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; } @@ -198,7 +198,7 @@ tailor_value (unsigned char *s) */ char * -LocalName (void) +LocalName(void) { static char buffer[BUFSIZ] = ""; struct addrinfo hints, *res; @@ -210,16 +210,16 @@ LocalName (void) 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 */ @@ -241,7 +241,7 @@ LocalName (void) */ char * -SystemName (void) +SystemName(void) { static char buffer[BUFSIZ] = ""; @@ -253,13 +253,13 @@ SystemName (void) 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; @@ -271,7 +271,7 @@ SystemName (void) */ char * -getusername (void) +getusername(void) { if (username[0] == '\0') getuserinfo(); @@ -286,7 +286,7 @@ getusername (void) */ char * -getfullname (void) +getfullname(void) { if (username[0] == '\0') getuserinfo(); @@ -302,18 +302,18 @@ getfullname (void) */ 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; } @@ -359,7 +359,7 @@ getuserinfo (void) 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++; @@ -379,7 +379,7 @@ getuserinfo (void) */ 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++; @@ -406,30 +406,30 @@ getuserinfo (void) *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; } @@ -437,9 +437,9 @@ get_mtsconf_pathname (void) } 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; } @@ -447,13 +447,13 @@ get_mtsuserconf_pathname (void) } 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; @@ -462,13 +462,13 @@ mts_read_conf_file (FILE *fp) 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; } }