1catopen(3)                 Library Functions Manual                 catopen(3)
2
3
4

NAME

6       catopen, catclose - open/close a message catalog
7

LIBRARY

9       Standard C library (libc, -lc)
10

SYNOPSIS

12       #include <nl_types.h>
13
14       nl_catd catopen(const char *name, int flag);
15       int catclose(nl_catd catalog);
16

DESCRIPTION

18       The  function  catopen()  opens a message catalog and returns a catalog
19       descriptor.  The descriptor  remains  valid  until  catclose()  or  ex‐
20       ecve(2).   If  a  file descriptor is used to implement catalog descrip‐
21       tors, then the FD_CLOEXEC flag will be set.
22
23       The argument name specifies the name  of  the  message  catalog  to  be
24       opened.   If  name  specifies  an absolute path (i.e., contains a '/'),
25       then name specifies a pathname for the message catalog.  Otherwise, the
26       environment  variable NLSPATH is used with name substituted for %N (see
27       locale(7)).  It is unspecified whether NLSPATH will be  used  when  the
28       process has root privileges.  If NLSPATH does not exist in the environ‐
29       ment, or if a message catalog cannot be opened  in  any  of  the  paths
30       specified  by  it,  then  an implementation defined path is used.  This
31       latter default path may depend on the LC_MESSAGES locale  setting  when
32       the flag argument is NL_CAT_LOCALE and on the LANG environment variable
33       when the flag argument is 0.  Changing the LC_MESSAGES part of the  lo‐
34       cale may invalidate open catalog descriptors.
35
36       The  flag  argument to catopen() is used to indicate the source for the
37       language to use.  If it is set to NL_CAT_LOCALE, then it will  use  the
38       current  locale  setting  for  LC_MESSAGES.  Otherwise, it will use the
39       LANG environment variable.
40
41       The function catclose() closes the message catalog identified by  cata‐
42       log.   It  invalidates any subsequent references to the message catalog
43       defined by catalog.
44

RETURN VALUE

46       The function catopen() returns a message  catalog  descriptor  of  type
47       nl_catd on success.  On failure, it returns (nl_catd) -1 and sets errno
48       to indicate the error.  The possible error values include all  possible
49       values for the open(2) call.
50
51       The function catclose() returns 0 on success, or -1 on failure.
52

ENVIRONMENT

54       LC_MESSAGES
55              May  be  the  source of the LC_MESSAGES locale setting, and thus
56              determine the language to use if flag is set to NL_CAT_LOCALE.
57
58       LANG   The language to use if flag is 0.
59

ATTRIBUTES

61       For an  explanation  of  the  terms  used  in  this  section,  see  at‐
62       tributes(7).
63
64       ┌────────────────────────────────────────┬───────────────┬─────────────┐
65Interface                               Attribute     Value       
66       ├────────────────────────────────────────┼───────────────┼─────────────┤
67catopen()                               │ Thread safety │ MT-Safe env │
68       ├────────────────────────────────────────┼───────────────┼─────────────┤
69catclose()                              │ Thread safety │ MT-Safe     │
70       └────────────────────────────────────────┴───────────────┴─────────────┘
71

VERSIONS

73       The  above  is the POSIX.1 description.  The glibc value for NL_CAT_LO‐
74       CALE is 1.  The default path varies, but usually looks at a  number  of
75       places below /usr/share/locale.
76

STANDARDS

78       POSIX.1-2008.
79

HISTORY

81       POSIX.1-2001.
82

SEE ALSO

84       catgets(3), setlocale(3)
85
86
87
88Linux man-pages 6.04              2023-03-30                        catopen(3)
Impressum