Lines Matching defs:sh

92 	"name=sh path='" PATH_DEFSHELLDIR "/sh' "
139 ShellFree(struct Shell *sh)
142 if (sh != NULL) {
143 free(sh->name);
144 free(sh->path);
145 free(sh->echoOff);
146 free(sh->echoOn);
147 free(sh->noPrint);
148 free(sh->errCheck);
149 free(sh->ignErr);
150 free(sh->echo);
151 free(sh->exit);
152 ArgArray_Done(&sh->builtins);
153 free(sh->meta);
154 free(sh);
162 ShellDump(const struct Shell *sh)
166 fprintf(stderr, "Shell %p:\n", sh);
167 fprintf(stderr, " name='%s' path='%s'\n", sh->name, sh->path);
169 sh->hasEchoCtl, sh->echoOff, sh->echoOn);
170 fprintf(stderr, " noPrint='%s'\n", sh->noPrint);
172 sh->hasErrCtl, sh->errCheck, sh->ignErr);
173 fprintf(stderr, " echo='%s' exit='%s'\n", sh->echo, sh->exit);
174 fprintf(stderr, " builtins=%d\n", sh->builtins.argc - 1);
175 for (i = 1; i < sh->builtins.argc; i++)
176 fprintf(stderr, " '%s'", sh->builtins.argv[i]);
177 fprintf(stderr, "\n meta='%s'\n", sh->meta);
178 fprintf(stderr, " unsetenv=%d\n", sh->unsetenv);
189 struct Shell *sh;
196 sh = emalloc(sizeof(*sh));
197 memset(sh, 0, sizeof(*sh));
198 ArgArray_Init(&sh->builtins);
214 ShellFree(sh);
220 free(sh->path);
221 sh->path = estrdup(eq);
223 free(sh->name);
224 sh->name = estrdup(eq);
226 free(sh->echoOff);
227 sh->echoOff = estrdup(eq);
230 free(sh->echoOn);
231 sh->echoOn = estrdup(eq);
234 free(sh->noPrint);
235 sh->noPrint = estrdup(eq);
238 free(sh->echo);
239 sh->echo = estrdup(eq);
242 free(sh->exit);
243 sh->exit = estrdup(eq);
246 sh->hasErrCtl = (*eq == 'Y' || *eq == 'y' ||
250 free(sh->errCheck);
251 sh->errCheck = estrdup(eq);
254 free(sh->ignErr);
255 sh->ignErr = estrdup(eq);
258 ArgArray_Done(&sh->builtins);
259 brk_string(&sh->builtins, eq, TRUE);
260 qsort(sh->builtins.argv + 1, sh->builtins.argc - 1,
264 free(sh->meta);
265 sh->meta = estrdup(eq);
268 sh->unsetenv = (*eq == 'Y' || *eq == 'y' ||
275 ShellFree(sh);
285 if ((sh->echoOn != NULL) ^ (sh->echoOff != NULL)) {
288 ShellFree(sh);
292 if (sh->echoOn != NULL && sh->echoOff != NULL)
293 sh->hasEchoCtl = TRUE;
296 return (sh);
309 struct Shell *sh;
313 sh = ShellParseSpec(shells_init[i], &fullSpec);
314 TAILQ_INSERT_TAIL(&shells, sh, link);
315 if (strcmp(sh->name, DEFSHELLNAME) == 0)
316 commandShell = sh;
331 struct Shell *sh;
333 TAILQ_FOREACH(sh, &shells, link)
334 if (strcmp(sh->name, name) == 0)
335 return (sh);
392 struct Shell *sh;
396 if ((sh = ShellParseSpec(line, &fullSpec)) == NULL)
399 if (sh->path == NULL) {
405 if (sh->name == NULL) {
408 ShellFree(sh);
413 * XXX May want to merge sh into match. But this
418 ShellFree(sh);
421 if ((match = ShellMatch(sh->name)) == NULL) {
423 sh->name);
424 ShellFree(sh);
427 ShellFree(sh);
440 if (sh->name == NULL) {
442 if ((sh->name = strrchr(sh->path, '/')) == NULL) {
443 sh->name = estrdup(sh->path);
445 sh->name = estrdup(sh->name + 1);
450 if ((match = ShellMatch(sh->name)) == NULL) {
452 "%s: no matching shell", sh->name);
453 ShellFree(sh);
459 match->path = sh->path;
460 sh->path = NULL;
462 ShellFree(sh);
467 TAILQ_INSERT_HEAD(&shells, sh, link);
470 commandShell = sh;