1 /*-
2 * Copyright (c) 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Paul Borman at Krystal Technologies.
7 *
8 * %sccs.include.redist.c%
9 */
10
11 #if defined(LIBC_SCCS) && !defined(lint)
12 static char sccsid[] = "@(#)none.c 8.1 (Berkeley) 06/04/93";
13 #endif /* LIBC_SCCS and not lint */
14
15 #include <stddef.h>
16 #include <stdio.h>
17 #include <rune.h>
18 #include <errno.h>
19 #include <stdlib.h>
20
21 rune_t _none_sgetrune __P((const char *, size_t, char const **));
22 int _none_sputrune __P((rune_t, char *, size_t, char **));
23
24 int
_none_init(rl)25 _none_init(rl)
26 _RuneLocale *rl;
27 {
28 rl->sgetrune = _none_sgetrune;
29 rl->sputrune = _none_sputrune;
30 _CurrentRuneLocale = rl;
31 __mb_cur_max = 1;
32 return(0);
33 }
34
35 rune_t
_none_sgetrune(string,n,result)36 _none_sgetrune(string, n, result)
37 const char *string;
38 size_t n;
39 char const **result;
40 {
41 int c;
42
43 if (n < 1) {
44 if (result)
45 *result = string;
46 return(_INVALID_RUNE);
47 }
48 if (result)
49 *result = string + 1;
50 return(*string & 0xff);
51 }
52
53 int
_none_sputrune(c,string,n,result)54 _none_sputrune(c, string, n, result)
55 rune_t c;
56 char *string, **result;
57 size_t n;
58 {
59 if (n >= 1) {
60 if (string)
61 *string = c;
62 if (result)
63 *result = string + 1;
64 } else if (result)
65 *result = (char *)0;
66 return(1);
67 }
68