]> git.ozlabs.org Git - ppp.git/blobdiff - chat/chat.c
rewrite the pid file when using updetach
[ppp.git] / chat / chat.c
index 006841359ee0b9a1848c9a296ee36c0514485ae2..409285666644e8cecef28e677a66d46e47de61b7 100644 (file)
@@ -78,7 +78,7 @@
  */
 
 #ifndef lint
-static char rcsid[] = "$Id: chat.c,v 1.16 1997/11/27 06:00:06 paulus Exp $";
+static char rcsid[] = "$Id: chat.c,v 1.19 1998/03/24 23:57:48 paulus Exp $";
 #endif
 
 #include <stdio.h>
@@ -106,15 +106,6 @@ static char rcsid[] = "$Id: chat.c,v 1.16 1997/11/27 06:00:06 paulus Exp $";
 #include <termios.h>
 #endif
 
-#if __STDC__
-#include <stdarg.h>
-#define __V(x) x
-#else
-#include <varargs.h>
-#define __V(x) (va_alist) va_dcl
-#define const
-#endif
-
 #define        STR_LEN 1024
 
 #ifndef SIGTYPE
@@ -139,9 +130,17 @@ static char rcsid[] = "$Id: chat.c,v 1.16 1997/11/27 06:00:06 paulus Exp $";
 #define O_NONBLOCK     O_NDELAY
 #endif
 
+#ifdef SUNOS
+extern int sys_nerr;
+extern char *sys_errlist[];
+#define memmove(to, from, n)   bcopy(from, to, n)
+#define strerror(n)            ((unsigned)(n) < sys_nerr? sys_errlist[(n)] :\
+                                "unknown error")
+#endif
+
 /*************** Micro getopt() *********************************************/
 #define        OPTION(c,v)     (_O&2&&**v?*(*v)++:!c||_O&4?0:(!(_O&1)&& \
-                               ((--c,++v),_O=4,c)&&**v=='-'&&v[0][1]?*++*v=='-'\
+                               (--c,++v),_O=4,c&&**v=='-'&&v[0][1]?*++*v=='-'\
                                &&!v[0][1]?(--c,++v,0):(_O=2,*(*v)++):0))
 #define        OPTARG(c,v)     (_O&2?**v||(++v,--c)?(_O=1,--c,*v++): \
                                (_O=4,(char*)0):(char*)0)
@@ -470,7 +469,7 @@ void logf __V((const char *fmt, ...))
 {
     va_list args;
 
-#if __STDC__
+#ifdef __STDC__
     va_start(args, fmt);
 #else
     char *fmt;
@@ -493,7 +492,7 @@ void fatal __V((int code, const char *fmt, ...))
 {
     va_list args;
 
-#if __STDC__
+#ifdef __STDC__
     va_start(args, fmt);
 #else
     int code;
@@ -1013,7 +1012,6 @@ register char *s;
 
     if (clear_abort_next) {
        char *s1;
-       char *s2 = s;
        int   i;
         int   old_max;
        int   pack = 0;
@@ -1064,7 +1062,6 @@ register char *s;
 
     if (clear_report_next) {
        char *s1;
-        char *s2 = s;
        int   i;
        int   old_max;
        int   pack = 0;
@@ -1417,6 +1414,16 @@ register char *string;
     return (0);
 }
 
+/*
+ * Gross kludge to handle Solaris versions >= 2.6 having usleep.
+ */
+#ifdef SOL2
+#include <sys/param.h>
+#if MAXUID > 65536             /* then this is Solaris 2.6 or later */
+#undef NO_USLEEP
+#endif
+#endif /* SOL2 */
+
 #ifdef NO_USLEEP
 #include <sys/types.h>
 #include <sys/time.h>
@@ -1487,7 +1494,6 @@ vfmtmsg(buf, buflen, fmt, args)
     const char *f;
     unsigned char *p;
     char num[32];
-    time_t t;
     static char hexchars[] = "0123456789abcdef";
 
     buf0 = buf;