comparison main.c @ 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 dc63e70e425d
comparison
equal deleted inserted replaced
43:f185d1ac4db4 44:57e0c7a50b2d
822 822
823 static 823 static
824 bool 824 bool
825 check_prefix_option(const struct place *p, char *opt) 825 check_prefix_option(const struct place *p, char *opt)
826 { 826 {
827 unsigned i; 827 unsigned i, len;
828 int r; 828 int r;
829 829
830 for (i=0; i<num_prefix_options; i++) { 830 for (i=0; i<num_prefix_options; i++) {
831 r = strncmp(opt, prefix_options[i].string, 831 len = strlen(prefix_options[i].string);
832 strlen(prefix_options[i].string)); 832 r = strncmp(opt, prefix_options[i].string, len);
833 if (r == 0) { 833 if (r == 0) {
834 prefix_options[i].func(p, opt); 834 prefix_options[i].func(p, opt + len);
835 return true; 835 return true;
836 } 836 }
837 if (r < 0) { 837 if (r < 0) {
838 break; 838 break;
839 } 839 }