FreeCalypso > hg > freecalypso-tools
comparison loadtools/clmain.c @ 204:064d4eedb3a6
loadtools: second program invokation support added to fc-iram like in fc-xram
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 01 May 2017 21:54:58 +0000 |
parents | e7502631a0f9 |
children | 8c011177adb9 |
comparison
equal
deleted
inserted
replaced
203:f2dde45ba378 | 204:064d4eedb3a6 |
---|---|
114 if (passon_argv) | 114 if (passon_argv) |
115 exec_2nd_prog(); | 115 exec_2nd_prog(); |
116 tty_passthru(); | 116 tty_passthru(); |
117 exit(0); | 117 exit(0); |
118 } | 118 } |
119 | |
120 exec_2nd_prog() | |
121 { | |
122 char **execp_argv; | |
123 char **sp, **dp; | |
124 extern int target_fd; | |
125 char desc_arg[16]; | |
126 | |
127 sprintf(desc_arg, "-d%d", target_fd); | |
128 execp_argv = (char **) malloc(sizeof(char *) * (passon_argc + 2)); | |
129 if (!execp_argv) { | |
130 perror("malloc argv for execvp"); | |
131 exit(1); | |
132 } | |
133 sp = passon_argv; | |
134 dp = execp_argv; | |
135 *dp++ = *sp++; | |
136 *dp++ = desc_arg; | |
137 while (*sp) | |
138 *dp++ = *sp++; | |
139 *dp = NULL; | |
140 execvp(execp_argv[0], execp_argv); | |
141 fprintf(stderr, "Unable to execvp %s\n", passon_argv[0]); | |
142 exit(1); | |
143 } |