File: setlocale-fixes.h

package info (click to toggle)
datamash 1.9-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, trixie
  • size: 13,600 kB
  • sloc: ansic: 65,320; sh: 8,982; perl: 5,127; makefile: 250; sed: 16
file content (64 lines) | stat: -rw-r--r-- 2,151 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/* Make the global locale minimally POSIX compliant.
   Copyright (C) 2025 Free Software Foundation, Inc.

   This file is free software: you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as
   published by the Free Software Foundation; either version 2.1 of the
   License, or (at your option) any later version.

   This file is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General Public License
   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */

/* Written by Bruno Haible <bruno@clisp.org>, 2025.  */

#ifndef _SETLOCALE_FIXES_H
#define _SETLOCALE_FIXES_H

#ifdef __cplusplus
extern "C" {
#endif


#if defined _WIN32 && !defined __CYGWIN__

/* This section is only relevant on platforms that lack LC_MESSAGES, namely
   native Windows.  */

/* setlocale_messages (NAME) is like setlocale (LC_MESSAGES, NAME).  */
extern const char *setlocale_messages (const char *name);

/* setlocale_messages_null () is like setlocale (LC_MESSAGES, NULL), except that
   it is guaranteed to be multithread-safe.  */
extern const char *setlocale_messages_null (void);

#endif


#if defined __ANDROID__

/* This section is only relevant on Android.
   While OpenBSD ≥ 6.2 and Android API level >= 21 have a fake locale_t type,
   regarding the global locale, OpenBSD at least stores the name of each
   category of the global locale.  Android doesn't do this, and additionally
   has a bug: setting any category != LC_CTYPE of the global locale affects
   the LC_CTYPE category as well.  */

/* Like setlocale (CATEGORY, NAME), but fixes these two Android bugs.  */
extern const char *setlocale_fixed (int category, const char *name);

/* Like setlocale_null (CATEGORY), but consistent with setlocale_fixed.  */
extern const char *setlocale_fixed_null (int category);

#endif


#ifdef __cplusplus
}
#endif

#endif /* _SETLOCALE_FIXES_H */