rune support from Paul Borman
authorKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Thu, 27 May 1993 11:28:33 +0000 (03:28 -0800)
committerKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Thu, 27 May 1993 11:28:33 +0000 (03:28 -0800)
date and time created 93/05/26 20:28:33 by bostic

SCCS-vsn: lib/libc/locale/none.c 5.1

usr/src/lib/libc/locale/none.c [new file with mode: 0644]

diff --git a/usr/src/lib/libc/locale/none.c b/usr/src/lib/libc/locale/none.c
new file mode 100644 (file)
index 0000000..93f7b09
--- /dev/null
@@ -0,0 +1,67 @@
+/*-
+ * Copyright (c) 1993 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Paul Borman at Krystal Technologies.
+ *
+ * %sccs.include.redist.c%
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)none.c     5.1 (Berkeley) %G%";
+#endif /* LIBC_SCCS and not lint */
+
+#include <stddef.h>
+#include <stdio.h>
+#include <rune.h>
+#include <errno.h>
+#include <stdlib.h>
+
+rune_t _none_sgetrune __P((const char *, size_t, char const **));
+int    _none_sputrune __P((rune_t, char *, size_t, char **));
+
+int
+_none_init(rl)
+       _RuneLocale *rl;
+{
+       rl->sgetrune = _none_sgetrune;
+       rl->sputrune = _none_sputrune;
+       _CurrentRuneLocale = rl;
+       __mb_cur_max = 1;
+       return(0);
+}
+
+rune_t
+_none_sgetrune(string, n, result)
+       const char *string;
+       size_t n;
+       char const **result;
+{
+       int c;
+
+       if (n < 1) {
+               if (result)
+                       *result = string;
+               return(_INVALID_RUNE);
+       }
+       if (result)
+               *result = string + 1;
+       return(*string & 0xff);
+}
+
+int
+_none_sputrune(c, string, n, result)
+       rune_t c;
+       char *string, **result;
+       size_t n;
+{
+       if (n >= 1) {
+               if (string)
+                       *string = c;
+               if (result)
+                       *result = string + 1;
+       } else if (result)
+               *result = (char *)0;
+       return(1);
+}