BSD 4_3_Reno release
[unix-history] / usr / src / usr.sbin / timed / timed / slave.c
index ae643e5..1ed85b4 100644 (file)
@@ -2,21 +2,29 @@
  * Copyright (c) 1985 Regents of the University of California.
  * All rights reserved.
  *
  * Copyright (c) 1985 Regents of the University of California.
  * All rights reserved.
  *
- * Redistribution and use in source and binary forms are permitted
- * provided that this notice is preserved and that due credit is given
- * to the University of California at Berkeley. The name of the University
- * may not be used to endorse or promote products derived from this
- * software without specific prior written permission. This software
- * is provided ``as is'' without express or implied warranty.
+ * Redistribution and use in source and binary forms are permitted provided
+ * that: (1) source distributions retain this entire copyright notice and
+ * comment, and (2) distributions including binaries display the following
+ * acknowledgement:  ``This product includes software developed by the
+ * University of California, Berkeley and its contributors'' in the
+ * documentation or other materials provided with the distribution and in
+ * all advertising materials mentioning features or use of this software.
+ * 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 ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)slave.c    2.17 (Berkeley) %G%";
+static char sccsid[] = "@(#)slave.c    2.21 (Berkeley) 6/1/90";
 #endif /* not lint */
 
 #include "globals.h"
 #include <protocols/timed.h>
 #include <setjmp.h>
 #endif /* not lint */
 
 #include "globals.h"
 #include <protocols/timed.h>
 #include <setjmp.h>
+#include "pathnames.h"
 
 extern jmp_buf jmpenv;
 
 
 extern jmp_buf jmpenv;
 
@@ -31,8 +39,7 @@ slave()
        char candidate[MAXHOSTNAMELEN];
        struct tsp *msg, to, *readmsg();
        struct sockaddr_in saveaddr, msaveaddr;
        char candidate[MAXHOSTNAMELEN];
        struct tsp *msg, to, *readmsg();
        struct sockaddr_in saveaddr, msaveaddr;
-       struct timeval wait;
-       struct timeval time, otime;
+       struct timeval time, wait;
        struct tsp *answer, *acksend();
        int timeout();
        char *date();
        struct tsp *answer, *acksend();
        int timeout();
        char *date();
@@ -63,7 +70,7 @@ slave()
        if (status & MASTER) {
 #ifdef MEASURE
                if (fp == NULL) {
        if (status & MASTER) {
 #ifdef MEASURE
                if (fp == NULL) {
-                       fp = fopen("/usr/adm/timed.masterlog", "w");
+                       fp = fopen(_PATH_MASTERLOG, "w");
                        setlinebuf(fp);
                }
 #endif
                        setlinebuf(fp);
                }
 #endif
@@ -125,7 +132,7 @@ loop:
                         * (file not open)
                         */
                        if (fp == NULL) {
                         * (file not open)
                         */
                        if (fp == NULL) {
-                               fp = fopen("/usr/adm/timed.masterlog", "w");
+                               fp = fopen(_PATH_MASTERLOG, "w");
                                setlinebuf(fp);
                        }
 #endif
                                setlinebuf(fp);
                        }
 #endif
@@ -208,12 +215,12 @@ loop:
                        seq = msg->tsp_seq;
 
                        (void)strcpy(olddate, date());
                        seq = msg->tsp_seq;
 
                        (void)strcpy(olddate, date());
-                       (void)gettimeofday(&otime, (struct timezone *)0);
+                       logwtmp("|", "date", "");
                        (void)settimeofday(&msg->tsp_time,
                                (struct timezone *)0);
                        (void)settimeofday(&msg->tsp_time,
                                (struct timezone *)0);
+                       logwtmp("{", "date", "");
                        syslog(LOG_NOTICE, "date changed by %s from: %s",
                                msg->tsp_name, olddate);
                        syslog(LOG_NOTICE, "date changed by %s from: %s",
                                msg->tsp_name, olddate);
-                       logwtmp(otime, msg->tsp_time);
                        if ((status & SUBMASTER) == SUBMASTER)
                                spreadtime();
                        (void)gettimeofday(&time, (struct timezone *)0);
                        if ((status & SUBMASTER) == SUBMASTER)
                                spreadtime();
                        (void)gettimeofday(&time, (struct timezone *)0);