From c10adcd728be238d8579bf98075a2468f0143cc2 Mon Sep 17 00:00:00 2001 From: nima Date: Tue, 1 Jul 2008 23:14:17 +0000 Subject: Brought main() back into the python module and fixed malloc/free problems. git-svn-id: svn://svn.autonomy.net.au/python-dmidecode@7 abc39116-655e-4be6-ad55-d661dc543056 --- dmiopt.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'dmiopt.c') diff --git a/dmiopt.c b/dmiopt.c index 1b583a6..05dae2c 100644 --- a/dmiopt.c +++ b/dmiopt.c @@ -78,7 +78,7 @@ static void print_opt_type_list(void) } } -static u8 *parse_opt_type(u8 *p, const char *arg) +u8 *parse_opt_type(u8 *p, const char *arg) { unsigned int i; @@ -229,7 +229,9 @@ int parse_command_line(int argc, char * const argv[]) { 0, 0, 0, 0 } }; - while((option=getopt_long(argc, argv, optstring, longopts, NULL))!=-1) + int i = 0; + while((option=getopt_long(argc, argv, optstring, longopts, NULL))!=-1) { + i++; switch(option) { case 'd': @@ -272,6 +274,9 @@ int parse_command_line(int argc, char * const argv[]) return -1; } + } + printf("%d: %s, %s, %s --> %d loops\n", argc, argv[0], argv[1], argv[2], i); + if(opt.type!=NULL && opt.string!=NULL) { fprintf(stderr, "Options --string and --type are mutually exclusive\n"); -- cgit