X-Git-Url: https://git.saurik.com/apple/libc.git/blobdiff_plain/5b2abdfbf4211b6592cdd02b9507555a0ecbb04b..4c63d2152434d7a24cd627ef559f93b096274076:/locale/frune.c diff --git a/locale/frune.c b/locale/frune.c index 443d3ba..0db4f24 100644 --- a/locale/frune.c +++ b/locale/frune.c @@ -37,11 +37,16 @@ #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)frune.c 8.1 (Berkeley) 6/4/93"; #endif /* LIBC_SCCS and not lint */ +#include +__FBSDID("$FreeBSD: src/lib/libc/locale/frune.c,v 1.3 2002/09/18 06:19:12 tjr Exp $"); + +#include "xlocale_private.h" #include #include #include #include +#include "runedepreciated.h" long fgetrune(fp) @@ -51,6 +56,13 @@ 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 { @@ -61,13 +73,13 @@ fgetrune(fp) } 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 @@ -77,8 +89,14 @@ fungetrune(r, fp) { 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); @@ -92,8 +110,14 @@ fputrune(r, fp) { 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)