X-Git-Url: http://git.ozlabs.org/?p=ppp.git;a=blobdiff_plain;f=pppstats%2Fpppstats.c;h=a0d3d7f5b6d00f6968ff5c5d9f99b25d5ba43a0d;hp=2881f047a527d0496b882d9afd9866b7e9682362;hb=3371dbae2932c2f3035587d05962240d95b1f63b;hpb=bc86389e1fd7c1eb6ea517a40a1e27274065c739 diff --git a/pppstats/pppstats.c b/pppstats/pppstats.c index 2881f04..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.25 1999/04/16 11:36:51 paulus Exp $"; +static const char rcsid[] = "$Id: pppstats.c,v 1.28 2000/04/24 02:54:18 masputra Exp $"; #endif #include @@ -95,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 *)); @@ -440,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 @@ -494,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); } @@ -526,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);