$NetBSD: patch-ae,v 1.1.1.1 2000/01/21 19:15:59 bouyer Exp $

--- apcserial.c.orig	Wed Apr  7 18:06:41 1999
+++ apcserial.c	Fri Jan  7 18:54:39 2000
@@ -59,7 +59,9 @@
 
 #include <stdio.h>
 #include <unistd.h>
+#ifndef __NetBSD__
 #include <getopt.h>
+#endif /* __NetBSD__ */
 #include <stdlib.h>
 #include <stdarg.h>
 #include <fcntl.h>
@@ -135,10 +137,10 @@
 	newtio.c_oflag = 0;                  /* Raw output */
 	newtio.c_lflag = 0;                  /* No local echo */
 
-#ifdef __freebsd__
+#if defined(__freebsd__) || defined (__NetBSD__)
 	newtio.c_ispeed = DEFAULT_SPEED;     /* Set input speed */
 	newtio.c_ospeed = DEFAULT_SPEED;     /* Set output speed */
-#endif /* __freebsd__ */
+#endif /* __freebsd__  || __NetBSD__ */
 
 	/* w.p. This makes a non.blocking read() with 5 sec. timeout */
 	newtio.c_cc[VMIN] = 0;
@@ -195,7 +197,6 @@
 {
 	char response[32];                                         /* w.p. */
 	char a;
-	FILE *pwdf;
 	int errflag = 0;
 	response[0] = '\0';
 
@@ -230,19 +231,6 @@
 				}
 			}
 		}
-		if ((((pwdf = fopen(PWRFAIL, "r" )) == NULL) &&
-		    (ups->mode.type != BK)) ||
-		    (((pwdf = fopen(PWRFAIL, "r" )) == NULL) &&
-		    (ups->LineUp != 0) && (ups->mode.type == BK))) {
-			fprintf(stderr,
-			        "%s: Attempting to kill the power!\n" \
-			        "%s: Nice TRY but not TODAY!\n" \
-			        "%s: Shutdown not called first.\n" \
-			        "%s: Bug found by Tom Kunicki\n",
-			        ups->argvalue, ups->argvalue,
-			        ups->argvalue, ups->argvalue);
-			terminate(0);
-		} else {
 			errflag=0;                             /* w.p. */
 			if ((ups->class.type == SHAREMASTER) ||
 			    (ups->class.type == SHARENETMASTER)) {
@@ -259,7 +247,6 @@
 					ups->argvalue);
 				sleep(15);
 			}
-			fclose(pwdf);
 
 			fprintf(stderr,
 				"%s: Attempting to kill the power!\n",
@@ -407,9 +394,7 @@
 				}
 			}
 			/* w.p. */
-			sleep(10);
 			terminate(0);
-		}
 	} else {
 		if (ups->mode.type <= SHAREBASIC) {
 			switch(ups->cable.type) {
