patches: update lighttpd patches
[git-osx-installer.git] / src / gettext-util.c
bloba516a8fbc10aa7105eaef39a732edcb7b31c8a39
1 /*
3 gettext-util.c - git gettext utility for Mac OS X
4 Copyright (C) 2014,2015 Kyle J. McKay. All rights reserved.
6 This program is free software; you can redistribute it and/or
7 modify it under the terms of the GNU General Public License
8 as published by the Free Software Foundation; either version 2
9 of the License, or (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 #include "git-compat-util.h"
23 #include "gettext.h"
25 int main(int argc, char **argv)
27 const char usage[] = "Usage: git gettext MSGID [MSGID_PLURAL N]";
28 long n = 0;
29 if (argc != 2 && argc != 4)
30 die("%s", usage);
31 if (argc == 4) {
32 char *end;
33 n = strtol(argv[3], &end, 10);
34 if (!argv[3][0] || *end || n < 0)
35 die("%s", usage);
37 git_setup_gettext();
38 if (argc == 4) {
39 printf("%s", ngettext(argv[1], argv[2], (unsigned long)n));
40 } else {
41 printf("%s", gettext(argv[1]));
43 return 0;