From d2b40a7de259377d937492acedd39988ddd108a4 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Fri, 7 Jul 2000 06:20:46 +0000 Subject: More rpcclient merge issues: * fixes some readline bugs from the merge * first attempt at commands (spoolenum almost works) * no changes to existing functions in HEAD; only additions of new functions. I'll weed out what I can as I go. --jerry (This used to be commit 61d2aad5dc2b212b11c981f1eca47efa627e9fc8) --- source3/lib/util_unistr.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'source3/lib/util_unistr.c') diff --git a/source3/lib/util_unistr.c b/source3/lib/util_unistr.c index 1c13ff2758..42f1dc0644 100644 --- a/source3/lib/util_unistr.c +++ b/source3/lib/util_unistr.c @@ -221,6 +221,52 @@ char *dos_unistr2_to_str(UNISTR2 *str) return lbuf; } +/******************************************************************* + Put an ASCII string into a UNICODE array (uint16's). + ********************************************************************/ +void ascii_to_unistr(uint16 *dest, const char *src, int maxlen) +{ + uint16 *destend = dest + maxlen; + register char c; + + while (dest < destend) + { + c = *(src++); + if (c == 0) + { + break; + } + + *(dest++) = (uint16)c; + } + + *dest = 0; +} + + +/******************************************************************* + Pull an ASCII string out of a UNICODE array (uint16's). + ********************************************************************/ + +void unistr_to_ascii(char *dest, const uint16 *src, int len) +{ + char *destend = dest + len; + register uint16 c; + + while (dest < destend) + { + c = *(src++); + if (c == 0) + { + break; + } + + *(dest++) = (char)c; + } + + *dest = 0; +} + /******************************************************************* Convert a UNISTR2 structure to an ASCII string Warning: this version does DOS codepage. -- cgit