+++ /dev/null
-/*
- * Copyright notice from original mutt:
- * [none]
- *
- * This file is part of mutt-ng, see http://www.muttng.org/.
- * It's licensed under the GNU General Public License,
- * please see the file GPL in the top level source directory.
- */
-
-#if HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#ifndef HAVE_WC_FUNCS
-
-#include <errno.h>
-
-#ifndef EILSEQ
-#define EILSEQ EINVAL
-#endif
-
-int mutt_wctoutf8(char *p, unsigned int c)
-{
- static unsigned char const mark[7] = {
- 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC
- };
-
- int bytes;
-
- if (c >= 0x200000) {
- errno = EILSEQ;
- return -1;
- }
-
- bytes = 1 + (c >= 0x80) + (c >= 0x800) + (c >= 0x10000);
- p += bytes;
-
- switch (bytes) {
- case 4: *--p = (c | 0x80) & 0xbf; c >>= 6;
- case 3: *--p = (c | 0x80) & 0xbf; c >>= 6;
- case 2: *--p = (c | 0x80) & 0xbf; c >>= 6;
- case 1: *--p = c | mark[bytes];
- }
-
- return bytes;
-}
-
-#endif /* !HAVE_WC_FUNCS */