[Ltrace-devel] [PATCH 01/11] Keep a count of the number of -x options passed on the command line.

Joe Damato ice799 at gmail.com
Mon Nov 8 23:47:34 UTC 2010


---
 options.c |    3 +++
 options.h |    2 ++
 2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/options.c b/options.c
index 54f7338..d3e62a0 100644
--- a/options.c
+++ b/options.c
@@ -53,6 +53,7 @@ int opt_e_enable = 1;
 
 /* List of global function names given to -x: */
 struct opt_x_t *opt_x = NULL;
+unsigned int opt_x_cnt = 0;
 
 /* List of filenames give to option -F: */
 struct opt_F_t *opt_F = NULL;	/* alternate configuration file(s) */
@@ -409,9 +410,11 @@ process_options(int argc, char **argv) {
 					perror("ltrace: malloc");
 					exit(1);
 				}
+				opt_x_cnt++;
 				p->name = optarg;
 				p->found = 0;
 				p->next = opt_x;
+				p->hash = ~(0UL);
 				opt_x = p;
 				break;
 			}
diff --git a/options.h b/options.h
index d171c4b..9079cbf 100644
--- a/options.h
+++ b/options.h
@@ -45,6 +45,7 @@ struct opt_F_t {
 struct opt_x_t {
 	char *name;
 	int found;
+	unsigned long hash;
 	struct opt_x_t *next;
 };
 
@@ -56,5 +57,6 @@ extern int opt_e_enable;	/* 0 if '!' is used, 1 otherwise */
 extern struct opt_F_t *opt_F;	/* alternate configuration file(s) */
 
 extern struct opt_x_t *opt_x;	/* list of functions to break at */
+extern unsigned int opt_x_cnt;
 
 extern char **process_options(int argc, char **argv);
-- 
1.7.0.4




More information about the Ltrace-devel mailing list