summaryrefslogtreecommitdiff
path: root/usr/src/cmd/ssh/libssh/common/misc.c
diff options
context:
space:
mode:
authorjp161948 <none@none>2007-10-15 17:05:59 -0700
committerjp161948 <none@none>2007-10-15 17:05:59 -0700
commit5d7f3ec0c1c1f71984b3452ad202709d2e87b1a9 (patch)
tree00ec1094d006de98617adeb448b24cde4b645eaa /usr/src/cmd/ssh/libssh/common/misc.c
parent3db6d5a262f59ddb07cdabd1d7f2be0d275b3fff (diff)
downloadillumos-joyent-5d7f3ec0c1c1f71984b3452ad202709d2e87b1a9.tar.gz
PSARC/2004/505 ssh_config(4) option compatibility
5044096 ssh(1) is too picky, quits on unknown ~/.ssh/config options
Diffstat (limited to 'usr/src/cmd/ssh/libssh/common/misc.c')
-rw-r--r--usr/src/cmd/ssh/libssh/common/misc.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/usr/src/cmd/ssh/libssh/common/misc.c b/usr/src/cmd/ssh/libssh/common/misc.c
index 21b683c3cd..6431255004 100644
--- a/usr/src/cmd/ssh/libssh/common/misc.c
+++ b/usr/src/cmd/ssh/libssh/common/misc.c
@@ -571,3 +571,30 @@ get_yes_no_flag(int *option, const char *arg, const char *filename, int linenum,
return (value != -1);
}
+
+/*
+ * Convert a string to lowercase. The string returned is an internally allocated
+ * one so the consumer of this function is not expected to change it or free it.
+ */
+char *
+tolowercase(const char *s)
+{
+ int i, len;
+ static int lenret = 0;
+ static char *ret = NULL;
+
+ /* allocate a new string if the old one it not long enough to store s */
+ len = strlen(s) + 1;
+ if (len > lenret) {
+ if (ret != NULL)
+ xfree(ret);
+ ret = xmalloc(len);
+ lenret = len;
+ }
+
+ /* process the string including the ending '\0' */
+ for (i = 0; i < len; ++i)
+ ret[i] = tolower(s[i]);
+
+ return (ret);
+}