#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)frune.c 8.1 (Berkeley) 6/4/93";
#endif /* LIBC_SCCS and not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD: src/lib/libc/locale/frune.c,v 1.3 2002/09/18 06:19:12 tjr Exp $");
+
+#include "xlocale_private.h"
#include <limits.h>
#include <rune.h>
#include <stddef.h>
#include <stdio.h>
+#include "runedepreciated.h"
long
fgetrune(fp)
int c, len;
char buf[MB_LEN_MAX];
char const *result;
+ __darwin_rune_t invalid_rune = __current_locale()->__lc_ctype->_CurrentRuneLocale.__invalid_rune;
+ static int warn_depreciated = 1;
+
+ if (warn_depreciated) {
+ warn_depreciated = 0;
+ fprintf(stderr, __rune_depreciated_msg, "fgetrune");
+ }
len = 0;
do {
}
buf[len++] = c;
- if ((r = sgetrune(buf, len, &result)) != _INVALID_RUNE)
+ if ((r = __sgetrune(buf, len, &result)) != invalid_rune)
return (r);
} while (result == buf && len < MB_LEN_MAX);
while (--len > 0)
ungetc(buf[len], fp);
- return (_INVALID_RUNE);
+ return (invalid_rune);
}
int
{
int len;
char buf[MB_LEN_MAX];
+ static int warn_depreciated = 1;
- len = sputrune(r, buf, MB_LEN_MAX, 0);
+ if (warn_depreciated) {
+ warn_depreciated = 0;
+ fprintf(stderr, __rune_depreciated_msg, "fungetrune");
+ }
+
+ len = __sputrune(r, buf, MB_LEN_MAX, 0);
while (len-- > 0)
if (ungetc(buf[len], fp) == EOF)
return (EOF);
{
int i, len;
char buf[MB_LEN_MAX];
+ static int warn_depreciated = 1;
+
+ if (warn_depreciated) {
+ warn_depreciated = 0;
+ fprintf(stderr, __rune_depreciated_msg, "fputrune");
+ }
- len = sputrune(r, buf, MB_LEN_MAX, 0);
+ len = __sputrune(r, buf, MB_LEN_MAX, 0);
for (i = 0; i < len; ++i)
if (putc(buf[i], fp) == EOF)