wecker@cookie.dec.com (DAVE TANSTAAFL WECKER) (12/08/86)
I found a need to invoke Matt's shell to execute a single command line and
then exit (I also found some REAL bizarreness in AmigaDOS (posted in a
separate note)) so that I could use his shell from MAKE files.
For example, I want to be able to access all of the SHELL built-in commands
without having to keep copies in c: (like copy, delete, rename ....).
Here is a fragment from one of my MAKE files:
foo : $(OBJS)
shell -c copy df0:lib/c.lib ram:
ln -v -o foo foo.o -lc
shell -c ram:c.lib
The new 'feature' is the addition of the '-c' switch with says take all
remaining arguments as a command line, execute it, and exit. You can even
invoke scripts before the -c:
shell .login -c echo test1 ; date ; echo test2
The patch was so easy, I figured it would be useful to post it directly.
Change the first 'for' loop in main.c (that scans for command line
source files) to be:
==============================altered code==============================
for (i = 1; i < argc; ++i) {
if (argv[i][0] == '-' && argv[i][1] == 'c') {
Inline[0] = ' ';
Inline[1] = '\000';
while (++i < argc) {
strcat(Inline,argv[i]);
strcat(Inline," ");
}
exec_command(Inline);
main_exit(0);
}
strcpy (Inline, "source ");
strcat (Inline, argv[i]);
av[1] = argv[i];
do_source (Inline);
}
=========================================================================
That's it... I've been using it all day and it seems to work like a charm.
dave {decwrl|decvax|decuac}!cookie.dec.com!wecker
(Arpa: wecker%cookie.dec.com@decwrl.dec.com)