]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/main.c
include optional callback support
[ppp.git] / pppd / main.c
index 170db95cfb4c610c109fa27da268fe63fdeca564..273e90a822a350390f2e3a4db6110283e3dcc2e8 100644 (file)
@@ -18,7 +18,7 @@
  */
 
 #ifndef lint
-static char rcsid[] = "$Id: main.c,v 1.35 1996/08/28 06:41:16 paulus Exp $";
+static char rcsid[] = "$Id: main.c,v 1.38 1996/10/08 04:35:03 paulus Exp $";
 #endif
 
 #include <stdio.h>
@@ -52,6 +52,10 @@ static char rcsid[] = "$Id: main.c,v 1.35 1996/08/28 06:41:16 paulus Exp $";
 #include "pathnames.h"
 #include "patchlevel.h"
 
+#ifdef CBCP_SUPPORT
+#include "cbcp.h"
+#endif
+
 #if defined(SUNOS4)
 extern char *strerror();
 #endif
@@ -120,7 +124,7 @@ extern      char    *getlogin __P((void));
 #define        O_NONBLOCK      O_NDELAY
 #endif
 
-#ifdef PRIMITIVE_SYSLOG
+#ifdef ULTRIX
 #define setlogmask(x)
 #endif
 
@@ -133,6 +137,9 @@ struct protent *protocols[] = {
     &lcp_protent,
     &pap_protent,
     &chap_protent,
+#ifdef CBCP_SUPPORT
+    &cbcp_protent,
+#endif
     &ipcp_protent,
     &ccp_protent,
 #ifdef IPX_CHANGE
@@ -163,7 +170,7 @@ main(argc, argv)
     strcpy(default_devnam, devnam);
 
     /* Initialize syslog facilities */
-#ifdef PRIMITIVE_SYSLOG
+#ifdef ULTRIX
     openlog("pppd", LOG_PID);
 #else
     openlog("pppd", LOG_PID | LOG_NDELAY, LOG_PPP);
@@ -515,14 +522,9 @@ main(argc, argv)
         * real serial device back to its normal mode of operation.
         */
        clean_check();
-#ifdef _linux_
-       disestablish_ppp(ttyfd);
-#endif
        if (demand)
            restore_loop();
-#ifndef _linux_
        disestablish_ppp(ttyfd);
-#endif
 
        /*
         * Run disconnector script, if requested.
@@ -1317,7 +1319,11 @@ fmtmsg __V((char *buf, int buflen, char *fmt, ...))
 #define OUTCHAR(c)     (buflen > 0? (--buflen, *buf++ = (c)): 0)
 
 int
-vfmtmsg(char *buf, int buflen, char *fmt, va_list args)
+vfmtmsg(buf, buflen, fmt, args)
+    char *buf;
+    int buflen;
+    char *fmt;
+    va_list args;
 {
     int c, i, n;
     int width, prec, fillch;
@@ -1325,10 +1331,10 @@ vfmtmsg(char *buf, int buflen, char *fmt, va_list args)
     unsigned long val;
     char *str, *f, *buf0;
     unsigned char *p;
-    va_list a;
+    void *a;
     char num[32];
     time_t t;
-    static char hexchars[16] = "0123456789abcdef";
+    static char hexchars[] = "0123456789abcdef";
 
     buf0 = buf;
     --buflen;
@@ -1417,7 +1423,11 @@ vfmtmsg(char *buf, int buflen, char *fmt, va_list args)
            break;
        case 'r':
            f = va_arg(args, char *);
-           a = va_arg(args, va_list);
+           /*
+            * XXX We assume a va_list is either a pointer or an array, so
+            * what gets passed for a va_list is like a void * in some sense.
+            */
+           a = va_arg(args, void *);
            n = vfmtmsg(buf, buflen + 1, f, a);
            buf += n;
            buflen -= n;