Lorenzo Bettini wrote:
I think the right behavior is to go back to optind = 1
Of course I'll document this fact (and also add an example of using more
parsers following the example you sent me).
by the way, I'd use this alternative split function (that detects
multiple spaces):
unsigned my_split_args(char *args, char ***argv_ptr)
{
char *p = args;
char **argv;
size_t n = 0, i, j;
while ((i = strcspn(p, " \t")) && (p += i)) {
p += strspn(p, " \t");
n++;
}
*argv_ptr = malloc((n + 1) * sizeof(char *));
argv = *argv_ptr;
i = 0;
p = args;
while (p) {
argv[i] = p;
j = strcspn(p, " \t");
if (j) {
p += strcspn(p, " \t");
*p = '\0';
p++;
p += strspn(p, " \t");
i++;
} else {
break;
}
}
argv[n] = NULL;
return n;
}
--
+-----------------------------------------------------+
| Lorenzo Bettini ICQ# lbetto, 16080134 |
| PhD in Computer Science |
| Dip. Sistemi e Informatica, Univ. di Firenze |
| Florence - Italy (GNU/Linux User # 158233) |
| Home Page : http://www.lorenzobettini.it |
| http://music.dsi.unifi.it XKlaim language |
| http://www.purplesucker.com Deep Purple Cover Band |
| http://www.gnu.org/software/src-highlite |
| http://www.gnu.org/software/gengetopt |
| http://www.lorenzobettini.it/software/gengen |
| http://www.lorenzobettini.it/software/doublecpp |
+-----------------------------------------------------+
_______________________________________________
Help-gengetopt mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gengetopt