forked from enlightenment/efl
Gettext support in Ecore_Getopt. Thanks to k-s :)
SVN revision: 42155
This commit is contained in:
parent
49cb141f10
commit
2f319b9a5c
|
@ -5,6 +5,7 @@ rm -f aclocal.m4 ltmain.sh
|
||||||
|
|
||||||
touch README
|
touch README
|
||||||
|
|
||||||
|
echo "Running autopoint..." ; autopoint -f || :
|
||||||
echo "Running aclocal..." ; aclocal $ACLOCAL_FLAGS -I m4 || exit 1
|
echo "Running aclocal..." ; aclocal $ACLOCAL_FLAGS -I m4 || exit 1
|
||||||
echo "Running autoheader..." ; autoheader || exit 1
|
echo "Running autoheader..." ; autoheader || exit 1
|
||||||
echo "Running autoconf..." ; autoconf || exit 1
|
echo "Running autoconf..." ; autoconf || exit 1
|
||||||
|
|
|
@ -82,6 +82,7 @@ want_signature="no"
|
||||||
want_poll="yes"
|
want_poll="yes"
|
||||||
want_inotify="no"
|
want_inotify="no"
|
||||||
want_tslib="no"
|
want_tslib="no"
|
||||||
|
want_gettext="auto"
|
||||||
|
|
||||||
# core modules
|
# core modules
|
||||||
want_ecore_job="yes"
|
want_ecore_job="yes"
|
||||||
|
@ -1059,6 +1060,39 @@ AC_SUBST(requirements_ecore_x)
|
||||||
AC_SUBST(requirements_ecore_win32)
|
AC_SUBST(requirements_ecore_win32)
|
||||||
AC_SUBST(requirements_ecore_wince)
|
AC_SUBST(requirements_ecore_wince)
|
||||||
|
|
||||||
|
|
||||||
|
AC_ARG_ENABLE([gettext],
|
||||||
|
[AC_HELP_STRING([--disable-gettext], [disable gettext support and usage.])],
|
||||||
|
[if test "x${enableval}" = "xyes"; then
|
||||||
|
want_gettext="yes"
|
||||||
|
else
|
||||||
|
want_gettext="no"
|
||||||
|
fi
|
||||||
|
],
|
||||||
|
[want_gettext="auto"]
|
||||||
|
)
|
||||||
|
|
||||||
|
have_gettext="no"
|
||||||
|
if test "x${want_gettext}" = "xno"; then
|
||||||
|
AC_CHECK_HEADER([libintl.h], [have_gettext="yes"], [have_gettext="no"])
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test "x${have_gettext}" = "xno"; then
|
||||||
|
if test "x${want_gettext}" = "xyes"; then
|
||||||
|
AC_MSG_ERROR([Want gettext support but libintl.h was not found!"])
|
||||||
|
else
|
||||||
|
AC_MSG_WARN([libintl.h was not found, gettext support disabled."])
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
AC_DEFINE_UNQUOTED(HAVE_GETTEXT, 1, [Gettext/libintl.h was found and enabled])
|
||||||
|
AM_GNU_GETTEXT([external])
|
||||||
|
AM_GNU_GETTEXT_VERSION([0.12.1])
|
||||||
|
if test "x$LIBINTL" = "x"; then
|
||||||
|
LIBINTL="$INTLLIBS"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
AM_CONDITIONAL(ECORE_HAVE_GETTEXT, test "x${have_gettext}" = "xyes")
|
||||||
|
|
||||||
AC_OUTPUT([
|
AC_OUTPUT([
|
||||||
Makefile
|
Makefile
|
||||||
ecore-con.pc
|
ecore-con.pc
|
||||||
|
@ -1106,6 +1140,7 @@ src/lib/ecore_win32/Makefile
|
||||||
src/lib/ecore_wince/Makefile
|
src/lib/ecore_wince/Makefile
|
||||||
README
|
README
|
||||||
ecore.spec
|
ecore.spec
|
||||||
|
po/Makefile.in
|
||||||
])
|
])
|
||||||
|
|
||||||
echo
|
echo
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
# Makefile variables for PO directory in any package using GNU gettext.
|
||||||
|
|
||||||
|
# Usually the message domain is the same as the package name.
|
||||||
|
DOMAIN = $(PACKAGE)
|
||||||
|
|
||||||
|
# These two variables depend on the location of this directory.
|
||||||
|
subdir = po
|
||||||
|
top_builddir = ..
|
||||||
|
|
||||||
|
# These options get passed to xgettext.
|
||||||
|
XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ --from-code=UTF-8 --foreign-user
|
||||||
|
|
||||||
|
# This is the copyright holder that gets inserted into the header of the
|
||||||
|
# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding
|
||||||
|
# package. (Note that the msgstr strings, extracted from the package's
|
||||||
|
# sources, belong to the copyright holder of the package.) Translators are
|
||||||
|
# expected to transfer the copyright for their translations to this person
|
||||||
|
# or entity, or to disclaim their copyright. The empty string stands for
|
||||||
|
# the public domain; in this case the translators are expected to disclaim
|
||||||
|
# their copyright.
|
||||||
|
COPYRIGHT_HOLDER = Enlightenment development team
|
||||||
|
|
||||||
|
# This is the email address or URL to which the translators shall report
|
||||||
|
# bugs in the untranslated strings:
|
||||||
|
# - Strings which are not entire sentences, see the maintainer guidelines
|
||||||
|
# in the GNU gettext documentation, section 'Preparing Strings'.
|
||||||
|
# - Strings which use unclear terms or require additional context to be
|
||||||
|
# understood.
|
||||||
|
# - Strings which make invalid assumptions about notation of date, time or
|
||||||
|
# money.
|
||||||
|
# - Pluralisation problems.
|
||||||
|
# - Incorrect English spelling.
|
||||||
|
# - Incorrect formatting.
|
||||||
|
# It can be your email address, or a mailing list address where translators
|
||||||
|
# can write to without being subscribed, or the URL of a web page through
|
||||||
|
# which the translators can contact you.
|
||||||
|
MSGID_BUGS_ADDRESS = enlightenment-devel@lists.sourceforge.net
|
||||||
|
|
||||||
|
# This is the list of locale categories, beyond LC_MESSAGES, for which the
|
||||||
|
# message catalogs shall be used. It is usually empty.
|
||||||
|
EXTRA_LOCALE_CATEGORIES =
|
|
@ -0,0 +1 @@
|
||||||
|
src/lib/ecore/ecore_getopt.c
|
|
@ -11,6 +11,15 @@
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_GETTEXT
|
||||||
|
#include <libintl.h>
|
||||||
|
#else HAVE_GETTEXT
|
||||||
|
#define gettext(x) (x)
|
||||||
|
#define dgettext(domain, x) (x)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define _(x) dgettext("ecore", x)
|
||||||
|
|
||||||
#ifdef _WIN32_WCE
|
#ifdef _WIN32_WCE
|
||||||
# include <Evil.h>
|
# include <Evil.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -61,22 +70,24 @@ _ecore_getopt_help_print_replace_program(FILE *fp, const Ecore_Getopt *parser __
|
||||||
static void
|
static void
|
||||||
_ecore_getopt_version(FILE *fp, const Ecore_Getopt *parser)
|
_ecore_getopt_version(FILE *fp, const Ecore_Getopt *parser)
|
||||||
{
|
{
|
||||||
fputs("Version: ", fp);
|
fputs(_("Version:"), fp);
|
||||||
|
fputc(' ', fp);
|
||||||
_ecore_getopt_help_print_replace_program(fp, parser, parser->version);
|
_ecore_getopt_help_print_replace_program(fp, parser, parser->version);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_ecore_getopt_help_usage(FILE *fp, const Ecore_Getopt *parser)
|
_ecore_getopt_help_usage(FILE *fp, const Ecore_Getopt *parser)
|
||||||
{
|
{
|
||||||
fputs("Usage: ", fp);
|
fputs(_("Usage:"), fp);
|
||||||
|
fputc(' ', fp);
|
||||||
|
|
||||||
if (!parser->usage)
|
if (!parser->usage)
|
||||||
{
|
{
|
||||||
fprintf(fp, "%s [options]\n", prog);
|
fprintf(fp, _("%s [options]\n"), prog);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_ecore_getopt_help_print_replace_program(fp, parser, parser->usage);
|
_ecore_getopt_help_print_replace_program(fp, parser, gettext(parser->usage));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -166,7 +177,7 @@ _ecore_getopt_help_description(FILE *fp, const Ecore_Getopt *parser)
|
||||||
const char *p, *prg, *ver;
|
const char *p, *prg, *ver;
|
||||||
int used, prglen, verlen;
|
int used, prglen, verlen;
|
||||||
|
|
||||||
p = parser->description;
|
p = gettext(parser->description);
|
||||||
if (!p)
|
if (!p)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -219,18 +230,22 @@ _ecore_getopt_help_description(FILE *fp, const Ecore_Getopt *parser)
|
||||||
static void
|
static void
|
||||||
_ecore_getopt_copyright(FILE *fp, const Ecore_Getopt *parser)
|
_ecore_getopt_copyright(FILE *fp, const Ecore_Getopt *parser)
|
||||||
{
|
{
|
||||||
fputs("Copyright:\n ", fp);
|
const char *txt = gettext(parser->copyright);
|
||||||
|
fputs(_("Copyright:"), fp);
|
||||||
|
fputs(_("\n ", fp);
|
||||||
_ecore_getopt_help_line
|
_ecore_getopt_help_line
|
||||||
(fp, 3, cols, 3, parser->copyright, strlen(parser->copyright));
|
(fp, 3, cols, 3, txt, strlen(txt));
|
||||||
fputc('\n', fp);
|
fputc('\n', fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_ecore_getopt_license(FILE *fp, const Ecore_Getopt *parser)
|
_ecore_getopt_license(FILE *fp, const Ecore_Getopt *parser)
|
||||||
{
|
{
|
||||||
fputs("License:\n ", fp);
|
const char *txt = gettext(parser->license);
|
||||||
|
fputs(_("License:"), fp);
|
||||||
|
fputs("\n ", fp);
|
||||||
_ecore_getopt_help_line
|
_ecore_getopt_help_line
|
||||||
(fp, 3, cols, 3, parser->license, strlen(parser->license));
|
(fp, 3, cols, 3, txt, strlen(txt));
|
||||||
fputc('\n', fp);
|
fputc('\n', fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -269,11 +284,12 @@ _ecore_getopt_help_desc_setup_metavar(const Ecore_Getopt_Desc *desc, char *metav
|
||||||
{
|
{
|
||||||
if (desc->metavar)
|
if (desc->metavar)
|
||||||
{
|
{
|
||||||
*metavarlen = strlen(desc->metavar);
|
const char *txt = gettext(desc->metavar);
|
||||||
|
*metavarlen = strlen(txt);
|
||||||
if (*metavarlen > maxsize - 1)
|
if (*metavarlen > maxsize - 1)
|
||||||
*metavarlen = maxsize - 1;
|
*metavarlen = maxsize - 1;
|
||||||
|
|
||||||
memcpy(metavar, desc->metavar, *metavarlen);
|
memcpy(metavar, txt, *metavarlen);
|
||||||
metavar[*metavarlen] = '\0';
|
metavar[*metavarlen] = '\0';
|
||||||
}
|
}
|
||||||
else if (desc->longname)
|
else if (desc->longname)
|
||||||
|
@ -565,7 +581,7 @@ _ecore_getopt_help_options(FILE *fp, const Ecore_Getopt *parser)
|
||||||
{
|
{
|
||||||
const Ecore_Getopt_Desc *desc;
|
const Ecore_Getopt_Desc *desc;
|
||||||
|
|
||||||
fputs("Options:\n", fp);
|
fputs(_("Options:\n"), fp);
|
||||||
|
|
||||||
for (desc = parser->descs; !_ecore_getopt_desc_is_sentinel(desc); desc++)
|
for (desc = parser->descs; !_ecore_getopt_desc_is_sentinel(desc); desc++)
|
||||||
_ecore_getopt_help_desc(fp, desc);
|
_ecore_getopt_help_desc(fp, desc);
|
||||||
|
@ -684,9 +700,9 @@ _ecore_getopt_parse_find_nonargs_base(const Ecore_Getopt *parser, int argc, char
|
||||||
if (!desc)
|
if (!desc)
|
||||||
{
|
{
|
||||||
if (arg[1] == '-')
|
if (arg[1] == '-')
|
||||||
fprintf(stderr, "ERROR: unknown option --%s.\n", arg + 2);
|
fprintf(stderr, _("ERROR: unknown option --%s.\n"), arg + 2);
|
||||||
else
|
else
|
||||||
fprintf(stderr, "ERROR: unknown option -%c.\n", arg[1]);
|
fprintf(stderr, _("ERROR: unknown option -%c.\n"), arg[1]);
|
||||||
if (parser->strict)
|
if (parser->strict)
|
||||||
{
|
{
|
||||||
memmove(argv + dst, nonargs, used * sizeof(char *));
|
memmove(argv + dst, nonargs, used * sizeof(char *));
|
||||||
|
@ -743,7 +759,7 @@ _ecore_getopt_desc_print_error(const Ecore_Getopt_Desc *desc, const char *fmt, .
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
fputs("ERROR: ", stderr);
|
fputs(_("ERROR: "), stderr);
|
||||||
|
|
||||||
if (desc->shortname)
|
if (desc->shortname)
|
||||||
{
|
{
|
||||||
|
@ -774,7 +790,12 @@ _ecore_getopt_parse_bool(const char *str, unsigned char *v)
|
||||||
(strcasecmp(str, "f") == 0) ||
|
(strcasecmp(str, "f") == 0) ||
|
||||||
(strcasecmp(str, "false") == 0) ||
|
(strcasecmp(str, "false") == 0) ||
|
||||||
(strcasecmp(str, "no") == 0) ||
|
(strcasecmp(str, "no") == 0) ||
|
||||||
(strcasecmp(str, "off") == 0))
|
(strcasecmp(str, "off") == 0) ||
|
||||||
|
|
||||||
|
(strcasecmp(str, _("f")) == 0) ||
|
||||||
|
(strcasecmp(str, _("false")) == 0) ||
|
||||||
|
(strcasecmp(str, _("no")) == 0) ||
|
||||||
|
(strcasecmp(str, _("off")) == 0))
|
||||||
{
|
{
|
||||||
*v = 0;
|
*v = 0;
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -783,7 +804,12 @@ _ecore_getopt_parse_bool(const char *str, unsigned char *v)
|
||||||
(strcasecmp(str, "t") == 0) ||
|
(strcasecmp(str, "t") == 0) ||
|
||||||
(strcasecmp(str, "true") == 0) ||
|
(strcasecmp(str, "true") == 0) ||
|
||||||
(strcasecmp(str, "yes") == 0) ||
|
(strcasecmp(str, "yes") == 0) ||
|
||||||
(strcasecmp(str, "on") == 0))
|
(strcasecmp(str, "on") == 0) ||
|
||||||
|
|
||||||
|
(strcasecmp(str, _("t")) == 0) ||
|
||||||
|
(strcasecmp(str, _("true")) == 0) ||
|
||||||
|
(strcasecmp(str, _("yes")) == 0) ||
|
||||||
|
(strcasecmp(str, _("on")) == 0))
|
||||||
{
|
{
|
||||||
*v = 1;
|
*v = 1;
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -818,7 +844,7 @@ _ecore_getopt_parse_store(const Ecore_Getopt *parser __UNUSED__, const Ecore_Get
|
||||||
|
|
||||||
if (!value->ptrp)
|
if (!value->ptrp)
|
||||||
{
|
{
|
||||||
_ecore_getopt_desc_print_error(desc, "value has no pointer set.\n");
|
_ecore_getopt_desc_print_error(desc, _("value has no pointer set.\n"));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -847,7 +873,7 @@ _ecore_getopt_parse_store(const Ecore_Getopt *parser __UNUSED__, const Ecore_Get
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_ecore_getopt_desc_print_error
|
_ecore_getopt_desc_print_error
|
||||||
(desc, "unknown boolean value %s.\n", arg_val);
|
(desc, _("unknown boolean value %s.\n"), arg_val);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case ECORE_GETOPT_TYPE_SHORT:
|
case ECORE_GETOPT_TYPE_SHORT:
|
||||||
|
@ -890,7 +916,8 @@ _ecore_getopt_parse_store(const Ecore_Getopt *parser __UNUSED__, const Ecore_Get
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
_ecore_getopt_desc_print_error(desc, "invalid number format %s\n", arg_val);
|
_ecore_getopt_desc_print_error
|
||||||
|
(desc, _("invalid number format %s\n"), arg_val);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
use_optional:
|
use_optional:
|
||||||
|
@ -933,7 +960,7 @@ _ecore_getopt_parse_store_const(const Ecore_Getopt *parser __UNUSED__, const Eco
|
||||||
{
|
{
|
||||||
if (!val->ptrp)
|
if (!val->ptrp)
|
||||||
{
|
{
|
||||||
_ecore_getopt_desc_print_error(desc, "value has no pointer set.\n");
|
_ecore_getopt_desc_print_error(desc, _("value has no pointer set.\n"));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -946,7 +973,7 @@ _ecore_getopt_parse_store_true(const Ecore_Getopt *parser __UNUSED__, const Ecor
|
||||||
{
|
{
|
||||||
if (!val->boolp)
|
if (!val->boolp)
|
||||||
{
|
{
|
||||||
_ecore_getopt_desc_print_error(desc, "value has no pointer set.\n");
|
_ecore_getopt_desc_print_error(desc, _("value has no pointer set.\n"));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
*val->boolp = 1;
|
*val->boolp = 1;
|
||||||
|
@ -958,7 +985,7 @@ _ecore_getopt_parse_store_false(const Ecore_Getopt *parser __UNUSED__, const Eco
|
||||||
{
|
{
|
||||||
if (!val->boolp)
|
if (!val->boolp)
|
||||||
{
|
{
|
||||||
_ecore_getopt_desc_print_error(desc, "value has no pointer set.\n");
|
_ecore_getopt_desc_print_error(desc, _("value has no pointer set.\n"));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
*val->boolp = 0;
|
*val->boolp = 0;
|
||||||
|
@ -972,7 +999,7 @@ _ecore_getopt_parse_choice(const Ecore_Getopt *parser __UNUSED__, const Ecore_Ge
|
||||||
|
|
||||||
if (!val->strp)
|
if (!val->strp)
|
||||||
{
|
{
|
||||||
_ecore_getopt_desc_print_error(desc, "value has no pointer set.\n");
|
_ecore_getopt_desc_print_error(desc, _("value has no pointer set.\n"));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -985,7 +1012,7 @@ _ecore_getopt_parse_choice(const Ecore_Getopt *parser __UNUSED__, const Ecore_Ge
|
||||||
}
|
}
|
||||||
|
|
||||||
_ecore_getopt_desc_print_error
|
_ecore_getopt_desc_print_error
|
||||||
(desc, "invalid choice \"%s\". Valid values are: ", arg_val);
|
(desc, _("invalid choice \"%s\". Valid values are: "), arg_val);
|
||||||
|
|
||||||
pchoice = desc->action_param.choices;
|
pchoice = desc->action_param.choices;
|
||||||
for (; *pchoice != NULL; pchoice++)
|
for (; *pchoice != NULL; pchoice++)
|
||||||
|
@ -1009,13 +1036,14 @@ _ecore_getopt_parse_append(const Ecore_Getopt *parser __UNUSED__, const Ecore_Ge
|
||||||
|
|
||||||
if (!arg_val)
|
if (!arg_val)
|
||||||
{
|
{
|
||||||
_ecore_getopt_desc_print_error(desc, "missing parameter to append.\n");
|
_ecore_getopt_desc_print_error
|
||||||
|
(desc, _("missing parameter to append.\n"));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!val->listp)
|
if (!val->listp)
|
||||||
{
|
{
|
||||||
_ecore_getopt_desc_print_error(desc, "value has no pointer set.\n");
|
_ecore_getopt_desc_print_error(desc, _("value has no pointer set.\n"));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1035,7 +1063,7 @@ _ecore_getopt_parse_append(const Ecore_Getopt *parser __UNUSED__, const Ecore_Ge
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_ecore_getopt_desc_print_error
|
_ecore_getopt_desc_print_error
|
||||||
(desc, "unknown boolean value %s.\n", arg_val);
|
(desc, _("unknown boolean value %s.\n"), arg_val);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1105,8 +1133,8 @@ _ecore_getopt_parse_append(const Ecore_Getopt *parser __UNUSED__, const Ecore_Ge
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
_ecore_getopt_desc_print_error(desc, "could not parse value.\n");
|
_ecore_getopt_desc_print_error(desc, _("could not parse value.\n"));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1114,7 +1142,8 @@ _ecore_getopt_parse_append(const Ecore_Getopt *parser __UNUSED__, const Ecore_Ge
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
_ecore_getopt_desc_print_error(desc, "invalid number format %s\n", arg_val);
|
_ecore_getopt_desc_print_error
|
||||||
|
(desc, _("invalid number format %s\n"), arg_val);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1123,7 +1152,7 @@ _ecore_getopt_parse_count(const Ecore_Getopt *parser __UNUSED__, const Ecore_Get
|
||||||
{
|
{
|
||||||
if (!val->intp)
|
if (!val->intp)
|
||||||
{
|
{
|
||||||
_ecore_getopt_desc_print_error(desc, "value has no pointer set.\n");
|
_ecore_getopt_desc_print_error(desc, _("value has no pointer set.\n"));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1153,21 +1182,21 @@ _ecore_getopt_parse_callback(const Ecore_Getopt *parser, const Ecore_Getopt_Desc
|
||||||
{
|
{
|
||||||
if ((!arg_val) || (arg_val[0] == '\0'))
|
if ((!arg_val) || (arg_val[0] == '\0'))
|
||||||
{
|
{
|
||||||
_ecore_getopt_desc_print_error(desc, "missing parameter.\n");
|
_ecore_getopt_desc_print_error(desc, _("missing parameter.\n"));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!val->ptrp)
|
if (!val->ptrp)
|
||||||
{
|
{
|
||||||
_ecore_getopt_desc_print_error
|
_ecore_getopt_desc_print_error
|
||||||
(desc, "value has no pointer set.\n");
|
(desc, _("value has no pointer set.\n"));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cb->func)
|
if (!cb->func)
|
||||||
{
|
{
|
||||||
_ecore_getopt_desc_print_error(desc, "missing callback function!\n");
|
_ecore_getopt_desc_print_error(desc, _("missing callback function!\n"));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1190,7 +1219,7 @@ _ecore_getopt_parse_version(const Ecore_Getopt *parser, const Ecore_Getopt_Desc
|
||||||
(*val->boolp) = 1;
|
(*val->boolp) = 1;
|
||||||
if (!parser->version)
|
if (!parser->version)
|
||||||
{
|
{
|
||||||
_ecore_getopt_desc_print_error(desc, "no version was defined.\n");
|
_ecore_getopt_desc_print_error(desc, _("no version was defined.\n"));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
_ecore_getopt_version(stdout, parser);
|
_ecore_getopt_version(stdout, parser);
|
||||||
|
@ -1204,7 +1233,7 @@ _ecore_getopt_parse_copyright(const Ecore_Getopt *parser, const Ecore_Getopt_Des
|
||||||
(*val->boolp) = 1;
|
(*val->boolp) = 1;
|
||||||
if (!parser->copyright)
|
if (!parser->copyright)
|
||||||
{
|
{
|
||||||
_ecore_getopt_desc_print_error(desc, "no copyright was defined.\n");
|
_ecore_getopt_desc_print_error(desc, _("no copyright was defined.\n"));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
_ecore_getopt_copyright(stdout, parser);
|
_ecore_getopt_copyright(stdout, parser);
|
||||||
|
@ -1218,7 +1247,7 @@ _ecore_getopt_parse_license(const Ecore_Getopt *parser, const Ecore_Getopt_Desc
|
||||||
(*val->boolp) = 1;
|
(*val->boolp) = 1;
|
||||||
if (!parser->license)
|
if (!parser->license)
|
||||||
{
|
{
|
||||||
_ecore_getopt_desc_print_error(desc, "no license was defined.\n");
|
_ecore_getopt_desc_print_error(desc, _("no license was defined.\n"));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
_ecore_getopt_license(stdout, parser);
|
_ecore_getopt_license(stdout, parser);
|
||||||
|
@ -1272,7 +1301,7 @@ _ecore_getopt_parse_arg_long(const Ecore_Getopt *parser, Ecore_Getopt_Value *val
|
||||||
desc = _ecore_getopt_parse_find_long(parser, arg);
|
desc = _ecore_getopt_parse_find_long(parser, arg);
|
||||||
if (!desc)
|
if (!desc)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "ERROR: unknown option --%s, ignored.\n", arg);
|
fprintf(stderr, _("ERROR: unknown option --%s, ignored.\n"), arg);
|
||||||
if (parser->strict)
|
if (parser->strict)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -1304,7 +1333,8 @@ _ecore_getopt_parse_arg_long(const Ecore_Getopt *parser, Ecore_Getopt_Value *val
|
||||||
|
|
||||||
if ((!arg_val) && (arg_req == ECORE_GETOPT_DESC_ARG_REQUIREMENT_YES))
|
if ((!arg_val) && (arg_req == ECORE_GETOPT_DESC_ARG_REQUIREMENT_YES))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "ERROR: option --%s requires an argument!\n", arg);
|
fprintf
|
||||||
|
(stderr, _("ERROR: option --%s requires an argument!\n"), arg);
|
||||||
if (parser->strict)
|
if (parser->strict)
|
||||||
return 0;
|
return 0;
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -1339,7 +1369,8 @@ _ecore_getopt_parse_arg_short(const Ecore_Getopt *parser, Ecore_Getopt_Value *va
|
||||||
desc = _ecore_getopt_parse_find_short(parser, arg[0]);
|
desc = _ecore_getopt_parse_find_short(parser, arg[0]);
|
||||||
if (!desc)
|
if (!desc)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "ERROR: unknown option -%c, ignored.\n", arg[0]);
|
fprintf
|
||||||
|
(stderr, _("ERROR: unknown option -%c, ignored.\n"), arg[0]);
|
||||||
if (parser->strict)
|
if (parser->strict)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -1376,8 +1407,9 @@ _ecore_getopt_parse_arg_short(const Ecore_Getopt *parser, Ecore_Getopt_Value *va
|
||||||
if ((!arg_val) &&
|
if ((!arg_val) &&
|
||||||
(arg_req == ECORE_GETOPT_DESC_ARG_REQUIREMENT_YES))
|
(arg_req == ECORE_GETOPT_DESC_ARG_REQUIREMENT_YES))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "ERROR: option -%c requires an argument!\n",
|
fprintf
|
||||||
opt);
|
(stderr, _("ERROR: option -%c requires an argument!\n"),
|
||||||
|
opt);
|
||||||
if (parser->strict)
|
if (parser->strict)
|
||||||
return 0;
|
return 0;
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -1558,6 +1590,10 @@ _ecore_getopt_find_help(const Ecore_Getopt *parser)
|
||||||
*
|
*
|
||||||
* This function may reorder @a argv elements.
|
* This function may reorder @a argv elements.
|
||||||
*
|
*
|
||||||
|
* Translation of help strings (description), metavar, usage, license
|
||||||
|
* and copyright may be translated, standard/global gettext() call
|
||||||
|
* will be applied on them if ecore was compiled with such support.
|
||||||
|
*
|
||||||
* @param parser description of how to work.
|
* @param parser description of how to work.
|
||||||
* @param value where to store values, it is assumed that this is a vector
|
* @param value where to store values, it is assumed that this is a vector
|
||||||
* of the same size as @c parser->descs. Values should be previously
|
* of the same size as @c parser->descs. Values should be previously
|
||||||
|
@ -1575,12 +1611,12 @@ ecore_getopt_parse(const Ecore_Getopt *parser, Ecore_Getopt_Value *values, int a
|
||||||
|
|
||||||
if (!parser)
|
if (!parser)
|
||||||
{
|
{
|
||||||
fputs("ERROR: no parser provided.\n", stderr);
|
fputs(_("ERROR: no parser provided.\n"), stderr);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (!values)
|
if (!values)
|
||||||
{
|
{
|
||||||
fputs("ERROR: no values provided.\n", stderr);
|
fputs(_("ERROR: no values provided.\n"), stderr);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1589,7 +1625,7 @@ ecore_getopt_parse(const Ecore_Getopt *parser, Ecore_Getopt_Value *values, int a
|
||||||
|
|
||||||
if (argc < 1)
|
if (argc < 1)
|
||||||
{
|
{
|
||||||
fputs("ERROR: no arguments provided.\n", stderr);
|
fputs(_("ERROR: no arguments provided.\n"), stderr);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1615,15 +1651,15 @@ ecore_getopt_parse(const Ecore_Getopt *parser, Ecore_Getopt_Value *values, int a
|
||||||
error:
|
error:
|
||||||
{
|
{
|
||||||
const Ecore_Getopt_Desc *help;
|
const Ecore_Getopt_Desc *help;
|
||||||
fputs("ERROR: invalid options found.", stderr);
|
fputs(_("ERROR: invalid options found."), stderr);
|
||||||
|
|
||||||
help = _ecore_getopt_find_help(parser);
|
help = _ecore_getopt_find_help(parser);
|
||||||
if (!help)
|
if (!help)
|
||||||
fputc('\n', stderr);
|
fputc('\n', stderr);
|
||||||
else if (help->longname)
|
else if (help->longname)
|
||||||
fprintf(stderr, " See --%s.\n", help->longname);
|
fprintf(stderr, _(" See --%s.\n"), help->longname);
|
||||||
else
|
else
|
||||||
fprintf(stderr, " See -%c.\n", help->shortname);
|
fprintf(stderr, _(" See -%c.\n"), help->shortname);
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -1660,7 +1696,7 @@ ecore_getopt_callback_geometry_parse(const Ecore_Getopt *parser __UNUSED__, cons
|
||||||
|
|
||||||
if (sscanf(str, "%d:%d:%d:%d", &v->x, &v->y, &v->w, &v->h) != 4)
|
if (sscanf(str, "%d:%d:%d:%d", &v->x, &v->y, &v->w, &v->h) != 4)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "ERROR: incorrect geometry value '%s'\n", str);
|
fprintf(stderr, _("ERROR: incorrect geometry value '%s'\n"), str);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1683,7 +1719,7 @@ ecore_getopt_callback_size_parse(const Ecore_Getopt *parser __UNUSED__, const Ec
|
||||||
|
|
||||||
if (sscanf(str, "%dx%d", &v->w, &v->h) != 2)
|
if (sscanf(str, "%dx%d", &v->w, &v->h) != 2)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "ERROR: incorrect size value '%s'\n", str);
|
fprintf(stderr, _("ERROR: incorrect size value '%s'\n"), str);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
v->x = 0;
|
v->x = 0;
|
||||||
|
|
Loading…
Reference in New Issue