Of course, glibc does not have strlcpy

This commit is contained in:
Roy Marples 2007-07-06 17:07:29 +00:00
parent 809b5286b6
commit 913b3b1f6b

View File

@ -1080,22 +1080,23 @@ int main (int argc, char **argv)
/* eprefix is kinda klunky, but it works for our purposes */ /* eprefix is kinda klunky, but it works for our purposes */
if (rc_is_env ("RC_PREFIX", "yes")) { if (rc_is_env ("RC_PREFIX", "yes")) {
int l = 0; int l = 0;
int ll;
char *svc; char *svc;
/* Get the longest service name */ /* Get the longest service name */
services = rc_services_in_runlevel (NULL); services = rc_services_in_runlevel (NULL);
STRLIST_FOREACH (services, svc, i) { STRLIST_FOREACH (services, svc, i) {
int ll = strlen (svc); ll = strlen (svc);
if (ll > l) if (ll > l)
l = ll; l = ll;
} }
// rc_strlist_free (services);
svc = prefix = rc_xmalloc (sizeof (char *) * l); /* Make our prefix string */
svc += strlcpy (prefix, applet, l); prefix = rc_xmalloc (sizeof (char *) * l);
i = l - strlen (prefix); ll = strlen (applet);
memset (svc, ' ', i); memcpy (prefix, applet, ll);
memset (svc + i, 0, 1); memset (prefix + ll, ' ', l - ll);
memset (prefix + l, 0, 1);
eprefix (prefix); eprefix (prefix);
} }