+ int arg;
+{
+ signalled = 1;
+}
+
+#ifndef __svr4__
+get_ppp_stats(curp)
+ struct ppp_stats *curp;
+{
+ struct ifpppstatsreq req;
+
+ memset (&req, 0, sizeof (req));
+
+#ifdef _linux_
+ req.stats_ptr = (caddr_t) &req.stats;
+#undef ifr_name
+#define ifr_name ifr__name
+#endif
+
+ sprintf(req.ifr_name, "ppp%d", unit);
+ if (ioctl(s, SIOCGPPPSTATS, &req) < 0) {
+ if (errno == ENOTTY)
+ fprintf(stderr, "pppstats: kernel support missing\n");
+ else
+ perror("ioctl(SIOCGPPPSTATS)");
+ exit(1);
+ }
+ *curp = req.stats;
+}
+
+get_ppp_cstats(csp)
+ struct ppp_comp_stats *csp;
+{
+ struct ifpppcstatsreq creq;
+
+ memset (&creq, 0, sizeof (creq));
+
+#ifdef _linux_
+ creq.stats_ptr = (caddr_t) &creq.stats;
+#undef ifr_name
+#define ifr_name ifr__name
+#endif
+
+ sprintf(creq.ifr_name, "ppp%d", unit);
+ if (ioctl(s, SIOCGPPPCSTATS, &creq) < 0) {
+ if (errno == ENOTTY) {
+ fprintf(stderr, "pppstats: no kernel compression support\n");
+ if (cflag)
+ exit(1);
+ rflag = 0;
+ } else {
+ perror("ioctl(SIOCGPPPCSTATS)");
+ exit(1);
+ }
+ }
+ *csp = creq.stats;
+}
+
+#else /* __svr4__ */
+get_ppp_stats(curp)
+ struct ppp_stats *curp;
+{
+ if (strioctl(s, PPPIO_GETSTAT, curp, 0, sizeof(*curp)) < 0) {
+ if (errno == EINVAL)
+ fprintf(stderr, "pppstats: kernel support missing\n");
+ else
+ perror("pppstats: Couldn't get statistics");
+ exit(1);
+ }
+}
+
+get_ppp_cstats(csp)
+ struct ppp_comp_stats *csp;
+{
+ if (strioctl(s, PPPIO_GETCSTAT, csp, 0, sizeof(*csp)) < 0) {
+ if (errno == ENOTTY) {
+ fprintf(stderr, "pppstats: no kernel compression support\n");
+ if (cflag)
+ exit(1);
+ rflag = 0;
+ } else {
+ perror("pppstats: Couldn't get compression statistics");
+ exit(1);
+ }
+ }
+}
+
+int
+strioctl(fd, cmd, ptr, ilen, olen)
+ int fd, cmd, ilen, olen;
+ char *ptr;