File: gettext.h

package info (click to toggle)
sudo 1.8.10p3-1%2Bdeb8u2
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 12,212 kB
  • sloc: ansic: 50,774; sh: 18,066; makefile: 2,527; yacc: 1,576; lex: 1,113; perl: 386
file content (75 lines) | stat: -rw-r--r-- 2,423 bytes parent folder | download | duplicates (2)
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
65
66
67
68
69
70
71
72
73
74
75
/*
 * Copyright (c) 2011-2012 Todd C. Miller <Todd.Miller@courtesan.com>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#ifndef _SUDO_GETTEXT_H
#define _SUDO_GETTEXT_H

/*
 * Solaris locale.h includes libintl.h which causes problems when we
 * redefine the gettext functions.  We include it first to avoid this.
 */
#include <locale.h>

#ifdef HAVE_LIBINTL_H

# include <libintl.h>

/*
 * If DEFAULT_TEXT_DOMAIN is defined, use its value as the domain for
 * gettext() and ngettext() instead of the value set by textdomain().
 * This is used by the sudoers plugin as well as the convenience libraries.
 */
# ifdef DEFAULT_TEXT_DOMAIN
#  undef gettext
#  define gettext(String) \
    dgettext(DEFAULT_TEXT_DOMAIN, String)
#  undef ngettext
#  define ngettext(String, String_Plural, N) \
    dngettext(DEFAULT_TEXT_DOMAIN, String, String_Plural, N)
# endif

/*
 * Older versions of Solaris lack ngettext() so we have to kludge it.
 */
# ifndef HAVE_NGETTEXT
#  undef ngettext
#  define ngettext(String, String_Plural, N) \
    ((N) == 1 ? gettext(String) : gettext(String_Plural))
# endif

/* Gettext convenience macros */
# define _(String) gettext(String)
# define gettext_noop(String) String
# define N_(String) gettext_noop(String)
# define U_(String) warning_gettext(String)

#else /* !HAVE_LIBINTL_H */

/*
 * Internationalization is either unavailable or has been disabled.
 * Define away the gettext functions used by sudo.
 */
# define _(String) String 
# define N_(String) String
# define U_(String) String
# define textdomain(Domain)
# define bindtextdomain(Package, Directory)
# define ngettext(String, String_Plural, N) \
    ((N) == 1 ? (String) : (String_Plural))

#endif /* HAVE_LIBINTL_H */

#endif /* _SUDO_GETTEXT_H */