FreeCalypso > hg > freecalypso-sw
changeset 280:f304f9bcde3b
fc-fsio: single command invokation implemented
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Mon, 24 Feb 2014 07:42:40 +0000 |
parents | 36ad667341fc |
children | 082d12a1651e |
files | rvinterf/etmsync/dispatch.c rvinterf/etmsync/fsiomain.c |
diffstat | 2 files changed, 25 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/rvinterf/etmsync/dispatch.c Mon Feb 24 07:27:37 2014 +0000 +++ b/rvinterf/etmsync/dispatch.c Mon Feb 24 07:42:40 2014 +0000 @@ -61,6 +61,29 @@ return tp->func(ap - argv, argv); } +dispatch_ready_argv(argc, argv) + char **argv; +{ + struct cmdtab *tp; + + for (tp = cmdtab; tp->cmd; tp++) + if (!strcmp(tp->cmd, argv[0])) + break; + if (!tp->func) { + fprintf(stderr, "error: no such command\n"); + return(ERROR_USAGE); + } + if (argc - 1 >= tp->maxargs) { + fprintf(stderr, "error: too many arguments\n"); + return(ERROR_USAGE); + } + if (argc - 1 < tp->minargs) { + fprintf(stderr, "error: too few arguments\n"); + return(ERROR_USAGE); + } + return tp->func(argc, argv); +} + cmd_exec(argc, argv) char **argv; {