Skip to content
Extraits de code Groupes Projets
Vérifiée Valider 767024dc rédigé par Kubat's avatar Kubat
Parcourir les fichiers

Fix the lkt command parsing, check the default command only if no match

was found
parent 7f5f529c
Aucune branche associée trouvée
Aucune étiquette associée trouvée
1 requête de fusion!58lkt update
......@@ -24,15 +24,6 @@ lkt_cmd_parse(struct lkt_cmd_opt *opts, int argc, const char **argv, void (*help
it = opts + (++offset);
}
/* The default function */
if (!it->name && it->call) {
struct lkt_cmd_args arguments = {
.argc = argc,
.argv = (const char **) argv,
};
it->call(&arguments);
}
/* Now search for a unique match */
if (count > 1)
goto not_exclusive;
......@@ -50,6 +41,15 @@ lkt_cmd_parse(struct lkt_cmd_opt *opts, int argc, const char **argv, void (*help
exit(EXIT_FAILURE);
not_found:
/* The default function */
if (!it->name && it->call) {
struct lkt_cmd_args arguments = {
.argc = argc,
.argv = (const char **) argv,
};
it->call(&arguments);
}
fprintf(stderr, "Command '%s' could not be found\n", argv[0]);
exit(EXIT_FAILURE);
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter