Index: acksend.c
===================================================================
RCS file: /cvs/src/usr.sbin/timed/timed/acksend.c,v
retrieving revision 1.3
diff -u -r1.3 acksend.c
--- acksend.c	13 Mar 2004 21:08:38 -0000	1.3
+++ acksend.c	31 Aug 2004 07:34:46 -0000
@@ -49,7 +49,7 @@
 	msg.tsp_type = type;
 	msg.tsp_seq = seq;
 	msg.tsp_vers = TSPVERSION;
-	(void)strcpy(msg.tsp_name, hostname);
+	strlcpy(msg.tsp_name, hostname, sizeof(msg.tsp_name));
 	bytenetorder(&msg);
 	if (sendto(sock, (char *)&msg, sizeof(struct tsp), 0,
 		   (struct sockaddr*)addr, sizeof(struct sockaddr)) < 0) {
Index: candidate.c
===================================================================
RCS file: /cvs/src/usr.sbin/timed/timed/candidate.c,v
retrieving revision 1.3
diff -u -r1.3 candidate.c
--- candidate.c	13 Mar 2004 21:08:38 -0000	1.3
+++ candidate.c	31 Aug 2004 07:37:17 -0000
@@ -75,7 +75,7 @@
 		fprintf(fd, "This machine is a candidate time master\n");
 	msg.tsp_type = TSP_ELECTION;
 	msg.tsp_vers = TSPVERSION;
-	(void)strcpy(msg.tsp_name, hostname);
+	strlcpy(msg.tsp_name, hostname, sizeof(msg.tsp_name));
 	bytenetorder(&msg);
 	if (sendto(sock, (char *)&msg, sizeof(struct tsp), 0,
 		   (struct sockaddr*)&net->dest_addr,
@@ -84,10 +84,10 @@
 		return(SLAVE);
 	}
 
-	(void)gettimeofday(&then, 0);
+	gettimeofday(&then, 0);
 	then.tv_sec += 3;
 	for (;;) {
-		(void)gettimeofday(&wait, 0);
+		gettimeofday(&wait, 0);
 		timevalsub(&wait,&then,&wait);
 		resp = readmsg(TSP_ANY, ANYADDR, &wait, net);
 		if (!resp)
@@ -96,7 +96,7 @@
 		switch (resp->tsp_type) {
 
 		case TSP_ACCEPT:
-			(void)addmach(resp->tsp_name, &from,fromnet);
+			addmach(resp->tsp_name, &from,fromnet);
 			break;
 
 		case TSP_MASTERUP:
@@ -107,7 +107,7 @@
 			 */
 			if (++loop_lim < 5
 			    && !good_host_name(resp->tsp_name)) {
-				(void)addmach(resp->tsp_name, &from,fromnet);
+				addmach(resp->tsp_name, &from,fromnet);
 				suppress(&from, resp->tsp_name, net);
 				goto again;
 			}
@@ -134,7 +134,7 @@
 			/* no master for another round */
 			htp = addmach(resp->tsp_name,&from,fromnet);
 			msg.tsp_type = TSP_REFUSE;
-			(void)strcpy(msg.tsp_name, hostname);
+			strlcpy(msg.tsp_name, hostname, sizeof(msg.tsp_name));
 			answer = acksend(&msg, &htp->addr, htp->name,
 					 TSP_ACK, 0, htp->noanswer);
 			if (!answer) {
@@ -144,7 +144,7 @@
 			break;
 
 		case TSP_SLAVEUP:
-			(void)addmach(resp->tsp_name, &from,fromnet);
+			addmach(resp->tsp_name, &from,fromnet);
 			break;
 
 		case TSP_SETDATE:
Index: cksum.c
===================================================================
RCS file: /cvs/src/usr.sbin/timed/timed/cksum.c,v
retrieving revision 1.3
diff -u -r1.3 cksum.c
--- cksum.c	13 Mar 2004 21:08:38 -0000	1.3
+++ cksum.c	31 Aug 2004 07:38:50 -0000
@@ -51,11 +51,14 @@
 int
 in_cksum(u_short *addr, int len)
 {
-	int nleft = len;
-	u_short *w = addr;
+	int nleft;
+	u_short *w;
 	u_short answer;
-	int sum = 0;
+	int sum;
 
+	nleft = len;
+	w = addr;
+	sum = 0;
 	/*
 	 *  Our algorithm is simple, using a 32 bit accumulator (sum),
 	 *  we add sequential 16 bit words to it, and at the end, fold
Index: correct.c
===================================================================
RCS file: /cvs/src/usr.sbin/timed/timed/correct.c,v
retrieving revision 1.4
diff -u -r1.4 correct.c
--- correct.c	13 Mar 2004 21:08:38 -0000	1.4
+++ correct.c	31 Aug 2004 07:41:06 -0000
@@ -39,9 +39,6 @@
 #include <math.h>
 #include <sys/types.h>
 #include <sys/times.h>
-#ifdef sgi
-#include <sys/syssgi.h>
-#endif /* sgi */
 
 static void adjclock(struct timeval *);
 
@@ -72,14 +69,14 @@
 			    || corr >= MAXADJ*1000
 			    || corr <= -MAXADJ*1000) {
 				htp->need_set = 0;
-				(void)gettimeofday(&to.tsp_time,0);
+				gettimeofday(&to.tsp_time,0);
 				timevaladd(&to.tsp_time, &adjlocal);
 				to.tsp_type = TSP_SETTIME;
 			} else {
 				mstotvround(&to.tsp_time, corr);
 				to.tsp_type = TSP_ADJTIME;
 			}
-			(void)strcpy(to.tsp_name, hostname);
+			strlcpy(to.tsp_name, hostname, sizeof(to.tsp_name));
 			answer = acksend(&to, &htp->addr, htp->name,
 					 TSP_ACK, 0, 0);
 			if (!answer) {
@@ -92,7 +89,7 @@
 						fprintf(fd,
 					     "purging %s for not answering\n",
 							htp->name);
-						(void)fflush(fd);
+						fflush(fd);
 					}
 					htp = remmach(htp);
 				}
@@ -159,110 +156,11 @@
 		syslog(LOG_WARNING,
 		       "clock correction %d sec too large to adjust",
 		       adj.tv_sec);
-		(void) gettimeofday(&now, 0);
+		gettimeofday(&now, 0);
 		timevaladd(&now, corr);
 		if (settimeofday(&now, 0) < 0)
 			syslog(LOG_ERR, "settimeofday: %m");
 	}
-
-#ifdef sgi
-	/* Accumulate the total change, and use it to adjust the basic
-	 * clock rate.
-	 */
-	if (++passes > 2) {
-#define F_USEC_PER_SEC	(1000000*1.0)	/* reduce typos */
-#define F_NSEC_PER_SEC	(F_USEC_PER_SEC*1000.0)
-
-		extern char *timetrim_fn;
-		extern char *timetrim_wpat;
-		extern long timetrim;
-		extern double tot_adj, hr_adj;	/* totals in nsec */
-		extern double tot_ticks, hr_ticks;
-
-		static double nag_tick;
-		double cur_ticks, hr_delta_ticks, tot_delta_ticks;
-		double tru_tot_adj, tru_hr_adj; /* nsecs of adjustment */
-		double tot_trim, hr_trim;   /* nsec/sec */
-		struct tms tm;
-		FILE *timetrim_st;
-
-		cur_ticks = times(&tm);
-		tot_adj += delta*1000.0;
-		hr_adj += delta*1000.0;
-
-		tot_delta_ticks = cur_ticks-tot_ticks;
-		if (tot_delta_ticks >= 16*SECDAY*CLK_TCK) {
-			tot_adj -= rint(tot_adj/16);
-			tot_ticks += rint(tot_delta_ticks/16);
-			tot_delta_ticks = cur_ticks-tot_ticks;
-		}
-		hr_delta_ticks = cur_ticks-hr_ticks;
-
-		tru_hr_adj = hr_adj + timetrim*rint(hr_delta_ticks/CLK_TCK);
-		tru_tot_adj = (tot_adj
-			       + timetrim*rint(tot_delta_ticks/CLK_TCK));
-
-		if (hr_delta_ticks >= SECDAY*CLK_TCK
-		    || (tot_delta_ticks < 4*SECDAY*CLK_TCK
-			&& hr_delta_ticks >= SECHR*CLK_TCK)
-		    || (trace && hr_delta_ticks >= (SECHR/10)*CLK_TCK)) {
-
-			tot_trim = rint(tru_tot_adj*CLK_TCK/tot_delta_ticks);
-			hr_trim = rint(tru_hr_adj*CLK_TCK/hr_delta_ticks);
-
-			if (trace
-			    || (abs(timetrim - hr_trim) > 100000.0
-				&& 0 == timetrim_fn
-				&& ((cur_ticks - nag_tick)
-				    >= 24*SECDAY*CLK_TCK))) {
-				nag_tick = cur_ticks;
-				syslog(LOG_NOTICE,
-		   "%+.3f/%.2f or %+.3f/%.2f sec/hr; timetrim=%+.0f or %+.0f",
-				       tru_tot_adj/F_NSEC_PER_SEC,
-				       tot_delta_ticks/(SECHR*CLK_TCK*1.0),
-				       tru_hr_adj/F_NSEC_PER_SEC,
-				       hr_delta_ticks/(SECHR*CLK_TCK*1.0),
-				       tot_trim,
-				       hr_trim);
-			}
-
-			if (tot_trim < -MAX_TRIM || tot_trim > MAX_TRIM) {
-				tot_ticks = hr_ticks;
-				tot_adj = hr_adj;
-			} else if (0 > syssgi(SGI_SETTIMETRIM,
-					      (long)tot_trim)) {
-				syslog(LOG_ERR, "SETTIMETRIM(%d): %m",
-				       (long)tot_trim);
-			} else {
-				if (0 != timetrim_fn) {
-				    timetrim_st = fopen(timetrim_fn, "w");
-				    if (0 == timetrim_st) {
-					syslog(LOG_ERR, "fopen(%s): %m",
-					       timetrim_fn);
-				    } else {
-					if (0 > fprintf(timetrim_st,
-							timetrim_wpat,
-							(long)tot_trim,
-							tru_tot_adj,
-							tot_delta_ticks)) {
-						syslog(LOG_ERR,
-						       "fprintf(%s): %m",
-						       timetrim_fn);
-					}
-					(void)fclose(timetrim_st);
-				    }
-				}
-
-				tot_adj -= ((tot_trim - timetrim)
-					    * rint(tot_delta_ticks/CLK_TCK));
-				timetrim = tot_trim;
-			}
-
-			hr_ticks = cur_ticks;
-			hr_adj = 0;
-		}
-	}
-#endif /* sgi */
 }
 
 
Index: master.c
===================================================================
RCS file: /cvs/src/usr.sbin/timed/timed/master.c,v
retrieving revision 1.4
diff -u -r1.4 master.c
--- master.c	13 Mar 2004 21:08:38 -0000	1.4
+++ master.c	31 Aug 2004 08:29:41 -0000
@@ -40,12 +40,11 @@
 #include <sys/types.h>
 #include <sys/times.h>
 #include <setjmp.h>
-#ifdef sgi
-#include <sys/schedctl.h>
-#endif /* sgi */
 #include <utmp.h>
 #include "pathnames.h"
 
+#define POLLRATE 4
+
 extern int measure_delta;
 extern jmp_buf jmpenv;
 extern int Mflag;
@@ -56,11 +55,7 @@
 
 static void mchgdate(struct tsp *);
 
-#ifdef sgi
-extern void logwtmp(struct timeval *, struct timeval *);
-#else
 extern void logwtmp(char *, char *, char *);
-#endif /* sgi */
 
 /*
  * The main function of `master' is to periodically compute the differences
@@ -76,7 +71,6 @@
 {
 	struct hosttbl *htp;
 	long pollingtime;
-#define POLLRATE 4
 	int polls;
 	struct timeval wait, ntime;
 	time_t tsp_time_sec;
@@ -94,7 +88,7 @@
 		if (ntp->status == MASTER)
 			masterup(ntp);
 	}
-	(void)gettimeofday(&ntime, 0);
+	gettimeofday(&ntime, 0);
 	pollingtime = ntime.tv_sec+3;
 	if (justquit)
 		polls = 0;
@@ -105,14 +99,14 @@
  *	to update all timers.
  */
 loop:
-	(void)gettimeofday(&ntime, 0);
+	gettimeofday(&ntime, 0);
 	wait.tv_sec = pollingtime - ntime.tv_sec;
 	if (wait.tv_sec < 0)
 		wait.tv_sec = 0;
 	wait.tv_usec = 0;
 	msg = readmsg(TSP_ANY, ANYADDR, &wait, 0);
 	if (!msg) {
-		(void)gettimeofday(&ntime, 0);
+		gettimeofday(&ntime, 0);
 		if (ntime.tv_sec >= pollingtime) {
 			pollingtime = ntime.tv_sec + SAMPLEINTVL;
 			get_goodgroup(0);
@@ -147,7 +141,7 @@
 				to.tsp_vers = TSPVERSION;
 				to.tsp_seq = sequence++;
 				to.tsp_hopcnt = MAX_HOPCNT;
-				(void)strcpy(to.tsp_name, hostname);
+				strlcpy(to.tsp_name, hostname, sizeof(to.tsp_name));
 				bytenetorder(&to);
 				if (sendto(sock, (char *)&to,
 					   sizeof(struct tsp), 0,
@@ -173,12 +167,9 @@
 			/*
 			 * XXX check to see it is from ourself
 			 */
-#ifdef sgi
-			(void)cftime(newdate, "%D %T", &msg->tsp_time.tv_sec);
-#else
 			tsp_time_sec = msg->tsp_time.tv_sec;
-			(void)strcpy(newdate, ctime(&tsp_time_sec));
-#endif /* sgi */
+			strlcpy(newdate, ctime(&tsp_time_sec), sizeof(newdate));
+
 			if (!good_host_name(msg->tsp_name)) {
 				syslog(LOG_NOTICE,
 				       "attempted date change by %s to %s",
@@ -188,19 +179,16 @@
 			}
 
 			mchgdate(msg);
-			(void)gettimeofday(&ntime, 0);
+			gettimeofday(&ntime, 0);
 			pollingtime = ntime.tv_sec + SAMPLEINTVL;
 			break;
 
 		case TSP_SETDATEREQ:
 			if (!fromnet || fromnet->status != MASTER)
 				break;
-#ifdef sgi
-			(void)cftime(newdate, "%D %T", &msg->tsp_time.tv_sec);
-#else
 			tsp_time_sec = msg->tsp_time.tv_sec;
-			(void)strcpy(newdate, ctime(&tsp_time_sec));
-#endif /* sgi */
+			strlcpy(newdate, ctime(&tsp_time_sec), sizeof(newdate));
+
 			htp = findhost(msg->tsp_name);
 			if (htp == 0) {
 				syslog(LOG_ERR,
@@ -220,7 +208,7 @@
 			}
 
 			mchgdate(msg);
-			(void)gettimeofday(&ntime, 0);
+			gettimeofday(&ntime, 0);
 			pollingtime = ntime.tv_sec + SAMPLEINTVL;
 			break;
 
@@ -244,12 +232,12 @@
 				break;
 			if (fromnet->status == MASTER) {
 				pollingtime = 0;
-				(void)addmach(msg->tsp_name, &from,fromnet);
+				addmach(msg->tsp_name, &from,fromnet);
 			}
 			taddr = from;
-			(void)strcpy(tname, msg->tsp_name);
+			strlcpy(tname, msg->tsp_name, sizeof(tname));
 			to.tsp_type = TSP_QUIT;
-			(void)strcpy(to.tsp_name, hostname);
+			strlcpy(to.tsp_name, hostname, sizeof(to.tsp_name));
 			answer = acksend(&to, &taddr, tname,
 					 TSP_ACK, 0, 1);
 			if (answer == NULL) {
@@ -266,7 +254,7 @@
 			 */
 			if (!fromnet || fromnet->status != MASTER)
 				break;
-			(void)strcpy(to.tsp_name, hostname);
+			strlcpy(to.tsp_name, hostname, sizeof(to.tsp_name));
 
 			/* The other master often gets into the same state,
 			 * with boring results if we stay at it forever.
@@ -274,7 +262,7 @@
 			ntp = fromnet;	/* (acksend() can leave fromnet=0 */
 			for (i = 0; i < 3; i++) {
 				to.tsp_type = TSP_RESOLVE;
-				(void)strcpy(to.tsp_name, hostname);
+				strlcpy(to.tsp_name, hostname, sizeof(to.tsp_name));
 				answer = acksend(&to, &ntp->dest_addr,
 						 ANYADDR, TSP_MASTERACK,
 						 ntp, 0);
@@ -301,7 +289,7 @@
 			 * do not want to call synch() while waiting
 			 * to be killed!
 			 */
-			(void)gettimeofday(&ntime, (struct timezone *)0);
+			gettimeofday(&ntime, (struct timezone *)0);
 			pollingtime = ntime.tv_sec + SAMPLEINTVL;
 			break;
 
@@ -319,14 +307,14 @@
 			 */
 			htp = addmach(msg->tsp_name, &from,fromnet);
 			to.tsp_type = TSP_QUIT;
-			(void)strcpy(to.tsp_name, hostname);
+			strlcpy(to.tsp_name, hostname, sizeof(to.tsp_name));
 			answer = acksend(&to, &htp->addr, htp->name,
 					 TSP_ACK, 0, 1);
 			if (!answer) {
 				syslog(LOG_WARNING,
 				"loop breakage: no reply from %s=%s to QUIT",
 				    htp->name, inet_ntoa(htp->addr.sin_addr));
-				(void)remmach(htp);
+				remmach(htp);
 			}
 
 		case TSP_TEST:
@@ -362,14 +350,14 @@
 	char olddate[32];
 	struct timeval otime, ntime;
 
-	(void)strcpy(tname, msg->tsp_name);
+	strlcpy(tname, msg->tsp_name, sizeof(tname));
 
 	xmit(TSP_DATEACK, msg->tsp_seq, &from);
 
-	(void)strcpy(olddate, date());
+	strlcpy(olddate, date(), sizeof(olddate));
 
 	/* adjust time for residence on the queue */
-	(void)gettimeofday(&otime, 0);
+	gettimeofday(&otime, 0);
 	adj_msg_time(msg,&otime);
 
 	timevalsub(&ntime, &msg->tsp_time, &otime);
@@ -380,16 +368,9 @@
 		dictate = 3;
 		synch(tvtomsround(ntime));
 	} else {
-#ifdef sgi
-		if (0 > settimeofday(&msg->tsp_time, 0)) {
-			syslog(LOG_ERR, "settimeofday(): %m");
-		}
-		logwtmp(&otime, &msg->tsp_time);
-#else
 		logwtmp("|", "date", "");
-		(void)settimeofday(&msg->tsp_time, 0);
+		settimeofday(&msg->tsp_time, 0);
 		logwtmp("{", "date", "");
-#endif /* sgi */
 		spreadtime();
 	}
 
@@ -407,20 +388,11 @@
 	struct hosttbl *htp;
 	int measure_status;
 	struct timeval check, stop, wait;
-#ifdef sgi
-	int pri;
-#endif /* sgi */
 
 	if (slvcount > 0) {
 		if (trace)
 			fprintf(fd, "measurements starting at %s\n", date());
-		(void)gettimeofday(&check, 0);
-#ifdef sgi
-		/* run fast to get good time */
-		pri = schedctl(NDPRI,0,NDPHIMIN);
-		if (pri < 0)
-			syslog(LOG_ERR, "schedctl(): %m");
-#endif /* sgi */
+
 		for (htp = self.l_fwd; htp != &self; htp = htp->l_fwd) {
 			if (htp->noanswer != 0) {
 				measure_status = measure(500, 100,
@@ -441,18 +413,18 @@
 						fprintf(fd,
 					"purging %s for not answering ICMP\n",
 							htp->name);
-						(void)fflush(fd);
+						fflush(fd);
 					}
 					htp = remmach(htp);
 				}
 			} else {
 				htp->delta = measure_delta;
 			}
-			(void)gettimeofday(&stop, 0);
+			gettimeofday(&stop, 0);
 			timevalsub(&stop, &stop, &check);
 			if (stop.tv_sec >= 1) {
 				if (trace)
-					(void)fflush(fd);
+					fflush(fd);
 				/*
 				 * ack messages periodically
 				 */
@@ -461,13 +433,9 @@
 				if (0 != readmsg(TSP_TRACEON,ANYADDR,
 						 &wait,0))
 					traceon();
-				(void)gettimeofday(&check, 0);
+				gettimeofday(&check, 0);
 			}
 		}
-#ifdef sgi
-		if (pri >= 0)
-			(void)schedctl(NDPRI,0,pri);
-#endif /* sgi */
 		if (trace)
 			fprintf(fd, "measurements finished at %s\n", date());
 	}
@@ -500,8 +468,8 @@
 	dictate = 2;
 	for (htp = self.l_fwd; htp != &self; htp = htp->l_fwd) {
 		to.tsp_type = TSP_SETTIME;
-		(void)strcpy(to.tsp_name, hostname);
-		(void)gettimeofday(&to.tsp_time, 0);
+		strlcpy(to.tsp_name, hostname, sizeof(to.tsp_name));
+		gettimeofday(&to.tsp_time, 0);
 		answer = acksend(&to, &htp->addr, htp->name,
 				 TSP_ACK, 0, htp->noanswer);
 		if (answer == 0) {
@@ -515,7 +483,7 @@
 					fprintf(fd,
 					     "purging %s for not answering",
 						htp->name);
-					(void)fflush(fd);
+					fflush(fd);
 				}
 				htp = remmach(htp);
 			}
@@ -650,7 +618,7 @@
 		}
 		ret->addr = *addr;
 		ret->ntp = ntp;
-		(void)strncpy(ret->name, name, sizeof(ret->name));
+		strlcpy(ret->name, name, sizeof(ret->name));
 		ret->good = good_host_name(name);
 		ret->l_fwd = &self;
 		ret->l_bak = self.l_bak;
@@ -750,7 +718,7 @@
 	 * we do not tell them to start using our time, before we have
 	 * found a good master.
 	 */
-	(void)gettimeofday(&net->slvwait, 0);
+	gettimeofday(&net->slvwait, 0);
 }
 
 void
@@ -772,12 +740,12 @@
 	 * If we are stable, send our time to the slave.
 	 * Do not go crazy if the date has been changed.
 	 */
-	(void)gettimeofday(&now, 0);
+	gettimeofday(&now, 0);
 	if (now.tv_sec >= fromnet->slvwait.tv_sec+3
 	    || now.tv_sec < fromnet->slvwait.tv_sec) {
 		to.tsp_type = TSP_SETTIME;
-		(void)strcpy(to.tsp_name, hostname);
-		(void)gettimeofday(&to.tsp_time, 0);
+		strlcpy(to.tsp_name, hostname, sizeof(to.tsp_name));
+		gettimeofday(&to.tsp_time, 0);
 		answer = acksend(&to, &htp->addr,
 				 htp->name, TSP_ACK,
 				 0, htp->noanswer);
@@ -856,7 +824,7 @@
 	prthp(CLK_TCK);
 	if (trace) {
 		fprintf(fd, msg, date());
-		(void)fclose(fd);
+		fclose(fd);
 		fd = 0;
 	}
 #ifdef GPROF
@@ -866,31 +834,3 @@
 #endif
 	trace = OFF;
 }
-
-
-#ifdef sgi
-void
-logwtmp(struct timeval *otime, struct timeval *ntime)
-{
-	static struct utmp wtmp[2] = {
-		{"","",OTIME_MSG,0,OLD_TIME,0,0,0},
-		{"","",NTIME_MSG,0,NEW_TIME,0,0,0}
-	};
-	static char *wtmpfile = WTMP_FILE;
-	int f;
-
-	wtmp[0].ut_time = otime->tv_sec + (otime->tv_usec + 500000) / 1000000;
-	wtmp[1].ut_time = ntime->tv_sec + (ntime->tv_usec + 500000) / 1000000;
-	if (wtmp[0].ut_time == wtmp[1].ut_time)
-		return;
-
-	setutent();
-	(void)pututline(&wtmp[0]);
-	(void)pututline(&wtmp[1]);
-	endutent();
-	if ((f = open(wtmpfile, O_WRONLY|O_APPEND)) >= 0) {
-		(void) write(f, (char *)wtmp, sizeof(wtmp));
-		(void) close(f);
-	}
-}
-#endif /* sgi */
Index: measure.c
===================================================================
RCS file: /cvs/src/usr.sbin/timed/timed/measure.c,v
retrieving revision 1.3
diff -u -r1.3 measure.c
--- measure.c	13 Mar 2004 21:08:38 -0000	1.3
+++ measure.c	31 Aug 2004 08:23:01 -0000
@@ -61,7 +61,7 @@
 measure(u_long maxmsec,			/* wait this many msec at most */
 	u_long wmsec,			/* msec to wait for an answer */
 	char *hname, struct sockaddr_in *addr,
-	int print)			/* print complaints on stderr */
+	int printerr)			/* print complaints on stderr */
 {
 	int length;
 	int measure_status;
@@ -125,11 +125,7 @@
 
 	FD_ZERO(&ready);
 
-#ifdef sgi
-	sginap(1);			/* start at a clock tick */
-#endif /* sgi */
-
-	(void)gettimeofday(&tdone, 0);
+	gettimeofday(&tdone, 0);
 	mstotvround(&tout, maxmsec);
 	timevaladd(&tdone, &tout);		/* when we give up */
 
@@ -138,7 +134,7 @@
 	rcvcount = 0;
 	trials = 0;
 	while (rcvcount < MSGS) {
-		(void)gettimeofday(&tcur, 0);
+		gettimeofday(&tcur, 0);
 
 		/*
 		 * keep sending until we have sent the max
@@ -175,7 +171,7 @@
 			FD_SET(sock_raw, &ready);
 			count = select(sock_raw+1, &ready, (fd_set *)0,
 				       (fd_set *)0, &tout);
-			(void)gettimeofday(&tcur, (struct timezone *)0);
+			gettimeofday(&tcur, (struct timezone *)0);
 			if (count <= 0)
 				break;
 
@@ -266,7 +262,7 @@
 			   	measure_delta, trials,
 				inet_ntoa(addr->sin_addr), hname);
 		}
-	} else if (print) {
+	} else if (printerr) {
 		if (errno != 0)
 			warn("measure %s", hname);
 	} else {
@@ -279,7 +275,7 @@
 			fprintf(fd,
 				"measure: %s failed after %d trials\n",
 				hname, trials);
-			(void)fflush(fd);
+			fflush(fd);
 		}
 	}
 
@@ -297,13 +293,12 @@
 mstotvround(struct timeval *res, long x)
 {
 
-#ifndef sgi
 	if (x < 0)
 		x = -((-x + 3)/5);
 	else
 		x = (x+3)/5;
 	x *= 5;
-#endif /* sgi */
+
 	res->tv_sec = x/1000;
 	res->tv_usec = (x-res->tv_sec*1000)*1000;
 	if (res->tv_usec < 0) {
Index: readmsg.c
===================================================================
RCS file: /cvs/src/usr.sbin/timed/timed/readmsg.c,v
retrieving revision 1.3
diff -u -r1.3 readmsg.c
--- readmsg.c	13 Mar 2004 21:08:38 -0000	1.3
+++ readmsg.c	31 Aug 2004 07:50:36 -0000
@@ -166,11 +166,11 @@
 	 * right one, return it, otherwise insert it in the linked list.
 	 */
 
-	(void)gettimeofday(&rtout, 0);
+	gettimeofday(&rtout, 0);
 	timevaladd(&rtout, intvl);
 	FD_ZERO(&ready);
 	for (;;) {
-		(void)gettimeofday(&rtime, 0);
+		gettimeofday(&rtime, 0);
 		timevalsub(&rwait, &rtout, &rtime);
 		if (rwait.tv_sec < 0)
 			rwait.tv_sec = rwait.tv_usec = 0;
@@ -217,7 +217,7 @@
 			      inet_ntoa(from.sin_addr));
 			continue;
 		}
-		(void)gettimeofday(&from_when, (struct timezone *)0);
+		gettimeofday(&from_when, (struct timezone *)0);
 		bytehostorder(&msgin);
 
 		if (msgin.tsp_vers > TSPVERSION) {
@@ -408,7 +408,7 @@
 
 	resp = msgin;
 	resp.tsp_vers = TSPVERSION;
-	(void)strcpy(resp.tsp_name, hostname);
+	strlcpy(resp.tsp_name, hostname, sizeof(resp.tsp_name));
 
 	switch(msgin.tsp_type) {
 
@@ -471,13 +471,9 @@
 	case TSP_SETTIME:
 	case TSP_SETDATE:
 	case TSP_SETDATEREQ:
-#ifdef sgi
-		(void)cftime(tm, "%D %T", &msg->tsp_time.tv_sec);
-#else
 		tsp_time_sec = msg->tsp_time.tv_sec;
-		strncpy(tm, ctime(&tsp_time_sec)+3+1, sizeof(tm));
+		strlcpy(tm, ctime(&tsp_time_sec)+3+1, sizeof(tm));
 		tm[15] = '\0';		/* ugh */
-#endif /* sgi */
 		fprintf(fd, "%s %d %-6u %s %-15s %s\n",
 			tsptype[msg->tsp_type],
 			msg->tsp_vers,
Index: slave.c
===================================================================
RCS file: /cvs/src/usr.sbin/timed/timed/slave.c,v
retrieving revision 1.4
diff -u -r1.4 slave.c
--- slave.c	13 Mar 2004 21:08:38 -0000	1.4
+++ slave.c	31 Aug 2004 08:23:35 -0000
@@ -39,6 +39,8 @@
 #include <setjmp.h>
 #include "pathnames.h"
 
+#define FASTTOUT 3
+
 extern jmp_buf jmpenv;
 extern int Mflag;
 extern int justquit;
@@ -53,20 +55,15 @@
 static void setmaster(struct tsp *);
 static void answerdelay(void);
 
-#ifdef sgi
-extern void logwtmp(struct timeval *, struct timeval *);
-#else
 extern void logwtmp(char *, char *, char *);
-#endif /* sgi */
 
 int
 slave(void)
 {
 	int tries;
-	long electiontime, refusetime, looktime, looptime, adjtime;
+	long electiontime, refusetime, looktime, looptime, adjusttime;
 	u_short seq;
 	long fastelection;
-#define FASTTOUT 3
 	struct in_addr cadr;
 	struct timeval otime;
 	struct sockaddr_in taddr;
@@ -85,9 +82,9 @@
 	old_slavenet = 0;
 	seq = 0;
 	refusetime = 0;
-	adjtime = 0;
+	adjusttime = 0;
 
-	(void)gettimeofday(&ntime, 0);
+	gettimeofday(&ntime, 0);
 	electiontime = ntime.tv_sec + delay2;
 	fastelection = ntime.tv_sec + FASTTOUT;
 	if (justquit)
@@ -107,7 +104,7 @@
 
 loop:
 	get_goodgroup(0);
-	(void)gettimeofday(&ntime, (struct timezone *)0);
+	gettimeofday(&ntime, (struct timezone *)0);
 	if (ntime.tv_sec > electiontime) {
 		if (trace)
 			fprintf(fd, "election timer expired\n");
@@ -136,7 +133,7 @@
 			makeslave(slavenet);	/* prune extras */
 			setstatus();
 		}
-		(void)gettimeofday(&ntime, 0);
+		gettimeofday(&ntime, 0);
 		looktime = ntime.tv_sec + delay2;
 	}
 	if (ntime.tv_sec >= looptime) {
@@ -148,7 +145,7 @@
 			to.tsp_vers = TSPVERSION;
 			to.tsp_seq = sequence++;
 			to.tsp_hopcnt = MAX_HOPCNT;
-			(void)strcpy(to.tsp_name, hostname);
+			strlcpy(to.tsp_name, hostname, sizeof(to.tsp_name));
 			bytenetorder(&to);
 			if (sendto(sock, (char *)&to, sizeof(struct tsp), 0,
 				   (struct sockaddr*)&ntp->dest_addr,
@@ -157,7 +154,7 @@
 			}
 		    }
 		}
-		(void)gettimeofday(&ntime, 0);
+		gettimeofday(&ntime, 0);
 		looptime = ntime.tv_sec + delay2;
 	}
 
@@ -229,8 +226,8 @@
 			 * Otherwise the clocks can race until the loop
 			 * is found.
 			 */
-			(void)gettimeofday(&otime, 0);
-			if (adjtime < otime.tv_sec)
+			gettimeofday(&otime, 0);
+			if (adjusttime < otime.tv_sec)
 				looptime -= (looptime-otime.tv_sec)/2 + 1;
 
 			setmaster(msg);
@@ -238,10 +235,10 @@
 				seq = msg->tsp_seq;
 				synch(tvtomsround(msg->tsp_time));
 			}
-			(void)gettimeofday(&ntime, 0);
+			gettimeofday(&ntime, 0);
 			electiontime = ntime.tv_sec + delay2;
 			fastelection = ntime.tv_sec + FASTTOUT;
-			adjtime = ntime.tv_sec + SAMPLEINTVL*2;
+			adjusttime = ntime.tv_sec + SAMPLEINTVL*2;
 			break;
 
 		case TSP_SETTIME:
@@ -252,20 +249,15 @@
 			seq = msg->tsp_seq;
 
 			/* adjust time for residence on the queue */
-			(void)gettimeofday(&otime, 0);
+			gettimeofday(&otime, 0);
 			adj_msg_time(msg,&otime);
-#ifdef sgi
-			(void)cftime(newdate, "%D %T", &msg->tsp_time.tv_sec);
-			(void)cftime(olddate, "%D %T", &otime.tv_sec);
-#else
 			/*
 			 * the following line is necessary due to syslog
 			 * calling ctime() which clobbers the static buffer
 			 */
-			(void)strcpy(olddate, date());
+			strlcpy(olddate, date(), sizeof(olddate));
 			tsp_time_sec = msg->tsp_time.tv_sec;
-			(void)strcpy(newdate, ctime(&tsp_time_sec));
-#endif /* sgi */
+			strlcpy(newdate, ctime(&tsp_time_sec), sizeof(newdate));
 
 			if (!good_host_name(msg->tsp_name)) {
 				syslog(LOG_NOTICE,
@@ -283,24 +275,17 @@
 				 */
 				synch(tvtomsround(ntime));
 			} else {
-#ifdef sgi
-				if (0 > settimeofday(&msg->tsp_time, 0)) {
-					syslog(LOG_ERR,"settimeofdate(): %m");
-					break;
-				}
-				logwtmp(&otime, &msg->tsp_time);
-#else
 				logwtmp("|", "date", "");
-				(void)settimeofday(&msg->tsp_time, 0);
+				settimeofday(&msg->tsp_time, 0);
 				logwtmp("{", "date", "");
-#endif /* sgi */
+
 				syslog(LOG_NOTICE,
 				       "date changed by %s from %s",
 					msg->tsp_name, olddate);
 				if (status & MASTER)
 					spreadtime();
 			}
-			(void)gettimeofday(&ntime, 0);
+			gettimeofday(&ntime, 0);
 			electiontime = ntime.tv_sec + delay2;
 			fastelection = ntime.tv_sec + FASTTOUT;
 
@@ -338,7 +323,7 @@
 			setstatus();
 			answerdelay();
 			xmit(TSP_SLAVEUP, 0, &from);
-			(void)gettimeofday(&ntime, 0);
+			gettimeofday(&ntime, 0);
 			electiontime = ntime.tv_sec + delay2;
 			fastelection = ntime.tv_sec + FASTTOUT;
 			refusetime = 0;
@@ -347,29 +332,21 @@
 		case TSP_MASTERREQ:
 			if (fromnet->status != SLAVE)
 				break;
-			(void)gettimeofday(&ntime, 0);
+			gettimeofday(&ntime, 0);
 			electiontime = ntime.tv_sec + delay2;
 			break;
 
 		case TSP_SETDATE:
-#ifdef sgi
-			(void)cftime(newdate, "%D %T", &msg->tsp_time.tv_sec);
-#else
-			tsp_time_sec = msg->tsp_time.tv_sec;
-			(void)strcpy(newdate, ctime(&tsp_time_sec));
-#endif /* sgi */
+                        tsp_time_sec = msg->tsp_time.tv_sec;
+                        strlcpy(newdate, ctime(&tsp_time_sec), sizeof(newdate));
 			schgdate(msg, newdate);
 			break;
 
 		case TSP_SETDATEREQ:
 			if (fromnet->status != MASTER)
 				break;
-#ifdef sgi
-			(void)cftime(newdate, "%D %T", &msg->tsp_time.tv_sec);
-#else
 			tsp_time_sec = msg->tsp_time.tv_sec;
-			(void)strcpy(newdate, ctime(&tsp_time_sec));
-#endif /* sgi */
+			strlcpy(newdate, ctime(&tsp_time_sec), sizeof(newdate));
 			htp = findhost(msg->tsp_name);
 			if (0 == htp) {
 				syslog(LOG_WARNING,
@@ -400,7 +377,7 @@
 
 		case TSP_ELECTION:
 			if (fromnet->status == SLAVE) {
-				(void)gettimeofday(&ntime, 0);
+				gettimeofday(&ntime, 0);
 				electiontime = ntime.tv_sec + delay2;
 				fastelection = ntime.tv_sec + FASTTOUT;
 				seq = 0;
@@ -422,8 +399,8 @@
 					refusetime = ntime.tv_sec + 30;
 				}
 				taddr = from;
-				(void)strcpy(tname, msg->tsp_name);
-				(void)strcpy(to.tsp_name, hostname);
+				strlcpy(tname, msg->tsp_name, sizeof(tname));
+				strlcpy(to.tsp_name, hostname, sizeof(to.tsp_name));
 				answerdelay();
 				if (!acksend(&to, &taddr, tname,
 					     TSP_ACK, 0, 0))
@@ -434,13 +411,13 @@
 			} else {	/* fromnet->status == MASTER */
 				htp = addmach(msg->tsp_name, &from,fromnet);
 				to.tsp_type = TSP_QUIT;
-				(void)strcpy(to.tsp_name, hostname);
+				strlcpy(to.tsp_name, hostname, sizeof(to.tsp_name));
 				if (!acksend(&to, &htp->addr, htp->name,
 					     TSP_ACK, 0, htp->noanswer)) {
 					syslog(LOG_ERR,
 					  "no reply from %s to ELECTION-QUIT",
 					       htp->name);
-					(void)remmach(htp);
+					remmach(htp);
 				}
 			}
 			break;
@@ -453,7 +430,7 @@
 			 * more than one master: the first slave to
 			 * come up will notify here the situation.
 			 */
-			(void)strcpy(to.tsp_name, hostname);
+			strlcpy(to.tsp_name, hostname, sizeof(to.tsp_name));
 
 			/* The other master often gets into the same state,
 			 * with boring results.
@@ -474,7 +451,7 @@
 					syslog(LOG_WARNING,
 				  "conflict error: no reply from %s to QUIT",
 						htp->name);
-					(void)remmach(htp);
+					remmach(htp);
 				}
 			}
 			masterup(ntp);
@@ -487,7 +464,7 @@
 			to.tsp_type = TSP_MSITEREQ;
 			to.tsp_vers = TSPVERSION;
 			to.tsp_seq = 0;
-			(void)strcpy(to.tsp_name, hostname);
+			strlcpy(to.tsp_name, hostname, sizeof(to.tsp_name));
 			answer = acksend(&to, &slavenet->dest_addr,
 					 ANYADDR, TSP_ACK,
 					 slavenet, 0);
@@ -495,7 +472,8 @@
 			    && good_host_name(answer->tsp_name)) {
 				setmaster(answer);
 				to.tsp_type = TSP_ACK;
-				(void)strcpy(to.tsp_name, answer->tsp_name);
+				strlcpy(to.tsp_name, answer->tsp_name,
+							sizeof(to.tsp_name));
 				bytenetorder(&to);
 				if (sendto(sock, (char *)&to,
 					   sizeof(struct tsp), 0,
@@ -545,9 +523,9 @@
 				    if (answer == NULL)
 					break;
 				    taddr = from;
-				    (void)strcpy(tname, answer->tsp_name);
+				    strlcpy(tname, answer->tsp_name, sizeof(tname));
 				    to.tsp_type = TSP_QUIT;
-				    (void)strcpy(to.tsp_name, hostname);
+				    strlcpy(to.tsp_name, hostname, sizeof(to.tsp_name));
 				    if (!acksend(&to, &taddr, tname,
 						 TSP_ACK, 0, 1)) {
 					syslog(LOG_ERR,
@@ -557,7 +535,7 @@
 					electiontime = 0;
 				    }
 				}
-				(void)gettimeofday(&ntime, 0);
+				gettimeofday(&ntime, 0);
 				looptime = ntime.tv_sec + FASTTOUT;
 			    } else {
 				if (msg->tsp_hopcnt-- < 1)
@@ -600,16 +578,16 @@
 				htp = addmach(answer->tsp_name,
 					      &from,ntp);
 				to.tsp_type = TSP_QUIT;
-				(void)strcpy(to.tsp_name, hostname);
+				strlcpy(to.tsp_name, hostname, sizeof(to.tsp_name));
 				if (!acksend(&to,&htp->addr,htp->name,
 					     TSP_ACK, 0, htp->noanswer)) {
 					syslog(LOG_ERR,
 				    "no reply from %s to master LOOP-QUIT",
 					       htp->name);
-					(void)remmach(htp);
+					remmach(htp);
 				}
 			    }
-			    (void)gettimeofday(&ntime, 0);
+			    gettimeofday(&ntime, 0);
 			    looptime = ntime.tv_sec + FASTTOUT;
 			}
 			break;
@@ -636,7 +614,7 @@
 	    && (slavenet != old_slavenet
 		|| strcmp(msg->tsp_name, master_name)
 		|| old_status != status)) {
-		(void)strcpy(master_name, msg->tsp_name);
+		strlcpy(master_name, msg->tsp_name, sizeof(master_name));
 		old_slavenet = slavenet;
 		old_status = status;
 
@@ -677,12 +655,12 @@
 	       msg->tsp_name, newdate);
 
 	/* adjust time for residence on the queue */
-	(void)gettimeofday(&otime, 0);
+	gettimeofday(&otime, 0);
 	adj_msg_time(msg, &otime);
 
 	to.tsp_type = TSP_SETDATEREQ;
 	to.tsp_time = msg->tsp_time;
-	(void)strcpy(to.tsp_name, hostname);
+	strlcpy(to.tsp_name, hostname, sizeof(to.tsp_name));
 	if (!acksend(&to, &slavenet->dest_addr,
 		     ANYADDR, TSP_DATEACK,
 		     slavenet, 0))
@@ -700,16 +678,12 @@
 answerdelay(void)
 {
 
-#ifdef sgi
-	sginap(delay1);
-#else
 	struct timeval timeout;
 
 	timeout.tv_sec = 0;
 	timeout.tv_usec = delay1;
 
-	(void)select(0, (fd_set *)NULL, (fd_set *)NULL, (fd_set *)NULL,
+	select(0, (fd_set *)NULL, (fd_set *)NULL, (fd_set *)NULL,
 	    &timeout);
 	return;
-#endif /* sgi */
 }
Index: timed.c
===================================================================
RCS file: /cvs/src/usr.sbin/timed/timed/timed.c,v
retrieving revision 1.4
diff -u -r1.4 timed.c
--- timed.c	13 Mar 2004 21:08:38 -0000	1.4
+++ timed.c	31 Aug 2004 08:30:24 -0000
@@ -46,11 +46,6 @@
 #include <math.h>
 #include <sys/types.h>
 #include <sys/times.h>
-#ifdef sgi
-#include <unistd.h>
-#include <sys/syssgi.h>
-#include <sys/schedctl.h>
-#endif /* sgi */
 
 int trace = 0;
 int sock, sock_raw = -1;
@@ -92,18 +87,6 @@
 static void checkignorednets(void);
 static void pickslavenet(struct netinfo *);
 static void add_good_host(char *, int);
-
-#ifdef sgi
-char *timetrim_fn;
-char *timetrim_wpat = "long timetrim = %ld;\ndouble tot_adj = %.0f;\ndouble tot_ticks = %.0f;\n/* timed version 2 */\n";
-char *timetrim_rpat = "long timetrim = %ld;\ndouble tot_adj = %lf;\ndouble tot_ticks = %lf;";
-long timetrim;
-double tot_adj, hr_adj;			/* totals in nsec */
-double tot_ticks, hr_ticks;
-
-int bufspace = 60*1024;
-#endif
-
 static void usage(void);
 
 /*
@@ -122,7 +105,7 @@
  * overhauled at Silicon Graphics
  */
 int
-main(int argc, char *argv[])
+main(int argc, char **argv)
 {
 	int on;
 	int ret;
@@ -140,32 +123,16 @@
 	struct sockaddr_in server;
 	u_short port;
 	char c;
-#ifdef sgi
-	FILE *timetrim_st;
-#endif
-
-#ifdef sgi
-	struct tms tms;
-#endif /* sgi */
-
 #ifdef lint
 	ntip = NULL;
-#endif
+#endif /* lint */
 
 	on = 1;
 	nflag = OFF;
 	iflag = OFF;
 
-#ifdef sgi
-	if (0 > syssgi(SGI_GETTIMETRIM, &timetrim)) {
-		warn("syssgi(GETTIMETRIM)");
-		timetrim = 0;
-	}
-	tot_ticks = hr_ticks = times(&tms);
-#endif /* sgi */
-
-	opterr = 0;
-	while ((c = getopt(argc, argv, "Mtdn:i:F:G:P:")) != -1) {
+        opterr = 0;
+        while ((c = getopt(argc, argv, "Mtdn:i:F:G:P:")) != -1) {
 		switch (c) {
 		case 'M':
 			Mflag = 1;
@@ -207,49 +174,6 @@
 				errx(1, "only one net group");
 			goodgroup = optarg;
 			break;
-#ifdef sgi
-		case 'P':
-			timetrim_fn = optarg;
-			timetrim_st = fopen(timetrim_fn, "r+");
-			if (0 == timetrim_st) {
-				if (errno != ENOENT) {
-					warn("%s", timetrim_fn);
-					timetrim_fn = 0;
-				}
-			} else {
-				int i;
-				long trim;
-				double adj, ticks;
-
-				i = fscanf(timetrim_st, timetrim_rpat,
-					   &trim, &adj, &ticks);
-				if (i < 1
-				    || trim > MAX_TRIM
-				    || trim < -MAX_TRIM
-				    || i == 2
-				    || (i == 3
-					&& trim != rint(adj*CLK_TCK/ticks))) {
-					if (trace && i != EOF)
-						warn(
-						"unrecognized contents in %s",
-							      timetrim_fn);
-				} else {
-					if (0 > syssgi(SGI_SETTIMETRIM,
-						       trim)) {
-					 warn("syssgi(SETTIMETRIM)");
-					} else {
-						timetrim = trim;
-					}
-					if (i == 3) {
-						tot_adj = adj;
-						tot_ticks -= ticks;
-					}
-				}
-				(void)fclose(timetrim_st);
-			}
-			break;
-#endif /* sgi */
-
 		default:
 			usage();
 			break;
@@ -296,27 +220,17 @@
 			warn("bind");
 		exit(1);
 	}
-#ifdef sgi
-	/*
-	 * handle many slaves with our buffer
-	 */
-	if (0 > setsockopt(sock, SOL_SOCKET, SO_RCVBUF, (char*)&bufspace,
-			 sizeof(bufspace)))
-		err(1, "setsockopt");
-#endif /* sgi */
 
 	/* choose a unique seed for random number generation */
-	(void)gettimeofday(&ntime, 0);
+	gettimeofday(&ntime, 0);
 	srandom(ntime.tv_sec + ntime.tv_usec);
 
 	sequence = random();     /* initial seq number */
 
-#ifndef sgi
 	/* rounds kernel variable time to multiple of 5 ms. */
 	ntime.tv_sec = 0;
 	ntime.tv_usec = -((ntime.tv_usec/1000) % 5) * 1000;
-	(void)adjtime(&ntime, (struct timeval *)0);
-#endif /* sgi */
+	adjtime(&ntime, (struct timeval *)0);
 
 	for (nt = nets; nt; nt = nt->next) {
 		nentp = getnetbyname(nt->name);
@@ -348,11 +262,7 @@
 	if (ioctl(sock, SIOCGIFCONF, (char *)&ifc) < 0)
 		err(1, "get interface configuration");
 	ntp = NULL;
-#ifdef sgi
-#define size(p)	(sizeof(*ifr) - sizeof(ifr->ifr_name))  /* XXX hack. kludge */
-#else
 #define size(p)	max((p).sa_len, sizeof(p))
-#endif
 	cplim = buf + ifc.ifc_len; /*skip over if's with big ifr_addr's */
 	for (cp = buf; cp < cplim;
 			cp += sizeof (ifr->ifr_name) + size(ifr->ifr_addr)) {
@@ -425,32 +335,19 @@
 		ntp = NULL;
 	}
 	if (ntp)
-		(void) free((char *)ntp);
+		free((char *)ntp);
 	if (nettab == NULL)
 		errx(1, "no network usable");
 
-
-#ifdef sgi
-	(void)schedctl(RENICE,0,10);	   /* run fast to get good time */
-
-	/* ticks to delay before responding to a broadcast */
-	delay1 = casual(0, CLK_TCK/10);
-#else
-
 	/* microseconds to delay before responding to a broadcast */
 	delay1 = casual(1, 100*1000);
-#endif /* sgi */
 
 	/* election timer delay in secs. */
 	delay2 = casual(MINTOUT, MAXTOUT);
 
 
-#ifdef sgi
-	(void)_daemonize(debug ? _DF_NOFORK|_DF_NOCHDIR : 0, sock, -1, -1);
-#else
 	if (!debug)
 		daemon(debug, 0);
-#endif /* sgi */
 
 	if (trace)
 		traceon();
@@ -492,7 +389,7 @@
 		setstatus();
 		if (!(status & MASTER) && sock_raw != -1) {
 			/* sock_raw is not being used now */
-			(void)close(sock_raw);
+			close(sock_raw);
 			sock_raw = -1;
 		}
 
@@ -503,7 +400,7 @@
 
 	} else {
 		if (sock_raw != -1) {
-			(void)close(sock_raw);
+			close(sock_raw);
 			sock_raw = -1;
 		}
 
@@ -530,11 +427,6 @@
 usage(void)
 {
 
-#ifdef sgi
-	fprintf(stderr, "%s\n%s\n",
-"usage: timed [-dtM] [-i net|-n net] [-F host1 host2 ...]",
-"             [-G netgp] [-P trimfile]");
-#else
 #ifdef HAVENIS
 	fprintf(stderr, 
 "usage: timed [-dtM] [-i net|-n net] [-F host1 host2 ...] [-G netgp]\n");
@@ -542,7 +434,6 @@
 	fprintf(stderr,
 "usage: timed [-dtM] [-i net|-n net] [-F host1 host2 ...]\n");
 #endif /* HAVENIS */
-#endif /* sgi */
 	exit(1);
 }
 
@@ -560,7 +451,7 @@
 	if (trace)
 		fprintf(fd, "suppress: %s\n", name);
 	tgt = *addr;
-	(void)strcpy(tname, name);
+	strlcpy(tname, name, sizeof(tname));
 
 	while (0 != readmsg(TSP_ANY, ANYADDR, &wait, net)) {
 		if (trace)
@@ -570,8 +461,8 @@
 
 	syslog(LOG_NOTICE, "suppressing false master %s", tname);
 	msg.tsp_type = TSP_QUIT;
-	(void)strcpy(msg.tsp_name, hostname);
-	(void)acksend(&msg, &tgt, tname, TSP_ACK, 0, 1);
+	strlcpy(msg.tsp_name, hostname, sizeof(msg.tsp_name));
+	acksend(&msg, &tgt, tname, TSP_ACK, 0, 1);
 }
 
 void
@@ -587,7 +478,7 @@
 
 	/* look for master */
 	resp.tsp_type = TSP_MASTERREQ;
-	(void)strcpy(resp.tsp_name, hostname);
+	strlcpy(resp.tsp_name, hostname, sizeof(resp.tsp_name));
 	answer = acksend(&resp, &ntp->dest_addr, ANYADDR,
 			 TSP_MASTERACK, ntp, 0);
 	if (answer != 0 && !good_host_name(answer->tsp_name)) {
@@ -642,7 +533,7 @@
 	}
 
 	ntp->status = SLAVE;
-	(void)strcpy(mastername, answer->tsp_name);
+	strlcpy(mastername, answer->tsp_name, sizeof(mastername));
 	masteraddr = from;
 
 	/*
@@ -660,7 +551,7 @@
 	if (answer != NULL &&
 	    strcmp(answer->tsp_name, mastername) != 0) {
 		conflict.tsp_type = TSP_CONFLICT;
-		(void)strcpy(conflict.tsp_name, hostname);
+		strlcpy(conflict.tsp_name, hostname, sizeof(conflict.tsp_name));
 		if (!acksend(&conflict, &masteraddr, mastername,
 			     TSP_ACK, 0, 0)) {
 			syslog(LOG_ERR,
@@ -796,21 +687,12 @@
 char *
 date(void)
 {
-#ifdef sgi
-	struct	timeval tv;
-	static char tm[32];
-
-	(void)gettimeofday(&tv, (struct timezone *)0);
-	(void)cftime(tm, "%D %T", &tv.tv_sec);
-	return (tm);
-#else
 	struct	timeval tv;
 	time_t	tv_sec;
 
-	(void)gettimeofday(&tv, (struct timezone *)0);
+	gettimeofday(&tv, (struct timezone *)0);
 	tv_sec = tv.tv_sec;
 	return (ctime(&tv_sec));
-#endif /* sgi */
 }
 
 void
@@ -842,7 +724,7 @@
 	}
 
 	bzero((char*)ghp, sizeof(*ghp));
-	(void)strncpy(&ghp->name[0], name, sizeof(ghp->name));
+	strncpy(&ghp->name[0], name, sizeof(ghp->name));
 	ghp->next = goodhosts;
 	ghp->perm = perm;
 	goodhosts = ghp;
@@ -897,21 +779,21 @@
 	 */
 	if (!innetgr(goodgroup, &hostname[0], 0,0)) {
 		if (trace)
-			(void)fprintf(fd, "get_goodgroup: %s not in %s\n",
+			fprintf(fd, "get_goodgroup: %s not in %s\n",
 				      &hostname[0], goodgroup);
 		return;
 	}
 	if (trace)
-		(void)fprintf(fd, "get_goodgroup: %s in %s\n",
+		fprintf(fd, "get_goodgroup: %s in %s\n",
 				  &hostname[0], goodgroup);
 
 	/* mark the entire netgroup as trusted */
-	(void)setnetgrent(goodgroup);
+	setnetgrent(goodgroup);
 	while (getnetgrent(&mach,&usr,&dom)) {
 		if (0 != mach)
 			add_good_host(mach,0);
 	}
-	(void)endnetgrent();
+	endnetgrent();
 
 	/* update list of slaves */
 	for (htp = self.l_fwd; htp != &self; htp = htp->l_fwd) {
