projects
/
lttv.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Don't calculate statistic again if it is already done
[lttv.git]
/
ltt
/
branches
/
poly
/
lttv
/
option.c
diff --git
a/ltt/branches/poly/lttv/option.c
b/ltt/branches/poly/lttv/option.c
index 01237acb2e62b67446c8b8ecb582d456c9b8fd7f..590f9deff90b2f71745e4b412890a452263f9e59 100644
(file)
--- a/
ltt/branches/poly/lttv/option.c
+++ b/
ltt/branches/poly/lttv/option.c
@@
-3,6
+3,9
@@
#include <glib.h>
#include <lttv/option.h>
#include <glib.h>
#include <lttv/option.h>
+#define g_info(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, format)
+#define g_debug(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, format)
+
typedef struct _LttvOption {
char *long_name;
char char_name;
typedef struct _LttvOption {
char *long_name;
char char_name;
@@
-36,6
+39,7
@@
free_option(LttvOption *option)
void lttv_option_init(int argc, char **argv)
{
void lttv_option_init(int argc, char **argv)
{
+ g_info("Init option.c");
options = g_hash_table_new(g_str_hash, g_str_equal);
}
options = g_hash_table_new(g_str_hash, g_str_equal);
}
@@
-48,6
+52,7
@@
void lttv_option_destroy()
int i;
int i;
+ g_info("Destroy option.c");
g_hash_table_foreach(options, list_options, list);
g_hash_table_destroy(options);
g_hash_table_foreach(options, list_options, list);
g_hash_table_destroy(options);
@@
-65,6
+70,7
@@
void lttv_option_add(const char *long_name, const char char_name,
{
LttvOption *option;
{
LttvOption *option;
+ g_info("Add option %s", long_name);
if(g_hash_table_lookup(options, long_name) != NULL) {
g_warning("duplicate option");
return;
if(g_hash_table_lookup(options, long_name) != NULL) {
g_warning("duplicate option");
return;
@@
-88,6
+94,7
@@
lttv_option_remove(const char *long_name)
{
LttvOption *option = g_hash_table_lookup(options, long_name);
{
LttvOption *option = g_hash_table_lookup(options, long_name);
+ g_info("Remove option %s", long_name);
if(option == NULL) {
g_warning("trying to remove unknown option %s", long_name);
return;
if(option == NULL) {
g_warning("trying to remove unknown option %s", long_name);
return;
@@
-184,11
+191,17
@@
void lttv_option_parse(int argc, char **argv)
if(rc > 0) {
option = (LttvOption *)(list->pdata[rc - 1]);
if(rc > 0) {
option = (LttvOption *)(list->pdata[rc - 1]);
- if(option->hook != NULL) option->hook(option->hook_data);
+ g_info("Option %s encountered", option->long_name);
+ if(option->hook != NULL) {
+ g_info("Option %s hook called", option->long_name);
+ option->hook(option->hook_data);
+ }
i++;
}
else if(rc == POPT_ERROR_BADOPT && i != first_arg) {
i++;
}
else if(rc == POPT_ERROR_BADOPT && i != first_arg) {
+ g_info("Option %s not recognized, rescan options with new additions",
+ poptBadOption(c,0));
/* Perhaps this option is newly added, restart parsing */
/* Perhaps this option is newly added, restart parsing */
@@
-198,7
+211,11
@@
void lttv_option_parse(int argc, char **argv)
/* Get back to the same argument */
first_arg = i;
/* Get back to the same argument */
first_arg = i;
- for(i = 0; i < first_arg; i++) poptGetNextOpt(c);
+ for(i = 0; i < first_arg; i++) {
+ rc = poptGetNextOpt(c);
+ option = (LttvOption *)(list->pdata[rc - 1]);
+ g_info("Option %s rescanned, skipped", option->long_name);
+ }
}
else {
}
else {
@@
-244,3
+261,4
@@
void lttv_option_show_help(void)
}
}
+
This page took
0.023236 seconds
and
4
git commands to generate.