Roland Mainz wrote:
char *s;
...
strcat(s, "foo");
strcat(s, "/");
strcat(s, "bar");

Also, as I noted on IRC, strlcat() is close to this, and much safer.
You could write the above as:

char *s;
int len; /* size of buffer s */
int used = 0;

used = strlcpy(s, "foo", len);
if (used < len)
    used += strlcat(s + used, "/", len - used);
if (used < len)
    used += strlcat(s + used, "bar", len - used);


--
        -Alan Coopersmith-           [EMAIL PROTECTED]
         Sun Microsystems, Inc. - X Window System Engineering
_______________________________________________
opensolaris-discuss mailing list
[email protected]

Reply via email to