-SUBDIRS = modules
-
AM_CFLAGS = $(GLIB_CFLAGS)
LIBS += $(GLIB_LIBS) -lgobject-2.0 -L$(top_srcdir)/ltt -ltraceread
#LIBS += $(GLIB_LIBS) -lgobject-2.0 -lltt
libtextDump_la_SOURCES = textDump.c
libbatchAnalysis_la_LDFLAGS = -module
libbatchAnalysis_la_SOURCES = batchAnalysis.c
+
+
+# WARNING : must be done at the end, so modules can dynamically link themselves
+# to libraries compiled here but not installed in the system.
+SUBDIRS = modules
+
#include <lttv/option.h>
#include <lttv/traceset.h>
#include <ltt/trace.h>
+#include <stdio.h>
+
void lttv_option_init(int argc, char **argv);
void lttv_option_destroy();
static void lttv_module_path_option(void *hook_data);
+static void lttv_help(void);
/* Since everything is done in modules, the main program only takes care
of the infrastructure. */
"add a directory to the module search path",
"directory to add to the path", LTTV_OPT_STRING, &a_module_path,
lttv_module_path_option, NULL);
-
+
+ lttv_option_add("help",'h', "basic help", "none",
+ LTTV_OPT_NONE, NULL, lttv_help, NULL);
+
+
lttv_hooks_call(before_options, NULL);
lttv_option_parse(argc, argv);
lttv_hooks_call(after_options, NULL);
{
lttv_module_path_add(a_module_path);
}
+
+void lttv_help()
+{
+ printf("Linux Trace Toolkit Visualizer\n");
+ printf("\n");
+ lttv_option_show_help();
+ printf("\n");
+}
destroy_popts(&list, &popts, &c);
}
+static void show_help(LttvOption *option)
+{
+ printf("--%s -%c argument: %s\n" , option->long_name,
+ option->char_name,
+ option->arg_description);
+ printf(" %s\n" , option->description);
+
+}
+
+void lttv_option_show_help(void)
+{
+ LttvOption option;
+
+ GPtrArray *list = g_ptr_array_new();
+
+ int i;
+
+ g_hash_table_foreach(options, list_options, list);
+
+ printf("Built-in commands available:\n");
+ printf("\n");
+
+ for(i = 0 ; i < list->len ; i++) {
+ show_help((LttvOption *)list->pdata[i]);
+ }
+ g_ptr_array_free(list, TRUE);
+
+
+}