]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/sys-svr4.c
remove a couple of ansi-C-isms.
[ppp.git] / pppd / sys-svr4.c
index efaaef02151b783d02224f5a11fa53ba65980a02..461e53640979373dbe328928a5c591fec4da4784 100644 (file)
@@ -26,7 +26,7 @@
  */
 
 #ifndef lint
-static char rcsid[] = "$Id: sys-svr4.c,v 1.25 1999/03/16 02:57:07 paulus Exp $";
+static char rcsid[] = "$Id: sys-svr4.c,v 1.28 1999/03/19 04:23:52 paulus Exp $";
 #endif
 
 #include <limits.h>
@@ -260,7 +260,7 @@ ppp_available()
 /*
  * establish_ppp - Turn the serial port into a ppp interface.
  */
-void
+int
 establish_ppp(fd)
     int fd;
 {
@@ -290,6 +290,8 @@ establish_ppp(fd)
     /* Link the serial port under the PPP multiplexor. */
     if ((fdmuxid = ioctl(pppfd, I_LINK, fd)) < 0)
        fatal("Can't link tty to PPP mux: %m");
+
+    return pppfd;
 }
 
 /*
@@ -624,9 +626,10 @@ int fd, on;
  * in demand mode.  Under Solaris 2, we use our existing fd
  * to the ppp driver.
  */
-void
+int
 open_ppp_loopback()
 {
+    return pppfd;
 }
 
 /*
@@ -680,7 +683,8 @@ wait_input(timo)
 /*
  * add_fd - add an fd to the set that wait_input waits for.
  */
-void add_fd(int fd)
+void add_fd(fd)
+    int fd;
 {
     int n;
 
@@ -698,7 +702,8 @@ void add_fd(int fd)
 /*
  * remove_fd - remove an fd from the set that wait_input waits for.
  */
-void remove_fd(int fd)
+void remove_fd(fd)
+    int fd;
 {
     int n;
 
@@ -831,7 +836,7 @@ ppp_send_config(unit, mtu, asyncmap, pcomp, accomp)
 
     /* set the MTU for IP as well */
     memset(&ifr, 0, sizeof(ifr));
-    strlcpy(ifr.ifr_name, sizeof(ifr.ifr_name), ifname);
+    strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
     ifr.ifr_metric = link_mtu;
     if (ioctl(ipfd, SIOCSIFMTU, &ifr) < 0) {
        error("Couldn't set IP MTU: %m");
@@ -927,6 +932,21 @@ get_idle_time(u, ip)
     return strioctl(pppfd, PPPIO_GIDLE, ip, 0, sizeof(struct ppp_idle)) >= 0;
 }
 
+/*
+ * get_ppp_stats - return statistics for the link.
+ */
+int
+get_ppp_stats(u, stats)
+    int u;
+    struct ppp_stats *stats;
+{
+    if (strioctl(pppfd, PPPIO_GETSTAT, stats, 0, sizeof(*stats)) < 0) {
+       error("Couldn't get link statistics: %m");
+       return 0;
+    }
+    return 1;
+}
+
 #if 0
 /*
  * set_filters - transfer the pass and active filters to the kernel.
@@ -1013,7 +1033,7 @@ sifup(u)
 {
     struct ifreq ifr;
 
-    strlcpy(ifr.ifr_name, sizeof(ifr.ifr_name), ifname);
+    strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
     if (ioctl(ipfd, SIOCGIFFLAGS, &ifr) < 0) {
        error("Couldn't mark interface up (get): %m");
        return 0;
@@ -1038,7 +1058,7 @@ sifdown(u)
 
     if (ipmuxid < 0)
        return 1;
-    strlcpy(ifr.ifr_name, sizeof(ifr.ifr_name), ifname);
+    strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
     if (ioctl(ipfd, SIOCGIFFLAGS, &ifr) < 0) {
        error("Couldn't mark interface down (get): %m");
        return 0;
@@ -1086,7 +1106,7 @@ sifaddr(u, o, h, m)
     int ret = 1;
 
     memset(&ifr, 0, sizeof(ifr));
-    strlcpy(ifr.ifr_name, sizeof(ifr.ifr_name), ifname);
+    strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
     ifr.ifr_addr.sa_family = AF_INET;
     INET_ADDR(ifr.ifr_addr) = m;
     if (ioctl(ipfd, SIOCSIFNETMASK, &ifr) < 0) {
@@ -1298,7 +1318,7 @@ get_ether_addr(ipaddr, hwaddr)
        /*
         * Check that the interface is up, and not point-to-point or loopback.
         */
-       strlcpy(ifreq.ifr_name, sizeof(ifreq.ifr_name), ifr->ifr_name);
+       strlcpy(ifreq.ifr_name, ifr->ifr_name, sizeof(ifreq.ifr_name));
        if (ioctl(ipfd, SIOCGIFFLAGS, &ifreq) < 0)
            continue;
        if ((ifreq.ifr_flags &
@@ -1547,7 +1567,7 @@ GetMask(addr)
        /*
         * Check that the interface is up, and not point-to-point or loopback.
         */
-       strlcpy(ifreq.ifr_name, sizeof(ifreq.ifr_name), ifr->ifr_name);
+       strlcpy(ifreq.ifr_name, ifr->ifr_name, sizeof(ifreq.ifr_name));
        if (ioctl(ipfd, SIOCGIFFLAGS, &ifreq) < 0)
            continue;
        if ((ifreq.ifr_flags & (IFF_UP|IFF_POINTOPOINT|IFF_LOOPBACK))
@@ -1576,9 +1596,9 @@ logwtmp(line, name, host)
 
     if (name[0] != 0) {
        /* logging in */
-       strlcpy(utmpx.ut_user, sizeof(utmpx.ut_user), name);
-       strlcpy(utmpx.ut_id, sizeof(utmpx.ut_id), ifname);
-       strlcpy(utmpx.ut_line, sizeof(utmpx.ut_line), line);
+       strlcpy(utmpx.ut_user, name, sizeof(utmpx.ut_user));
+       strlcpy(utmpx.ut_id, ifname, sizeof(utmpx.ut_id));
+       strlcpy(utmpx.ut_line, line, sizeof(utmpx.ut_line));
        utmpx.ut_pid = getpid();
        utmpx.ut_type = USER_PROCESS;
     } else {