changeset 44:57e0c7a50b2d

Skip option itself, before passing down to handler. Fixes -Ifoo to not search in directory "Ifoo".
author Joerg Sonnenberger <joerg@bec.de>
date Sun, 31 Mar 2013 04:20:44 +0200
parents f185d1ac4db4
children f263adbf7445
files main.c
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/main.c	Sun Mar 31 04:17:51 2013 +0200
+++ b/main.c	Sun Mar 31 04:20:44 2013 +0200
@@ -824,14 +824,14 @@
 bool
 check_prefix_option(const struct place *p, char *opt)
 {
-	unsigned i;
+	unsigned i, len;
 	int r;
 
 	for (i=0; i<num_prefix_options; i++) {
-		r = strncmp(opt, prefix_options[i].string,
-			    strlen(prefix_options[i].string));
+		len = strlen(prefix_options[i].string);
+		r = strncmp(opt, prefix_options[i].string, len);
 		if (r == 0) {
-			prefix_options[i].func(p, opt);
+			prefix_options[i].func(p, opt + len);
 			return true;
 		}
 		if (r < 0) {