note other reasons for pclose to return -1; wait(2) -> wait4(2)
[unix-history] / usr / src / usr.bin / tip / log.c
index a911900..28f7bcd 100644 (file)
@@ -1,9 +1,27 @@
+/*
+ * Copyright (c) 1983 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the above copyright notice and this paragraph are
+ * duplicated in all such forms and that any documentation,
+ * advertising materials, and other materials related to such
+ * distribution and use acknowledge that the software was developed
+ * by the University of California, 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'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ */
+
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)log.c      4.6 (Berkeley) %G%";
-#endif
+static char sccsid[] = "@(#)log.c      5.3 (Berkeley) %G%";
+#endif /* not lint */
 
 #include "tip.h"
 
 
 #include "tip.h"
 
+#ifdef ACULOG
 static FILE *flog = NULL;
 
 /*
 static FILE *flog = NULL;
 
 /*
@@ -39,16 +57,14 @@ logent(group, num, acu, message)
                num,
 #endif
                acu, message);
                num,
 #endif
                acu, message);
-       fflush(flog);
+       (void) fflush(flog);
        (void) flock(fileno(flog), LOCK_UN);
 }
 
 loginit()
 {
        (void) flock(fileno(flog), LOCK_UN);
 }
 
 loginit()
 {
-
-#ifdef ACULOG
        flog = fopen(value(LOG), "a");
        if (flog == NULL)
        flog = fopen(value(LOG), "a");
        if (flog == NULL)
-               fprintf(stderr, "can't open log file\r\n");
-#endif
+               fprintf(stderr, "can't open log file %s.\r\n", value(LOG));
 }
 }
+#endif