summaryrefslogtreecommitdiffstats
path: root/usr.sbin/rtadvd/advcap.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/rtadvd/advcap.c')
-rw-r--r--usr.sbin/rtadvd/advcap.c51
1 files changed, 18 insertions, 33 deletions
diff --git a/usr.sbin/rtadvd/advcap.c b/usr.sbin/rtadvd/advcap.c
index 792ea27..7280f40 100644
--- a/usr.sbin/rtadvd/advcap.c
+++ b/usr.sbin/rtadvd/advcap.c
@@ -64,8 +64,6 @@
#define V_TERM "HOST"
#endif
-char *RM;
-
/*
* termcap - routines for dealing with the terminal capability data base
*
@@ -83,12 +81,10 @@ char *RM;
static char *tbuf;
static int hopcount; /* detect infinite loops in termcap, init 0 */
-static char *remotefile;
-
-extern char *conffile;
+extern const char *conffile;
int tgetent(char *, char *);
-int getent(char *, char *, char *);
+int getent(char *, char *, const char *);
int tnchktc(void);
int tnamatch(char *);
static char *tskip(char *);
@@ -103,22 +99,18 @@ static char *tdecode(char *, char **);
* we just notice escaped newlines.
*/
int
-tgetent(bp, name)
- char *bp, *name;
+tgetent(char *bp, char *name)
{
- char *cp;
-
- remotefile = cp = conffile ? conffile : _PATH_RTADVDCONF;
- return (getent(bp, name, cp));
+ return (getent(bp, name, conffile));
}
int
-getent(bp, name, cp)
- char *bp, *name, *cp;
+getent(char *bp, char *name, const char *cfile)
{
int c;
int i = 0, cnt = 0;
char ibuf[BUFSIZ];
+ char *cp;
int tf;
tbuf = bp;
@@ -130,9 +122,9 @@ getent(bp, name, cp)
* use so we don't have to read the file. In this case it
* has to already have the newlines crunched out.
*/
- if (cp && *cp) {
- tf = open(RM = cp, O_RDONLY);
- }
+ if (cfile && *cfile)
+ tf = open(cfile, O_RDONLY);
+
if (tf < 0) {
syslog(LOG_INFO,
"<%s> open: %s", __func__, strerror(errno));
@@ -184,7 +176,7 @@ getent(bp, name, cp)
* Note that this works because of the left to right scan.
*/
int
-tnchktc()
+tnchktc(void)
{
char *p, *q;
char tcname[16]; /* name of similar terminal */
@@ -211,7 +203,7 @@ tnchktc()
write(STDERR_FILENO, "Infinite tc= loop\n", 18);
return (0);
}
- if (getent(tcbuf, tcname, remotefile) != 1) {
+ if (getent(tcbuf, tcname, conffile) != 1) {
return (0);
}
for (q = tcbuf; *q++ != ':'; )
@@ -233,8 +225,7 @@ tnchktc()
* name (before the first field) stops us.
*/
int
-tnamatch(np)
- char *np;
+tnamatch(char *np)
{
char *Np, *Bp;
@@ -260,8 +251,7 @@ tnamatch(np)
* into the termcap file in octal.
*/
static char *
-tskip(bp)
- char *bp;
+tskip(char *bp)
{
int dquote;
@@ -305,8 +295,7 @@ breakbreak:
* Note that we handle octal numbers beginning with 0.
*/
int64_t
-tgetnum(id)
- char *id;
+tgetnum(char *id)
{
int64_t i;
int base;
@@ -341,8 +330,7 @@ tgetnum(id)
* not given.
*/
int
-tgetflag(id)
- char *id;
+tgetflag(char *id)
{
char *bp = tbuf;
@@ -369,8 +357,7 @@ tgetflag(id)
* No checking on area overflow.
*/
char *
-tgetstr(id, area)
- char *id, **area;
+tgetstr(char *id, char **area)
{
char *bp = tbuf;
@@ -395,13 +382,11 @@ tgetstr(id, area)
* string capability escapes.
*/
static char *
-tdecode(str, area)
- char *str;
- char **area;
+tdecode(char *str, char **area)
{
char *cp;
int c;
- char *dp;
+ const char *dp;
int i;
char term;
OpenPOWER on IntegriCloud