mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-27 06:26:15 +01:00
Warn if a short name is not acceptable.
2005-07-13 Matthias Clasen <mclasen@redhat.com> * glib/goption.c (g_option_group_add_entries): Warn if a short name is not acceptable.
This commit is contained in:
parent
138b6c99c0
commit
7b70e24179
@ -1,3 +1,8 @@
|
|||||||
|
2005-07-13 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
* glib/goption.c (g_option_group_add_entries): Warn if a
|
||||||
|
short name is not acceptable.
|
||||||
|
|
||||||
2005-07-12 Matthias Clasen <mclasen@redhat.com>
|
2005-07-12 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
* glib/goption.h (G_OPTION_FLAG_NOALIAS):
|
* glib/goption.h (G_OPTION_FLAG_NOALIAS):
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
2005-07-13 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
* glib/goption.c (g_option_group_add_entries): Warn if a
|
||||||
|
short name is not acceptable.
|
||||||
|
|
||||||
2005-07-12 Matthias Clasen <mclasen@redhat.com>
|
2005-07-12 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
* glib/goption.h (G_OPTION_FLAG_NOALIAS):
|
* glib/goption.h (G_OPTION_FLAG_NOALIAS):
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
2005-07-13 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
* glib/goption.c (g_option_group_add_entries): Warn if a
|
||||||
|
short name is not acceptable.
|
||||||
|
|
||||||
2005-07-12 Matthias Clasen <mclasen@redhat.com>
|
2005-07-12 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
* glib/goption.h (G_OPTION_FLAG_NOALIAS):
|
* glib/goption.h (G_OPTION_FLAG_NOALIAS):
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
2005-07-13 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
* glib/goption.c (g_option_group_add_entries): Warn if a
|
||||||
|
short name is not acceptable.
|
||||||
|
|
||||||
2005-07-12 Matthias Clasen <mclasen@redhat.com>
|
2005-07-12 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
* glib/goption.h (G_OPTION_FLAG_NOALIAS):
|
* glib/goption.h (G_OPTION_FLAG_NOALIAS):
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
2005-07-13 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
* glib/tmpl/option.sgml: Document that short names must
|
||||||
|
be printable ASCII characters != '-'.
|
||||||
|
|
||||||
2005-07-08 Matthias Clasen <mclasen@redhat.com>
|
2005-07-08 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
* === Released 2.7.2 ===
|
* === Released 2.7.2 ===
|
||||||
|
@ -316,7 +316,9 @@ g_option_context_add_main_entries() or g_option_group_add_entries().
|
|||||||
specify the option as
|
specify the option as
|
||||||
--<replaceable>groupname</replaceable>-<replaceable>long_name</replaceable>.
|
--<replaceable>groupname</replaceable>-<replaceable>long_name</replaceable>.
|
||||||
@short_name: If an option has a short name, it can be specified
|
@short_name: If an option has a short name, it can be specified
|
||||||
-<replaceable>short_name</replaceable> in a commandline.
|
-<replaceable>short_name</replaceable> in a commandline. @short_name must be
|
||||||
|
a printable ASCII character different from '-', or zero if the option has no
|
||||||
|
short name.
|
||||||
@flags: Flags from #GOptionFlags.
|
@flags: Flags from #GOptionFlags.
|
||||||
@arg: The type of the option, as a #GOptionArg.
|
@arg: The type of the option, as a #GOptionArg.
|
||||||
@arg_data: If the @arg type is %G_OPTION_ARG_CALLBACK, then @arg_data must
|
@arg_data: If the @arg type is %G_OPTION_ARG_CALLBACK, then @arg_data must
|
||||||
|
@ -1649,7 +1649,7 @@ void
|
|||||||
g_option_group_add_entries (GOptionGroup *group,
|
g_option_group_add_entries (GOptionGroup *group,
|
||||||
const GOptionEntry *entries)
|
const GOptionEntry *entries)
|
||||||
{
|
{
|
||||||
gint n_entries;
|
gint i, n_entries;
|
||||||
|
|
||||||
g_return_if_fail (entries != NULL);
|
g_return_if_fail (entries != NULL);
|
||||||
|
|
||||||
@ -1659,6 +1659,20 @@ g_option_group_add_entries (GOptionGroup *group,
|
|||||||
|
|
||||||
memcpy (group->entries + group->n_entries, entries, sizeof (GOptionEntry) * n_entries);
|
memcpy (group->entries + group->n_entries, entries, sizeof (GOptionEntry) * n_entries);
|
||||||
|
|
||||||
|
for (i = group->n_entries; i < group->n_entries + n_entries; i++)
|
||||||
|
{
|
||||||
|
gchar c = group->entries[i].short_name;
|
||||||
|
|
||||||
|
if (c)
|
||||||
|
{
|
||||||
|
if (c == '-' || !g_ascii_isprint (c))
|
||||||
|
{
|
||||||
|
g_warning (G_STRLOC": ignoring invalid short option '%c' (%d)", c, c);
|
||||||
|
group->entries[i].short_name = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
group->n_entries += n_entries;
|
group->n_entries += n_entries;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user