2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
10 #include <afs/param.h>
11 #include <afsconfig.h>
19 /* Just like strncpy but shift-case in transit and forces null termination */
20 char *lcstring (char *d, char *s, int n)
21 { char *original_d = d;
24 if ((s == 0) || (d == 0)) return 0; /* just to be safe */
27 if (isupper(c)) c = tolower(c);
29 if (c == 0) break; /* quit after transferring null */
30 if (--n == 0) *(d-1) = 0; /* make sure null terminated */
35 char *ucstring (char *d, char *s, int n)
36 { char *original_d = d;
39 if ((s == 0) || (d == 0)) return 0;
42 if (islower(c)) c = toupper(c);
45 if (--n == 0) *(d-1) = 0; /* make sure null terminated */
50 /* strcompose - concatenate strings passed to it.
52 * buf: storage for the composed string. Any data in it will be lost.
53 * len: length of the buffer.
54 * ...: variable number of string arguments. The last argument must be
56 * Returns buf or NULL if the buffer was not sufficiently large.
58 char *strcompose(char *buf, size_t len, ...)
61 size_t spaceleft = len - 1;
65 if (buf == NULL || len <= 0)
70 str = va_arg(ap, char *);
73 if (spaceleft < slen) /* not enough space left */
79 str = va_arg(ap, char *);