X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/blobdiff_plain/2bfc5a4f9a9b1639cd149732ef1cc7bc12c47c92..a3954b4f2a82b7223dd67338eeb8c3be5d6238eb:/usr/src/sbin/shutdown/shutdown.c diff --git a/usr/src/sbin/shutdown/shutdown.c b/usr/src/sbin/shutdown/shutdown.c index 5f9ad6782a..f9e7014a4c 100644 --- a/usr/src/sbin/shutdown/shutdown.c +++ b/usr/src/sbin/shutdown/shutdown.c @@ -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 #include @@ -6,6 +6,7 @@ static char *sccsid = "@(#)shutdown.c 4.9 (Berkeley) 81/06/11"; #include #include #include +#include /* * /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 + * Dave Presotto, Berkeley, 1981 */ #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 IGNOREUSER "sleeper" 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) - 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); @@ -279,8 +283,8 @@ warn(term, sdt, nowtime) 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"); @@ -357,7 +361,7 @@ time_t now; 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); }