summaryrefslogtreecommitdiffstats
path: root/gl/btowc.c
diff options
context:
space:
mode:
authorThomas Guyot-Sionnest <dermoth@aei.ca>2009-01-15 09:22:57 (GMT)
committerThomas Guyot-Sionnest <dermoth@aei.ca>2009-01-15 10:19:08 (GMT)
commit71cdb52799220f8d9052643baf1d3e9836a9c755 (patch)
tree27aee97a35d9ab51f0d8f64a46690bd41a5f8c1b /gl/btowc.c
parentf7afa46586645e50498d8b2d0c67884f014dc3a4 (diff)
downloadmonitoring-plugins-71cdb52799220f8d9052643baf1d3e9836a9c755.tar.gz
Sync with gnulib
Diffstat (limited to 'gl/btowc.c')
-rw-r--r--gl/btowc.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/gl/btowc.c b/gl/btowc.c
new file mode 100644
index 0000000..7f3b966
--- /dev/null
+++ b/gl/btowc.c
@@ -0,0 +1,38 @@
1/* Convert unibyte character to wide character.
2 Copyright (C) 2008 Free Software Foundation, Inc.
3 Written by Bruno Haible <bruno@clisp.org>, 2008.
4
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */
17
18#include <config.h>
19
20/* Specification. */
21#include <wchar.h>
22
23#include <stdio.h>
24
25wint_t
26btowc (int c)
27{
28 if (c != EOF)
29 {
30 char buf[1];
31 wchar_t wc;
32
33 buf[0] = c;
34 if (mbtowc (&wc, buf, 1) >= 0)
35 return wc;
36 }
37 return WEOF;
38}