summaryrefslogtreecommitdiff
path: root/libexec/getNAME/getNAME.c
diff options
context:
space:
mode:
Diffstat (limited to 'libexec/getNAME/getNAME.c')
-rw-r--r--libexec/getNAME/getNAME.c33
1 files changed, 21 insertions, 12 deletions
diff --git a/libexec/getNAME/getNAME.c b/libexec/getNAME/getNAME.c
index d0562a25992..7ff1ddb2b0c 100644
--- a/libexec/getNAME/getNAME.c
+++ b/libexec/getNAME/getNAME.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: getNAME.c,v 1.5 1997/11/13 04:15:25 millert Exp $ */
+/* $OpenBSD: getNAME.c,v 1.6 1998/05/17 06:33:11 millert Exp $ */
/* $NetBSD: getNAME.c,v 1.7.2.1 1997/11/10 19:54:46 thorpej Exp $ */
/*-
@@ -44,7 +44,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)getNAME.c 8.1 (Berkeley) 6/30/93";
#else
-static char rcsid[] = "$OpenBSD: getNAME.c,v 1.5 1997/11/13 04:15:25 millert Exp $";
+static char rcsid[] = "$OpenBSD: getNAME.c,v 1.6 1998/05/17 06:33:11 millert Exp $";
#endif
#endif /* not lint */
@@ -162,10 +162,11 @@ getfrom(pathname)
break;
}
if (i != 0)
- strncat(linbuf, " ", sizeof(linbuf) - 1);
+ strncat(linbuf, " ", sizeof(linbuf) - strlen(linbuf)
+ - 1);
i++;
trimln(headbuf);
- strncat(linbuf, headbuf, sizeof(linbuf) - 1);
+ strncat(linbuf, headbuf, sizeof(linbuf) - strlen(linbuf) - 1);
/* change the \- into (N) - */
if ((s = strstr(linbuf, "\\-")) != NULL) {
strcpy(savebuf, s+1);
@@ -178,7 +179,8 @@ getfrom(pathname)
*s++ = ' ';
*s++ = '\0';
}
- strncat(linbuf, savebuf, sizeof(linbuf) - strlen(savebuf) - 1);
+ strncat(linbuf, savebuf, sizeof(linbuf) -
+ strlen(linbuf) - 1);
}
}
if (intro)
@@ -212,7 +214,8 @@ newman:
break;
}
if (i != 0)
- strncat(linbuf, " ", sizeof(linbuf) - 1);
+ strncat(linbuf, " ", sizeof(linbuf) - strlen(linbuf)
+ - 1);
i++;
trimln(headbuf);
for (loc = strchr(headbuf, ' '); loc; loc = strchr(loc, ' '))
@@ -221,7 +224,8 @@ newman:
else
loc++;
if (headbuf[0] != '.') {
- strncat(linbuf, headbuf, sizeof(linbuf) - 1);
+ strncat(linbuf, headbuf, sizeof(linbuf) -
+ strlen(linbuf) - 1);
} else {
/*
* Get rid of quotes in macros.
@@ -247,16 +251,21 @@ newman:
*/
if (headbuf[1] == 'N' && headbuf[2] == 'd') {
if ((t = strchr(name, '.')) != NULL) {
- strncat(linbuf, "(", sizeof(linbuf)-1);
- strncat(linbuf, t+1, sizeof(linbuf)-1);
- strncat(linbuf, ") ", sizeof(linbuf)-1);
+ strncat(linbuf, "(", sizeof(linbuf) -
+ strlen(linbuf) - 1);
+ strncat(linbuf, t+1, sizeof(linbuf) -
+ strlen(linbuf) - 1);
+ strncat(linbuf, ") ", sizeof(linbuf) -
+ strlen(linbuf) - 1);
}
- strncat(linbuf, "- ", sizeof(linbuf) - 1);
+ strncat(linbuf, "- ", sizeof(linbuf) -
+ strlen(linbuf) - 1);
}
/*
* Skip over macro names.
*/
- strncat(linbuf, &headbuf[4], sizeof(linbuf) - 1);
+ strncat(linbuf, &headbuf[4], sizeof(linbuf) -
+ strlen(linbuf) - 1);
}
}
if (intro)