comparison rvinterf/etmsync/dispatch.c @ 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 909f00c15f27
children 082d12a1651e
comparison
equal deleted inserted replaced
279:36ad667341fc 280:f304f9bcde3b
59 } 59 }
60 *ap = 0; 60 *ap = 0;
61 return tp->func(ap - argv, argv); 61 return tp->func(ap - argv, argv);
62 } 62 }
63 63
64 dispatch_ready_argv(argc, argv)
65 char **argv;
66 {
67 struct cmdtab *tp;
68
69 for (tp = cmdtab; tp->cmd; tp++)
70 if (!strcmp(tp->cmd, argv[0]))
71 break;
72 if (!tp->func) {
73 fprintf(stderr, "error: no such command\n");
74 return(ERROR_USAGE);
75 }
76 if (argc - 1 >= tp->maxargs) {
77 fprintf(stderr, "error: too many arguments\n");
78 return(ERROR_USAGE);
79 }
80 if (argc - 1 < tp->minargs) {
81 fprintf(stderr, "error: too few arguments\n");
82 return(ERROR_USAGE);
83 }
84 return tp->func(argc, argv);
85 }
86
64 cmd_exec(argc, argv) 87 cmd_exec(argc, argv)
65 char **argv; 88 char **argv;
66 { 89 {
67 FILE *f; 90 FILE *f;
68 char linebuf[512], *cp; 91 char linebuf[512], *cp;