X-Git-Url: http://git.ozlabs.org/?p=ppp.git;a=blobdiff_plain;f=pppstats%2Fpppstats.c;h=a0d3d7f5b6d00f6968ff5c5d9f99b25d5ba43a0d;hp=78cc3701d905bf30fcb1fa6eb9c97f0cd7afbb34;hb=3371dbae2932c2f3035587d05962240d95b1f63b;hpb=c884c1875f46508c98873d0d3c2559d9b0f12a1b diff --git a/pppstats/pppstats.c b/pppstats/pppstats.c index 78cc370..a0d3d7f 100644 --- a/pppstats/pppstats.c +++ b/pppstats/pppstats.c @@ -31,8 +31,12 @@ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ +#ifndef __STDC__ +#define const +#endif + #ifndef lint -static char rcsid[] = "$Id: pppstats.c,v 1.24 1999/01/20 00:02:21 paulus Exp $"; +static const char rcsid[] = "$Id: pppstats.c,v 1.28 2000/04/24 02:54:18 masputra Exp $"; #endif #include @@ -49,7 +53,8 @@ static char rcsid[] = "$Id: pppstats.c,v 1.24 1999/01/20 00:02:21 paulus Exp $"; #include #ifndef STREAMS -#if defined(_linux_) && defined(__powerpc__) +#if defined(_linux_) && defined(__powerpc__) \ + && (__GLIBC__ == 2 && __GLIBC_MINOR__ == 0) /* kludge alert! */ #undef __GLIBC__ #endif @@ -94,6 +99,14 @@ extern int optind; extern char *optarg; #endif +/* + * If PPP_DRV_NAME is not defined, use the legacy "ppp" as the + * device name. + */ +#if !defined(PPP_DRV_NAME) +#define PPP_DRV_NAME "ppp" +#endif /* !defined(PPP_DRV_NAME) */ + static void usage __P((void)); static void catchalarm __P((int)); static void get_ppp_stats __P((struct ppp_stats *)); @@ -439,7 +452,7 @@ main(argc, argv) char *dev; #endif - interface = "ppp0"; + interface = PPP_DRV_NAME "0"; if ((progname = strrchr(argv[0], '/')) == NULL) progname = argv[0]; else @@ -493,7 +506,7 @@ main(argc, argv) if (argc > 0) interface = argv[0]; - if (sscanf(interface, "ppp%d", &unit) != 1) { + if (sscanf(interface, PPP_DRV_NAME "%d", &unit) != 1) { fprintf(stderr, "%s: invalid interface '%s' specified\n", progname, interface); } @@ -525,7 +538,7 @@ main(argc, argv) #ifdef __osf__ dev = "/dev/streams/ppp"; #else - dev = "/dev/ppp"; + dev = "/dev/" PPP_DRV_NAME; #endif if ((s = open(dev, O_RDONLY)) < 0) { fprintf(stderr, "%s: couldn't open ", progname);