Set the $w macro to the hostname if at all possible to allow generic
authorEric Allman <eric@ucbvax.Berkeley.EDU>
Tue, 18 Jan 1983 13:42:02 +0000 (05:42 -0800)
committerEric Allman <eric@ucbvax.Berkeley.EDU>
Tue, 18 Jan 1983 13:42:02 +0000 (05:42 -0800)
configuration tables.

SCCS-mr: usr.sbin/sendmail/src/main.c 158
SCCS-mr: usr.sbin/sendmail/src/conf.c 158
SCCS-mr: usr.sbin/sendmail/src/version.c 158
SCCS-mr: usr.sbin/sendmail/src/macro.c 158
SCCS-vsn: usr.sbin/sendmail/src/main.c 3.152
SCCS-vsn: usr.sbin/sendmail/src/conf.c 3.66
SCCS-vsn: usr.sbin/sendmail/src/version.c 3.301
SCCS-vsn: usr.sbin/sendmail/src/macro.c 3.19

usr/src/usr.sbin/sendmail/src/conf.c
usr/src/usr.sbin/sendmail/src/macro.c
usr/src/usr.sbin/sendmail/src/main.c
usr/src/usr.sbin/sendmail/src/version.c

index e69268a..4a29564 100644 (file)
@@ -32,7 +32,7 @@
 
 
 
 
 
 
-SCCSID(@(#)conf.c      3.65            %G%);
+SCCSID(@(#)conf.c      3.66            %G%);
 \f/*
 **  Header info table
 **     Final (null) entry contains the flags used for any other field.
 \f/*
 **  Header info table
 **     Final (null) entry contains the flags used for any other field.
@@ -446,3 +446,39 @@ holdsigs()
 rlsesigs()
 {
 }
 rlsesigs()
 {
 }
+\f/*
+**  MYHOSTNAME -- return the name of this host.
+**
+**     Parameters:
+**             none.
+**
+**     Returns:
+**             The name of this host, as best as it can be determined.
+**
+**     Side Effects:
+**             none.
+*/
+
+char *
+myhostname()
+{
+       static char hostbuf[40];
+       register FILE *f;
+
+       hostbuf[0] = '\0';
+#ifdef VMUNIX
+       gethostname(hostbuf, sizeof hostbuf);
+# else VMUNIX
+       f = fopen("/usr/include/whoami", "r");
+       if (f != NULL)
+       {
+               (void) fgets(hostbuf, sizeof hostbuf, f);
+               fixcrlf(hostbuf, TRUE);
+               (void) fclose(f);
+       }
+#endif VMUNIX
+       if (strncmp(hostbuf, "ucb", 3) == 0)
+               return (&hostbuf[3]);
+       else
+               return (hostbuf);
+}
index 88e0f4f..7b83ede 100644 (file)
@@ -1,7 +1,7 @@
 # include "sendmail.h"
 # include "conf.h"
 
 # include "sendmail.h"
 # include "conf.h"
 
-SCCSID(@(#)macro.c     3.18            %G%);
+SCCSID(@(#)macro.c     3.19            %G%);
 
 /*
 **  EXPAND -- macro expand a string using $x escapes.
 
 /*
 **  EXPAND -- macro expand a string using $x escapes.
@@ -172,6 +172,7 @@ expand(s, buf, buflim, e)
 **             $t   the current time in seconds since 1/1/1970
 **             $u   to user
 **             $v   version number of sendmail
 **             $t   the current time in seconds since 1/1/1970
 **             $u   to user
 **             $v   version number of sendmail
+**             $w   our host name (if it can be determined)
 **             $x   signature (full name) of from person
 **             $y   the tty id of our terminal
 **             $z   home directory of to person
 **             $x   signature (full name) of from person
 **             $y   the tty id of our terminal
 **             $z   home directory of to person
index 7601a91..cd9c12f 100644 (file)
@@ -4,7 +4,7 @@
 # include "sendmail.h"
 # include <sys/file.h>
 
 # include "sendmail.h"
 # include <sys/file.h>
 
-SCCSID(@(#)main.c      3.151           %G%);
+SCCSID(@(#)main.c      3.152           %G%);
 
 /*
 **  SENDMAIL -- Post mail to a set of destinations.
 
 /*
 **  SENDMAIL -- Post mail to a set of destinations.
@@ -80,6 +80,7 @@ main(argc, argv)
        extern putheader(), putbody();
        extern ENVELOPE *newenvelope();
        extern intsig();
        extern putheader(), putbody();
        extern ENVELOPE *newenvelope();
        extern intsig();
+       extern char *myhostname();
 
        /*
        **  Check to see if we reentered.
 
        /*
        **  Check to see if we reentered.
@@ -156,6 +157,9 @@ main(argc, argv)
        errno = 0;
        from = NULL;
        initmacros();
        errno = 0;
        from = NULL;
        initmacros();
+       p = myhostname();
+       if (p != NULL && *p != '\0')
+               define('w', p, CurEnv);
 
        /*
        ** Crack argv.
 
        /*
        ** Crack argv.
index 463a63a..87cff1e 100644 (file)
@@ -1,5 +1,5 @@
 # ifndef lint
 # ifndef lint
-static char    SccsId[] = "@(#)SendMail version 3.300 of %G%";
+static char    SccsId[] = "@(#)SendMail version 3.301 of %G%";
 # endif lint
 
 # endif lint
 
-char   Version[] = "3.300 [%G%]";
+char   Version[] = "3.301 [%G%]";