isl_convex_hull.c: extend: fix error handling
[platform/upstream/isl.git] / cat.c
diff --git a/cat.c b/cat.c
index 0b23658..21fbf66 100644 (file)
--- a/cat.c
+++ b/cat.c
@@ -1,9 +1,11 @@
+#include <assert.h>
 #include <isl_map.h>
 
 struct isl_arg_choice cat_format[] = {
        {"isl",         ISL_FORMAT_ISL},
        {"omega",       ISL_FORMAT_OMEGA},
        {"polylib",     ISL_FORMAT_POLYLIB},
+       {"latex",       ISL_FORMAT_LATEX},
        {0}
 };
 
@@ -13,9 +15,10 @@ struct cat_options {
 };
 
 struct isl_arg cat_options_arg[] = {
-ISL_ARG_CHILD(struct cat_options, isl, "isl", isl_options_arg)
+ISL_ARG_CHILD(struct cat_options, isl, "isl", isl_options_arg, "isl options")
 ISL_ARG_CHOICE(struct cat_options, format, 0, "format", \
-       cat_format,     ISL_FORMAT_ISL)
+       cat_format,     ISL_FORMAT_ISL, "output format")
+ISL_ARG_END
 };
 
 ISL_ARG_DEF(cat_options, struct cat_options, cat_options_arg)
@@ -28,10 +31,9 @@ int main(int argc, char **argv)
 
        options = cat_options_new_with_defaults();
        assert(options);
-       argc = cat_options_parse(options, argc, argv);
+       argc = cat_options_parse(options, argc, argv, ISL_ARG_ALL);
 
-       ctx = isl_ctx_alloc_with_options(options->isl);
-       options->isl = NULL;
+       ctx = isl_ctx_alloc_with_options(cat_options_arg, options);
 
        map = isl_map_read_from_file(ctx, stdin, -1);
        isl_map_print(map, stdout, 0, options->format);
@@ -40,7 +42,6 @@ int main(int argc, char **argv)
        isl_map_free(map);
 
        isl_ctx_free(ctx);
-       free(options);
 
        return 0;
 }