X-Git-Url: https://git.saurik.com/apple/network_cmds.git/blobdiff_plain/fdfd5971fdda9c24d576337643161018a5281167..e0b07f2d5ba2222268f5d1293221b413eb7c2655:/rtadvd.tproj/advcap.c diff --git a/rtadvd.tproj/advcap.c b/rtadvd.tproj/advcap.c index cc01ae2..33b6fae 100644 --- a/rtadvd.tproj/advcap.c +++ b/rtadvd.tproj/advcap.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009 Apple Inc. All rights reserved. + * Copyright (c) 2009-2011 Apple Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * @@ -26,7 +26,7 @@ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ -/* $KAME: advcap.c,v 1.5 2001/02/01 09:12:08 jinmei Exp $ */ +/* $KAME: advcap.c,v 1.11 2003/05/19 09:46:50 keiichi Exp $ */ /* * Copyright (c) 1983 The Regents of the University of California. @@ -59,8 +59,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD: src/usr.sbin/rtadvd/advcap.c,v 1.1.2.2 2001/07/03 11:02:13 ume Exp $ */ /* @@ -75,10 +73,10 @@ #include #include #include -#include #include #include #include "pathnames.h" +#include "rtadvd_logging.h" #ifndef BUFSIZ #define BUFSIZ 1024 @@ -120,15 +118,15 @@ static char *remotefile; extern char *conffile; -int tgetent __P((char *, char *)); -int getent __P((char *, char *, char *)); -int tnchktc __P((void)); -int tnamatch __P((char *)); -static char *tskip __P((char *)); -long long tgetnum __P((char *)); -int tgetflag __P((char *)); -char *tgetstr __P((char *, char **)); -static char *tdecode __P((char *, char **)); +int tgetent(char *, char *); +int getent(char *, char *, char *); +int tnchktc(void); +int tnamatch(char *); +static char *tskip(char *); +int64_t tgetnum(char *); +int tgetflag(char *); +char *tgetstr(char *, char **); +static char *tdecode(char *, char **); /* * Get an entry for terminal name in buffer bp, @@ -149,8 +147,8 @@ int getent(bp, name, cp) char *bp, *name, *cp; { - register int c; - register int i = 0, cnt = 0; + int c; + int i = 0, cnt = 0; char ibuf[BUFSIZ]; int tf; @@ -167,8 +165,7 @@ getent(bp, name, cp) tf = open(RM = cp, O_RDONLY); } if (tf < 0) { - syslog(LOG_INFO, - "<%s> open: %s", __FUNCTION__, strerror(errno)); + infolog("<%s> open: %s", __func__, strerror(errno)); return (-2); } for (;;) { @@ -190,8 +187,9 @@ getent(bp, name, cp) } break; } - if (cp >= bp+BUFSIZ) { - write(2,"Remcap entry too long\n", 23); + if (cp >= bp + BUFSIZ - 1) { + write(STDERR_FILENO, "Remcap entry too long\n", + 22); break; } else *cp++ = c; @@ -218,7 +216,7 @@ getent(bp, name, cp) int tnchktc() { - register char *p, *q; + char *p, *q; char tcname[16]; /* name of similar terminal */ char tcbuf[BUFSIZ]; char *holdtbuf = tbuf; @@ -226,21 +224,21 @@ tnchktc() p = tbuf + strlen(tbuf) - 2; /* before the last colon */ while (*--p != ':') - if (p MAXHOP) { - write(2, "Infinite tc= loop\n", 18); + write(STDERR_FILENO, "Infinite tc= loop\n", 18); return (0); } if (getent(tcbuf, tcname, remotefile) != 1) { @@ -252,7 +250,7 @@ tnchktc() /* check length before copying string below */ if (l > BUFSIZ) { - write(2, "Remcap entry too long\n", 23); + write(STDERR_FILENO, "Remcap entry too long\n", 23); q[BUFSIZ - (p-holdtbuf)] = 0; } strlcpy(p, q, p-tbuf); @@ -270,7 +268,7 @@ int tnamatch(np) char *np; { - register char *Np, *Bp; + char *Np, *Bp; Bp = tbuf; if (*Bp == '#') @@ -295,7 +293,7 @@ tnamatch(np) */ static char * tskip(bp) - register char *bp; + char *bp; { int dquote; @@ -338,13 +336,13 @@ breakbreak: * a # character. If the option is not found we return -1. * Note that we handle octal numbers beginning with 0. */ -long long +int64_t tgetnum(id) char *id; { - register long long i; - register int base; - register char *bp = tbuf; + int64_t i; + int base; + char *bp = tbuf; for (;;) { bp = tskip(bp); @@ -378,7 +376,7 @@ int tgetflag(id) char *id; { - register char *bp = tbuf; + char *bp = tbuf; for (;;) { bp = tskip(bp); @@ -406,7 +404,7 @@ char * tgetstr(id, area) char *id, **area; { - register char *bp = tbuf; + char *bp = tbuf; for (;;) { bp = tskip(bp); @@ -430,12 +428,12 @@ tgetstr(id, area) */ static char * tdecode(str, area) - register char *str; + char *str; char **area; { - register char *cp; - register int c; - register char *dp; + char *cp; + int c; + char *dp; int i; char term;