]> git.ipfire.org Git - thirdparty/glibc.git/blob - locale/numeric.c
Wed Mar 27 14:52:11 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu>
[thirdparty/glibc.git] / locale / numeric.c
1 /* Copyright (C) 1995 Free Software Foundation, Inc.
2
3 The GNU C Library is free software; you can redistribute it and/or
4 modify it under the terms of the GNU Library General Public License as
5 published by the Free Software Foundation; either version 2 of the
6 License, or (at your option) any later version.
7
8 The GNU C Library is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 Library General Public License for more details.
12
13 You should have received a copy of the GNU Library General Public
14 License along with the GNU C Library; see the file COPYING.LIB. If
15 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
16 Cambridge, MA 02139, USA. */
17
18 #include <langinfo.h>
19 #include <libintl.h>
20 #include <locale.h>
21
22 #include "localedef.h"
23
24 /* These are defined in locfile-parse.c. */
25 extern struct cat_item LC_NUMERIC_desc[];
26 extern char *LC_NUMERIC_values[];
27
28 void
29 numeric_check(void)
30 {
31 int item_no;
32
33 /* First general check for existence. */
34 for (item_no = 0; item_no < category[LC_NUMERIC].number; ++item_no)
35 if (LC_NUMERIC_values[item_no] == NULL)
36 {
37 int errcode;
38
39 errcode = LC_NUMERIC_desc[item_no].status = std ? 5 : 0;
40
41 error (errcode, 0, gettext ("item `%s' of category `%s' undefined"),
42 LC_NUMERIC_desc[item_no].name, "LC_NUMERIC");
43 }
44 else
45 {
46 if (LC_NUMERIC_desc[item_no].item_id == DECIMAL_POINT
47 && LC_NUMERIC_values[item_no][0] == '\0')
48 /* The decimal point must not be empty. This is not said
49 explicitly in POSIX but ANSI C (ISO/IEC 9899) says in
50 4.4.2.1 it has to be != "". */
51 error (0, 0,
52 gettext ("item `%s' in category `%s' must not be empty"),
53 LC_NUMERIC_desc[item_no].name, "LC_NUMERIC");
54 }
55 }
56
57 /*
58 * Local Variables:
59 * mode:c
60 * c-basic-offset:2
61 * End:
62 */