summaryrefslogtreecommitdiffstats
path: root/dmiopt.c
diff options
context:
space:
mode:
authornima <nima@abc39116-655e-4be6-ad55-d661dc543056>2008-07-01 23:14:17 +0000
committernima <nima@abc39116-655e-4be6-ad55-d661dc543056>2008-07-01 23:14:17 +0000
commitc10adcd728be238d8579bf98075a2468f0143cc2 (patch)
tree4fa1bce13ff08de36ff95023af9356fa29c4c5bd /dmiopt.c
parenta7a5cb531b86a75265f106b91d7033e45d754612 (diff)
downloadpython-dmidecode-c10adcd728be238d8579bf98075a2468f0143cc2.tar.gz
python-dmidecode-c10adcd728be238d8579bf98075a2468f0143cc2.tar.xz
python-dmidecode-c10adcd728be238d8579bf98075a2468f0143cc2.zip
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
Diffstat (limited to 'dmiopt.c')
-rw-r--r--dmiopt.c9
1 files changed, 7 insertions, 2 deletions
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");