+
+/*
+ * make an entry in the shutdown log
+ */
+
+char *days[] = {
+ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
+};
+
+char *months[] = {
+ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep",
+ "Oct", "Nov", "Dec"
+};
+
+log_entry(now)
+ time_t now;
+{
+ register FILE *fp;
+ register char **mess;
+ struct tm *tm, *localtime();
+
+ tm = localtime(&now);
+ fp = fopen(LOGFILE, "a");
+ if (fp == NULL) {
+ printf("Shutdown: log entry failed\n");
+ return;
+ }
+ fseek(fp, 0L, 2);
+ fprintf(fp, "%02d:%02d %s %s %2d, %4d. Shutdown:", tm->tm_hour,
+ tm->tm_min, days[tm->tm_wday], months[tm->tm_mon],
+ tm->tm_mday, tm->tm_year + 1900);
+ for (mess = nolog2; *mess; mess++)
+ fprintf(fp, " %s", *mess);
+ if (shutter)
+ fprintf(fp, " (by %s!%s)", hostname, shutter);
+ fputc('\n', fp);
+ fclose(fp);
+}