Annotation of embedaddon/sudo/include/gettext.h, revision 1.1.1.3

1.1       misho       1: /*
1.1.1.3 ! misho       2:  * Copyright (c) 2011-2012 Todd C. Miller <Todd.Miller@courtesan.com>
1.1       misho       3:  *
                      4:  * Permission to use, copy, modify, and distribute this software for any
                      5:  * purpose with or without fee is hereby granted, provided that the above
                      6:  * copyright notice and this permission notice appear in all copies.
                      7:  *
                      8:  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
                      9:  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
                     10:  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
                     11:  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
                     12:  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
                     13:  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
                     14:  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
                     15:  */
                     16: 
                     17: #ifndef _SUDO_GETTEXT_H
                     18: #define _SUDO_GETTEXT_H
                     19: 
                     20: /*
                     21:  * Solaris locale.h includes libintl.h which causes problems when we
                     22:  * redefine the gettext functions.  We include it first to avoid this.
                     23:  */
1.1.1.3 ! misho      24: #include <locale.h>
1.1       misho      25: 
                     26: #ifdef HAVE_LIBINTL_H
                     27: 
                     28: # include <libintl.h>
                     29: 
                     30: /*
                     31:  * If DEFAULT_TEXT_DOMAIN is defined, use its value as the domain for
                     32:  * gettext() and ngettext() instead of the value set by textdomain().
                     33:  * This is used by the sudoers plugin as well as the convenience libraries.
                     34:  */
                     35: # ifdef DEFAULT_TEXT_DOMAIN
                     36: #  undef gettext
                     37: #  define gettext(String) \
                     38:     dgettext(DEFAULT_TEXT_DOMAIN, String)
                     39: #  undef ngettext
                     40: #  define ngettext(String, String_Plural, N) \
                     41:     dngettext(DEFAULT_TEXT_DOMAIN, String, String_Plural, N)
                     42: # endif
                     43: 
1.1.1.2   misho      44: /*
                     45:  * Older versions of Solaris lack ngettext() so we have to kludge it.
                     46:  */
                     47: # ifndef HAVE_NGETTEXT
                     48: #  undef ngettext
                     49: #  define ngettext(String, String_Plural, N) \
                     50:     ((N) == 1 ? gettext(String) : gettext(String_Plural))
                     51: # endif
                     52: 
1.1       misho      53: /* Gettext convenience macros */
                     54: # define _(String) gettext(String)
                     55: # define gettext_noop(String) String
                     56: # define N_(String) gettext_noop(String)
                     57: 
                     58: #else /* !HAVE_LIBINTL_H */
                     59: 
                     60: /*
                     61:  * Internationalization is either unavailable or has been disabled.
                     62:  * Define away the gettext functions used by sudo.
                     63:  */
                     64: # define _(String) String 
                     65: # define N_(String) String
                     66: # define textdomain(Domain)
                     67: # define bindtextdomain(Package, Directory)
                     68: # define ngettext(String, String_Plural, N) \
                     69:     ((N) == 1 ? (String) : (String_Plural))
                     70: 
                     71: #endif /* HAVE_LIBINTL_H */
                     72: 
                     73: #endif /* _SUDO_GETTEXT_H */

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>