diff options
author | Gerald Carter <jerry@samba.org> | 2000-07-07 06:20:46 +0000 |
---|---|---|
committer | Gerald Carter <jerry@samba.org> | 2000-07-07 06:20:46 +0000 |
commit | d2b40a7de259377d937492acedd39988ddd108a4 (patch) | |
tree | f0849ba6679575e80500b43b8989b3dddf16e2a4 /source3/lib/util_unistr.c | |
parent | 9de93aa8188293671a92e84b2b9dc104cc7eb64c (diff) | |
download | samba-d2b40a7de259377d937492acedd39988ddd108a4.tar.gz samba-d2b40a7de259377d937492acedd39988ddd108a4.tar.bz2 samba-d2b40a7de259377d937492acedd39988ddd108a4.zip |
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)
Diffstat (limited to 'source3/lib/util_unistr.c')
-rw-r--r-- | source3/lib/util_unistr.c | 46 |
1 files changed, 46 insertions, 0 deletions
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 @@ -222,6 +222,52 @@ char *dos_unistr2_to_str(UNISTR2 *str) } /******************************************************************* + 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. ********************************************************************/ |