summaryrefslogtreecommitdiff
path: root/package/openafs/src/src/comerr
diff options
context:
space:
mode:
Diffstat (limited to 'package/openafs/src/src/comerr')
-rw-r--r--package/openafs/src/src/comerr/internal.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/package/openafs/src/src/comerr/internal.c b/package/openafs/src/src/comerr/internal.c
new file mode 100644
index 000000000..8e0193d44
--- /dev/null
+++ b/package/openafs/src/src/comerr/internal.c
@@ -0,0 +1,22 @@
+/* Just like strncpy but shift-case in transit and forces null termination */
+char *
+lcstring(char *d, char *s, int n)
+{
+ char *original_d = d;
+ char c;
+
+ if ((s == 0) || (d == 0))
+ return 0; /* just to be safe */
+ while (n) {
+ c = *s++;
+ if (isupper(c))
+ c = tolower(c);
+ *d++ = c;
+ if (c == 0)
+ break; /* quit after transferring null */
+ if (--n == 0)
+ *(d - 1) = 0; /* make sure null terminated */
+ }
+ return original_d;
+}
+