summaryrefslogtreecommitdiff
path: root/usr.sbin/pppoe/pppoe.c
diff options
context:
space:
mode:
authorJason Wright <jason@cvs.openbsd.org>2002-01-10 18:21:39 +0000
committerJason Wright <jason@cvs.openbsd.org>2002-01-10 18:21:39 +0000
commit7beade2358c530484e4e2b29617f6ed63cccefe8 (patch)
tree512a058a989087a9b4f11301072300e9f2054204 /usr.sbin/pppoe/pppoe.c
parent6a745c978f7587badbe55d473f25be8d951da5b0 (diff)
Use IFNAMSIZ for strlcpy() and also pretty the man page
(from PR2315; Jason Ackley <jason@ackley.net>)
Diffstat (limited to 'usr.sbin/pppoe/pppoe.c')
-rw-r--r--usr.sbin/pppoe/pppoe.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/usr.sbin/pppoe/pppoe.c b/usr.sbin/pppoe/pppoe.c
index c0de4db6707..6c6597bf98e 100644
--- a/usr.sbin/pppoe/pppoe.c
+++ b/usr.sbin/pppoe/pppoe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pppoe.c,v 1.5 2001/11/29 16:49:09 miod Exp $ */
+/* $OpenBSD: pppoe.c,v 1.6 2002/01/10 18:21:38 jason Exp $ */
/*
* Copyright (c) 2000 Network Security Technologies, Inc. http://www.netsec.net
@@ -60,7 +60,7 @@ int option_verbose = 0;
u_char etherbroadcastaddr[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
int main __P((int, char **));
-void usage __P((char *));
+void usage __P((void));
int getifhwaddr __P((char *, char *, struct ether_addr *));
int setupfilter __P((char *, struct ether_addr *, int));
void child_handler __P((int));
@@ -77,28 +77,28 @@ main(int argc, char **argv) {
switch (c) {
case 'i':
if (ifname != NULL) {
- usage(argv[0]);
+ usage();
return (EX_USAGE);
}
ifname = optarg;
break;
case 'n':
if (srvname != NULL) {
- usage(argv[0]);
+ usage();
return (EX_USAGE);
}
srvname = optarg;
break;
case 'p':
if (sysname != NULL) {
- usage(argv[0]);
+ usage();
return (EX_USAGE);
}
sysname = optarg;
break;
case 's':
if (smode) {
- usage(argv[0]);
+ usage();
return (EX_USAGE);
}
smode = 1;
@@ -107,14 +107,14 @@ main(int argc, char **argv) {
option_verbose++;
break;
default:
- usage(argv[0]);
+ usage();
return (EX_USAGE);
}
}
argc -= optind;
if (argc != 0) {
- usage(argv[0]);
+ usage();
return (EX_USAGE);
}
@@ -275,7 +275,7 @@ setupfilter(ifn, ea, server_mode)
err(EX_IOERR, "set immediate");
}
- strlcpy(ifr.ifr_name, ifn, sizeof(ifr.ifr_name));
+ strlcpy(ifr.ifr_name, ifn, IFNAMSIZ);
if (ioctl(fd, BIOCSETIF, &ifr) < 0) {
close(fd);
err(EX_IOERR, "set interface");
@@ -339,7 +339,7 @@ getifhwaddr(ifnhint, ifnambuf, ea)
sizeof(ifrp->ifr_name)))
continue;
if (ifnhint == NULL) {
- strlcpy(req.ifr_name, ifrp->ifr_name, sizeof(req.ifr_name));
+ strlcpy(req.ifr_name, ifrp->ifr_name, IFNAMSIZ);
if (ioctl(s, SIOCGIFFLAGS, &req) < 0)
err(EX_IOERR, "get flags");
if ((req.ifr_flags & IFF_UP) == 0)
@@ -363,7 +363,7 @@ getifhwaddr(ifnhint, ifnambuf, ea)
return (-1);
}
bcopy(dl->sdl_data + dl->sdl_nlen, ea, sizeof(*ea));
- strlcpy(ifnambuf, ifrp->ifr_name, sizeof(ifnambuf));
+ strlcpy(ifnambuf, ifrp->ifr_name, IFNAMSIZ);
free(inbuf);
close(s);
return (0);
@@ -378,10 +378,12 @@ getifhwaddr(ifnhint, ifnambuf, ea)
}
void
-usage(progname)
- char *progname;
+usage()
{
- fprintf(stderr, "%s [-s] [-v] [-p system] [-i interface]\n", progname);
+ extern char *__progname;
+
+ fprintf(stderr,"%s [-sv] [-i interface] [-n service] [-p system]\n",
+ __progname);
}
void