diff options
Diffstat (limited to 'src/lib/libc/stdlib/multibyte.c')
| -rw-r--r-- | src/lib/libc/stdlib/multibyte.c | 131 |
1 files changed, 0 insertions, 131 deletions
diff --git a/src/lib/libc/stdlib/multibyte.c b/src/lib/libc/stdlib/multibyte.c deleted file mode 100644 index fe1cd5781b..0000000000 --- a/src/lib/libc/stdlib/multibyte.c +++ /dev/null | |||
| @@ -1,131 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 1991 The Regents of the University of California. | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * Redistribution and use in source and binary forms, with or without | ||
| 6 | * modification, are permitted provided that the following conditions | ||
| 7 | * are met: | ||
| 8 | * 1. Redistributions of source code must retain the above copyright | ||
| 9 | * notice, this list of conditions and the following disclaimer. | ||
| 10 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 11 | * notice, this list of conditions and the following disclaimer in the | ||
| 12 | * documentation and/or other materials provided with the distribution. | ||
| 13 | * 3. All advertising materials mentioning features or use of this software | ||
| 14 | * must display the following acknowledgement: | ||
| 15 | * This product includes software developed by the University of | ||
| 16 | * California, Berkeley and its contributors. | ||
| 17 | * 4. Neither the name of the University nor the names of its contributors | ||
| 18 | * may be used to endorse or promote products derived from this software | ||
| 19 | * without specific prior written permission. | ||
| 20 | * | ||
| 21 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | ||
| 22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | ||
| 25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 31 | * SUCH DAMAGE. | ||
| 32 | */ | ||
| 33 | |||
| 34 | #if defined(LIBC_SCCS) && !defined(lint) | ||
| 35 | /*static char *sccsid = "from: @(#)multibyte.c 5.1 (Berkeley) 2/18/91";*/ | ||
| 36 | static char *rcsid = "$Id: multibyte.c,v 1.1.1.1 1995/10/18 08:42:18 deraadt Exp $"; | ||
| 37 | #endif /* LIBC_SCCS and not lint */ | ||
| 38 | |||
| 39 | #include <stdlib.h> | ||
| 40 | |||
| 41 | /* | ||
| 42 | * Stub multibyte character functions. | ||
| 43 | * This cheezy implementation is fixed to the native single-byte | ||
| 44 | * character set. | ||
| 45 | */ | ||
| 46 | |||
| 47 | int | ||
| 48 | mblen(s, n) | ||
| 49 | const char *s; | ||
| 50 | size_t n; | ||
| 51 | { | ||
| 52 | if (s == NULL || *s == '\0') | ||
| 53 | return 0; | ||
| 54 | if (n == 0) | ||
| 55 | return -1; | ||
| 56 | return 1; | ||
| 57 | } | ||
| 58 | |||
| 59 | /*ARGSUSED*/ | ||
| 60 | int | ||
| 61 | mbtowc(pwc, s, n) | ||
| 62 | wchar_t *pwc; | ||
| 63 | const char *s; | ||
| 64 | size_t n; | ||
| 65 | { | ||
| 66 | if (s == NULL) | ||
| 67 | return 0; | ||
| 68 | if (n == 0) | ||
| 69 | return -1; | ||
| 70 | if (pwc) | ||
| 71 | *pwc = (wchar_t) *s; | ||
| 72 | return (*s != '\0'); | ||
| 73 | } | ||
| 74 | |||
| 75 | /*ARGSUSED*/ | ||
| 76 | int | ||
| 77 | #ifdef __STDC__ | ||
| 78 | wctomb(char *s, wchar_t wchar) | ||
| 79 | #else | ||
| 80 | wctomb(s, wchar) | ||
| 81 | char *s; | ||
| 82 | wchar_t wchar; | ||
| 83 | #endif | ||
| 84 | { | ||
| 85 | if (s == NULL) | ||
| 86 | return 0; | ||
| 87 | |||
| 88 | *s = (char) wchar; | ||
| 89 | return 1; | ||
| 90 | } | ||
| 91 | |||
| 92 | /*ARGSUSED*/ | ||
| 93 | size_t | ||
| 94 | mbstowcs(pwcs, s, n) | ||
| 95 | wchar_t *pwcs; | ||
| 96 | const char *s; | ||
| 97 | size_t n; | ||
| 98 | { | ||
| 99 | int count = 0; | ||
| 100 | |||
| 101 | if (n != 0) { | ||
| 102 | do { | ||
| 103 | if ((*pwcs++ = (wchar_t) *s++) == 0) | ||
| 104 | break; | ||
| 105 | count++; | ||
| 106 | } while (--n != 0); | ||
| 107 | } | ||
| 108 | |||
| 109 | return count; | ||
| 110 | } | ||
| 111 | |||
| 112 | /*ARGSUSED*/ | ||
| 113 | size_t | ||
| 114 | wcstombs(s, pwcs, n) | ||
| 115 | char *s; | ||
| 116 | const wchar_t *pwcs; | ||
| 117 | size_t n; | ||
| 118 | { | ||
| 119 | int count = 0; | ||
| 120 | |||
| 121 | if (n != 0) { | ||
| 122 | do { | ||
| 123 | if ((*s++ = (char) *pwcs++) == 0) | ||
| 124 | break; | ||
| 125 | count++; | ||
| 126 | } while (--n != 0); | ||
| 127 | } | ||
| 128 | |||
| 129 | return count; | ||
| 130 | } | ||
| 131 | |||
