summaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/crash_data.c1
-rw-r--r--src/lib/make_descr.c1
-rw-r--r--src/lib/parse_options.c10
-rw-r--r--src/lib/parse_options.h8
4 files changed, 12 insertions, 8 deletions
diff --git a/src/lib/crash_data.c b/src/lib/crash_data.c
index a372ab58..410f35f2 100644
--- a/src/lib/crash_data.c
+++ b/src/lib/crash_data.c
@@ -17,7 +17,6 @@
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "abrtlib.h"
-#include "abrt_crash_data.h"
static void free_crash_item(void *ptr)
{
diff --git a/src/lib/make_descr.c b/src/lib/make_descr.c
index ed0b99a2..d1209101 100644
--- a/src/lib/make_descr.c
+++ b/src/lib/make_descr.c
@@ -17,7 +17,6 @@
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "abrtlib.h"
-#include "abrt_crash_data.h"
// caller is responsible for freeing **dsc
static void add_content(bool *was_multiline, char **dsc, const char *header, const char *content)
diff --git a/src/lib/parse_options.c b/src/lib/parse_options.c
index bcec7869..3d631461 100644
--- a/src/lib/parse_options.c
+++ b/src/lib/parse_options.c
@@ -101,6 +101,7 @@ unsigned parse_opts(int argc, char **argv, const struct options *opt,
break;
case OPTION_INTEGER:
case OPTION_STRING:
+ case OPTION_LIST:
curopt->has_arg = required_argument;
if (opt[ii].short_name)
strbuf_append_strf(shortopts, "%c:", opt[ii].short_name);
@@ -165,15 +166,18 @@ unsigned parse_opts(int argc, char **argv, const struct options *opt,
if (opt[ii].value != NULL) switch (opt[ii].type)
{
case OPTION_BOOL:
- *(int*)opt[ii].value += 1;
+ *(int*)(opt[ii].value) += 1;
break;
case OPTION_INTEGER:
- *(int*)opt[ii].value = xatoi(optarg);
+ *(int*)(opt[ii].value) = xatoi(optarg);
break;
case OPTION_STRING:
case OPTION_OPTSTRING:
if (optarg)
- *(char**)opt[ii].value = (char*)optarg;
+ *(char**)(opt[ii].value) = (char*)optarg;
+ break;
+ case OPTION_LIST:
+ *(GList**)(opt[ii].value) = g_list_append(*(GList**)(opt[ii].value), optarg);
break;
case OPTION_END:
break;
diff --git a/src/lib/parse_options.h b/src/lib/parse_options.h
index 05d6fd90..82f3c6b8 100644
--- a/src/lib/parse_options.h
+++ b/src/lib/parse_options.h
@@ -28,6 +28,7 @@ enum parse_opt_type {
OPTION_STRING,
OPTION_INTEGER,
OPTION_OPTSTRING,
+ OPTION_LIST,
OPTION_END,
};
@@ -44,16 +45,17 @@ struct options {
* s - short_name
* l - long_name
* v - value
- * a - argh argument help
+ * a - option parameter name (for help text)
* h - help
*/
#define OPT_END() { OPTION_END }
#define OPT_BOOL(s, l, v, h) { OPTION_BOOL, (s), (l), (v), NULL, (h) }
-#define OPT_INTEGER(s, l, v, h) { OPTION_INTEGER, (s), (l), (v), "n", (h) }
+#define OPT_INTEGER(s, l, v, h) { OPTION_INTEGER, (s), (l), (v), "NUM", (h) }
#define OPT_STRING(s, l, v, a, h) { OPTION_STRING, (s), (l), (v), (a), (h) }
#define OPT_OPTSTRING(s, l, v, a, h) { OPTION_OPTSTRING, (s), (l), (v), (a), (h) }
+#define OPT_LIST(s, l, v, a, h) { OPTION_LIST, (s), (l), (v), (a), (h) }
-#define OPT__VERBOSE(v) OPT_BOOL('v', "verbose", (v), "Be verbose")
+#define OPT__VERBOSE(v) OPT_BOOL('v', "verbose", (v), _("Be verbose"))
#define parse_opts abrt_parse_opts
unsigned parse_opts(int argc, char **argv, const struct options *opt,