Browse code

fix bb#254

git-svn: trunk@2714

Tomasz Kojm authored on 2007/02/13 04:11:40
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Mon Feb 12 20:10:23 CET 2007 (tk)
2
+---------------------------------
3
+  * shared/options.c: fix bb#254
4
+
1 5
 Mon Feb 12 19:37:25 CET 2007 (tk)
2 6
 ---------------------------------
3 7
   * docs: various updates and fixes
... ...
@@ -1,5 +1,5 @@
1 1
 /*
2
- *  Copyright (C) 2001 - 2006 Tomasz Kojm <tkojm@clamav.net>
2
+ *  Copyright (C) 2001 - 2007 Tomasz Kojm <tkojm@clamav.net>
3 3
  *
4 4
  *  This program is free software; you can redistribute it and/or modify
5 5
  *  it under the terms of the GNU General Public License as published by
... ...
@@ -61,7 +61,11 @@ static int register_option(struct optstruct *opt, const char *optlong, char opts
61 61
 		found = 1;
62 62
 
63 63
 	if(!found) {
64
-	    mprintf("WARNING: Ignoring option --%s\n", optlong);
64
+	    if(optshort)
65
+		mprintf("WARNING: Ignoring option --%s (-%c)\n", longname, optshort);
66
+	    else
67
+		mprintf("WARNING: Ignoring option --%s\n", longname);
68
+
65 69
 	    return 0;
66 70
 	}
67 71
     }
... ...
@@ -158,7 +162,7 @@ struct optstruct *opt_parse(int argc, char * const *argv, const char *getopt_sho
158 158
 		    else
159 159
 			longname = NULL;
160 160
 
161
-		    if(register_option(opt, options_long[opt_index].name, ret, options_long, accepted_long) == -1) {
161
+		    if(register_option(opt, longname, ret, options_long, accepted_long) == -1) {
162 162
 			opt_free(opt);
163 163
 			return NULL;
164 164
 		    }