strc{py,at}_truncate -> strlc{py,at}
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@6983 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
1999-09-16 Assar Westerlund <assar@sics.se>
|
||||
|
||||
* strlcat.c (strlcat): call strlcpy
|
||||
|
||||
* strlcpy.c: update name and prototype
|
||||
|
||||
* strlcat.c: update name and prototype
|
||||
|
@@ -59,13 +59,13 @@ print_arg (char *string, size_t len, int mdoc, int longp, struct getargs *arg)
|
||||
|
||||
if(mdoc){
|
||||
if(longp)
|
||||
strcat_truncate(string, "= Ns", len);
|
||||
strcat_truncate(string, " Ar ", len);
|
||||
strlcat(string, "= Ns", len);
|
||||
strlcat(string, " Ar ", len);
|
||||
}else
|
||||
if (longp)
|
||||
strcat_truncate (string, "=", len);
|
||||
strlcat (string, "=", len);
|
||||
else
|
||||
strcat_truncate (string, " ", len);
|
||||
strlcat (string, " ", len);
|
||||
|
||||
if (arg->arg_help)
|
||||
s = arg->arg_help;
|
||||
@@ -76,7 +76,7 @@ print_arg (char *string, size_t len, int mdoc, int longp, struct getargs *arg)
|
||||
else
|
||||
s = "<undefined>";
|
||||
|
||||
strcat_truncate(string, s, len);
|
||||
strlcat(string, s, len);
|
||||
return 1 + strlen(s);
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ mandoc_template(struct getargs *args,
|
||||
printf(".Dd %s\n", timestr);
|
||||
p = strrchr(progname, '/');
|
||||
if(p) p++; else p = progname;
|
||||
strcpy_truncate(cmd, p, sizeof(cmd));
|
||||
strlcpy(cmd, p, sizeof(cmd));
|
||||
strupr(cmd);
|
||||
|
||||
printf(".Dt %s SECTION\n", cmd);
|
||||
@@ -222,19 +222,19 @@ arg_printusage (struct getargs *args,
|
||||
|
||||
if (args[i].long_name) {
|
||||
buf[0] = '\0';
|
||||
strcat_truncate(buf, "[--", sizeof(buf));
|
||||
strlcat(buf, "[--", sizeof(buf));
|
||||
len += 2;
|
||||
if(args[i].type == arg_negative_flag) {
|
||||
strcat_truncate(buf, "no-", sizeof(buf));
|
||||
strlcat(buf, "no-", sizeof(buf));
|
||||
len += 3;
|
||||
}
|
||||
strcat_truncate(buf, args[i].long_name, sizeof(buf));
|
||||
strlcat(buf, args[i].long_name, sizeof(buf));
|
||||
len += strlen(args[i].long_name);
|
||||
len += print_arg(buf + strlen(buf), sizeof(buf) - strlen(buf),
|
||||
0, 1, &args[i]);
|
||||
strcat_truncate(buf, "]", sizeof(buf));
|
||||
strlcat(buf, "]", sizeof(buf));
|
||||
if(args[i].type == arg_strings)
|
||||
strcat_truncate(buf, "...", sizeof(buf));
|
||||
strlcat(buf, "...", sizeof(buf));
|
||||
col = check_column(stderr, col, strlen(buf) + 1, columns);
|
||||
col += fprintf(stderr, " %s", buf);
|
||||
}
|
||||
@@ -243,9 +243,9 @@ arg_printusage (struct getargs *args,
|
||||
len += 2;
|
||||
len += print_arg(buf + strlen(buf), sizeof(buf) - strlen(buf),
|
||||
0, 0, &args[i]);
|
||||
strcat_truncate(buf, "]", sizeof(buf));
|
||||
strlcat(buf, "]", sizeof(buf));
|
||||
if(args[i].type == arg_strings)
|
||||
strcat_truncate(buf, "...", sizeof(buf));
|
||||
strlcat(buf, "...", sizeof(buf));
|
||||
col = check_column(stderr, col, strlen(buf) + 1, columns);
|
||||
col += fprintf(stderr, " %s", buf);
|
||||
}
|
||||
|
@@ -57,6 +57,6 @@ getcwd(char *path, size_t size)
|
||||
char *ret;
|
||||
ret = getwd(xxx);
|
||||
if(ret)
|
||||
strcpy_truncate(path, xxx, size);
|
||||
strlcpy(path, xxx, size);
|
||||
return ret;
|
||||
}
|
||||
|
@@ -65,11 +65,11 @@ gethostname(char *name, int namelen)
|
||||
ret = uname (&utsname);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
strcpy_truncate (name, utsname.nodename, namelen);
|
||||
strlcpy (name, utsname.nodename, namelen);
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
strcpy_truncate (name, "some.random.host", namelen);
|
||||
strlcpy (name, "some.random.host", namelen);
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
@@ -748,7 +748,7 @@ g_opendir(Char *str, glob_t *pglob)
|
||||
char buf[MaxPathLen];
|
||||
|
||||
if (!*str)
|
||||
strcpy_truncate(buf, ".", sizeof(buf));
|
||||
strlcpy(buf, ".", sizeof(buf));
|
||||
else
|
||||
g_Ctoc(str, buf);
|
||||
|
||||
|
@@ -86,10 +86,10 @@ inaddr2str(struct in_addr addr, char *s, size_t len)
|
||||
*p;
|
||||
++p)
|
||||
if (memcmp (*p, &addr, sizeof(addr)) == 0) {
|
||||
strcpy_truncate (s, h->h_name, len);
|
||||
strlcpy (s, h->h_name, len);
|
||||
return;
|
||||
}
|
||||
}
|
||||
strcpy_truncate (s, inet_ntoa (addr), len);
|
||||
strlcpy (s, inet_ntoa (addr), len);
|
||||
return;
|
||||
}
|
||||
|
@@ -123,7 +123,7 @@ __ivaliduser(FILE *hostf, unsigned raddr, const char *luser,
|
||||
sizeof(u_long),
|
||||
AF_INET)) == NULL)
|
||||
return (-1);
|
||||
strcpy_truncate(hname, hp->h_name, sizeof(hname));
|
||||
strlcpy(hname, hp->h_name, sizeof(hname));
|
||||
|
||||
while (fgets(buf, sizeof(buf), hostf)) {
|
||||
p = buf;
|
||||
|
Reference in New Issue
Block a user