symbolic links
[unix-history] / usr / src / sbin / shutdown / shutdown.c
index 5f9ad67..f9e7014 100644 (file)
@@ -1,4 +1,4 @@
-static char *sccsid = "@(#)shutdown.c  4.9 (Berkeley) 81/06/11";
+static char *sccsid = "@(#)shutdown.c  4.11 (Berkeley) 82/02/01";
 
 #include <stdio.h>
 #include <ctype.h>
 
 #include <stdio.h>
 #include <ctype.h>
@@ -6,6 +6,7 @@ static  char *sccsid = "@(#)shutdown.c  4.9 (Berkeley) 81/06/11";
 #include <utmp.h>
 #include <time.h>
 #include <sys/types.h>
 #include <utmp.h>
 #include <time.h>
 #include <sys/types.h>
+#include <whoami.h>
 /*
  *     /etc/shutdown when [messages]
  *
 /*
  *     /etc/shutdown when [messages]
  *
@@ -19,6 +20,7 @@ static        char *sccsid = "@(#)shutdown.c  4.9 (Berkeley) 81/06/11";
  *             Peter Lamb, Melbourne, 1980
  *             William Joy, Berkeley, 1981
  *             Michael Toy, Berkeley, 1981
  *             Peter Lamb, Melbourne, 1980
  *             William Joy, Berkeley, 1981
  *             Michael Toy, Berkeley, 1981
+ *             Dave Presotto, Berkeley, 1981
  */
 #ifdef DEBUG
 #define LOGFILE "shutdown.log"
  */
 #ifdef DEBUG
 #define LOGFILE "shutdown.log"
@@ -33,6 +35,7 @@ static        char *sccsid = "@(#)shutdown.c  4.9 (Berkeley) 81/06/11";
 #define SECONDS
 #define NLOG           20              /* no of args possible for message */
 #define        NOLOGTIME       5 MINUTES
 #define SECONDS
 #define NLOG           20              /* no of args possible for message */
 #define        NOLOGTIME       5 MINUTES
+#define IGNOREUSER     "sleeper"
 
 int    do_nothing();
 time_t getsdt();
 
 int    do_nothing();
 time_t getsdt();
@@ -159,7 +162,8 @@ main(argc,argv)
                ufd = open("/etc/utmp",0);
                nowtime = time((long *) 0);
                while (read(ufd,&utmp,sizeof utmp)==sizeof utmp)
                ufd = open("/etc/utmp",0);
                nowtime = time((long *) 0);
                while (read(ufd,&utmp,sizeof utmp)==sizeof utmp)
-               if (utmp.ut_name[0]) {
+               if (utmp.ut_name[0] &&
+                   strncmp(utmp.ut_name, IGNOREUSER, sizeof(utmp.ut_name))) {
                        strcpy(term, tpath);
                        strncat(term, utmp.ut_line, sizeof utmp.ut_line);
                        alarm(3);
                        strcpy(term, tpath);
                        strncat(term, utmp.ut_line, sizeof utmp.ut_line);
                        alarm(3);
@@ -279,8 +283,8 @@ warn(term, sdt, nowtime)
 
        if (shutter)
                fprintf(term,
 
        if (shutter)
                fprintf(term,
-                   "\007\007*** System shutdown message from %s ***\n",
-                   shutter);
+                   "\007\007*** System shutdown message from %s!%s ***\n",
+                   sysname,shutter);
        else
                fprintf(term,
                    "\007\007*** System shutdown message ***\n");
        else
                fprintf(term,
                    "\007\007*** System shutdown message ***\n");
@@ -357,7 +361,7 @@ time_t now;
        for (mess = nolog2; *mess; mess++)
                fprintf(fp, " %s", *mess);
        if (shutter)
        for (mess = nolog2; *mess; mess++)
                fprintf(fp, " %s", *mess);
        if (shutter)
-               fprintf(fp, " (by %s)", shutter);
+               fprintf(fp, " (by %s!%s)", sysname,shutter);
        fputc('\n', fp);
        fclose(fp);
 }
        fputc('\n', fp);
        fclose(fp);
 }