BSD 4_4 release
[unix-history] / usr / src / sbin / dump / optr.c
index 523104e..afc9b8c 100644 (file)
@@ -1,46 +1,69 @@
 /*-
 /*-
- * Copyright (c) 1980, 1988 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1980, 1988, 1993
+ *     The Regents of the University of California.  All rights reserved.
  *
  *
- * %sccs.include.redist.c%
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)optr.c     5.14 (Berkeley) %G%";
+static char sccsid[] = "@(#)optr.c     8.1 (Berkeley) 6/5/93";
 #endif /* not lint */
 
 #endif /* not lint */
 
-#ifdef sunos
-#include <stdio.h>
-#include <ctype.h>
 #include <sys/param.h>
 #include <sys/wait.h>
 #include <sys/param.h>
 #include <sys/wait.h>
-#include <sys/stat.h>
 #include <sys/time.h>
 #include <sys/time.h>
-#else
-#include <sys/param.h>
-#include <sys/wait.h>
-#include <stdio.h>
-#endif
-#include <signal.h>
-#include <time.h>
+
+#include <errno.h>
 #include <fstab.h>
 #include <grp.h>
 #include <fstab.h>
 #include <grp.h>
-#include <utmp.h>
-#include <tzfile.h>
-#include <errno.h>
+#include <signal.h>
+#include <stdio.h>
 #ifdef __STDC__
 #ifdef __STDC__
-#include <unistd.h>
 #include <stdlib.h>
 #include <string.h>
 #include <stdarg.h>
 #include <stdlib.h>
 #include <string.h>
 #include <stdarg.h>
-#else
+#endif
+#include <tzfile.h>
+#ifdef __STDC__
+#include <unistd.h>
+#endif
+#include <utmp.h>
+#ifndef __STDC__
 #include <varargs.h>
 #endif
 #include <varargs.h>
 #endif
+
 #include "dump.h"
 #include "pathnames.h"
 
 #include "dump.h"
 #include "pathnames.h"
 
-static void alarmcatch();
-static void sendmes();
+void   alarmcatch __P((/* int, int */));
+int    datesort __P((const void *, const void *));
+static void sendmes __P((char *, char *));
 
 /*
  *     Query the operator; This previously-fascist piece of code
 
 /*
  *     Query the operator; This previously-fascist piece of code
@@ -53,8 +76,8 @@ static void sendmes();
  *     Every 2 minutes we reprint the message, alerting others
  *     that dump needs attention.
  */
  *     Every 2 minutes we reprint the message, alerting others
  *     that dump needs attention.
  */
-int    timeout;
-char   *attnmessage;           /* attention message */
+static int timeout;
+static char *attnmessage;              /* attention message */
 
 int
 query(question)
 
 int
 query(question)
@@ -104,7 +127,7 @@ char lastmsg[100];
  *     Alert the console operator, and enable the alarm clock to
  *     sleep for 2 minutes in case nobody comes to satisfy dump
  */
  *     Alert the console operator, and enable the alarm clock to
  *     sleep for 2 minutes in case nobody comes to satisfy dump
  */
-static void
+void
 alarmcatch()
 {
        if (notify == 0) {
 alarmcatch()
 {
        if (notify == 0) {
@@ -163,7 +186,6 @@ set_operators()
        }
 }
 
        }
 }
 
-struct tm *localtime();
 struct tm *localclock;
 
 /*
 struct tm *localclock;
 
 /*
@@ -401,7 +423,7 @@ getfstab()
                    _PATH_FSTAB, strerror(errno));
                return;
        }
                    _PATH_FSTAB, strerror(errno));
                return;
        }
-       while (fs = getfsent()) {
+       while ((fs = getfsent()) != NULL) {
                if (strcmp(fs->fs_type, FSTAB_RW) &&
                    strcmp(fs->fs_type, FSTAB_RO) &&
                    strcmp(fs->fs_type, FSTAB_RQ))
                if (strcmp(fs->fs_type, FSTAB_RW) &&
                    strcmp(fs->fs_type, FSTAB_RO) &&
                    strcmp(fs->fs_type, FSTAB_RQ))
@@ -433,7 +455,6 @@ fstabsearch(key)
 {
        register struct pfstab *pf;
        register struct fstab *fs;
 {
        register struct pfstab *pf;
        register struct fstab *fs;
-       char *rawname();
 
        for (pf = table; pf != NULL; pf = pf->pf_next) {
                fs = pf->pf_fstab;
 
        for (pf = table; pf != NULL; pf = pf->pf_next) {
                fs = pf->pf_fstab;
@@ -464,7 +485,7 @@ lastdump(arg)
        register struct fstab *dt;
        register struct dumpdates *dtwalk;
        char *lastname, *date;
        register struct fstab *dt;
        register struct dumpdates *dtwalk;
        char *lastname, *date;
-       int dumpme, datesort();
+       int dumpme;
        time_t tnow;
 
        (void) time(&tnow);
        time_t tnow;
 
        (void) time(&tnow);
@@ -501,7 +522,7 @@ lastdump(arg)
 
 int
 datesort(a1, a2)
 
 int
 datesort(a1, a2)
-       void *a1, *a2;
+       const void *a1, *a2;
 {
        struct dumpdates *d1 = *(struct dumpdates **)a1;
        struct dumpdates *d2 = *(struct dumpdates **)a2;
 {
        struct dumpdates *d1 = *(struct dumpdates **)a1;
        struct dumpdates *d2 = *(struct dumpdates **)a2;
@@ -512,4 +533,3 @@ datesort(a1, a2)
                return (d2->dd_ddate - d1->dd_ddate);
        return (diff);
 }
                return (d2->dd_ddate - d1->dd_ddate);
        return (diff);
 }
-