aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/mk
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2005-01-13 04:49:19 +0000
committerrsc <devnull@localhost>2005-01-13 04:49:19 +0000
commitc8b6342d3c2a167dec16931815926e9e4387e7ef (patch)
tree80d3ec6ea074462b30639168113def880476dad6 /src/cmd/mk
parent741f510ce758f77ed5193256fb693a09a7daecce (diff)
downloadplan9port-c8b6342d3c2a167dec16931815926e9e4387e7ef.tar.gz
plan9port-c8b6342d3c2a167dec16931815926e9e4387e7ef.tar.bz2
plan9port-c8b6342d3c2a167dec16931815926e9e4387e7ef.zip
Many small edits.
Diffstat (limited to 'src/cmd/mk')
-rw-r--r--src/cmd/mk/mkfile.test4
-rw-r--r--src/cmd/mk/parse.c37
-rw-r--r--src/cmd/mk/shell.c2
3 files changed, 20 insertions, 23 deletions
diff --git a/src/cmd/mk/mkfile.test b/src/cmd/mk/mkfile.test
index b5bd6dbb..8a4e4b96 100644
--- a/src/cmd/mk/mkfile.test
+++ b/src/cmd/mk/mkfile.test
@@ -1,9 +1,9 @@
-|$PLAN9/bin/rc
+MKSHELL=$PLAN9/bin/rc
use-rc:V:
for(i in a b c)
echo $i
-|/bin/sh
+MKSHELL=/bin/sh
use-sh:V:
for i in a b c
do
diff --git a/src/cmd/mk/parse.c b/src/cmd/mk/parse.c
index 2d1816b9..48bad3d8 100644
--- a/src/cmd/mk/parse.c
+++ b/src/cmd/mk/parse.c
@@ -91,18 +91,18 @@ cp = wtos(tail, ' '); print("assign %s to %s\n", head->s, cp); free(cp);
*/
setvar(head->s, (void *) tail);
symlook(head->s, S_WESET, (void *)"");
+ if(strcmp(head->s, "MKSHELL") == 0){
+ if((err = setshell(tail)) != nil){
+ SYNERR(hline);
+ fprint(2, "%s\n", err);
+ Exit();
+ break;
+ }
+ }
}
if(attr)
symlook(head->s, S_NOEXPORT, (void *)"");
break;
- case 'S':
- if((err = setshell(tail)) != nil){
- SYNERR(hline);
- fprint(2, "%s\n", err);
- Exit();
- break;
- }
- break;
default:
SYNERR(hline);
fprint(2, "expected one of :<=\n");
@@ -144,19 +144,14 @@ rhead(char *line, Word **h, Word **t, int *attr, char **prog)
int n;
Word *w;
- if(*line == '|'){
- sep = 'S'; /* shell */
- p = line+1;
- }else{
- p = shellt->charin(line,":=<");
- if(p == 0)
- return('?');
- sep = *p;
- *p++ = 0;
- if(sep == '<' && *p == '|'){
- sep = '|';
- p++;
- }
+ p = shellt->charin(line,":=<");
+ if(p == 0)
+ return('?');
+ sep = *p;
+ *p++ = 0;
+ if(sep == '<' && *p == '|'){
+ sep = '|';
+ p++;
}
*attr = 0;
*prog = 0;
diff --git a/src/cmd/mk/shell.c b/src/cmd/mk/shell.c
index a4ac3f93..dd41ad12 100644
--- a/src/cmd/mk/shell.c
+++ b/src/cmd/mk/shell.c
@@ -41,6 +41,7 @@ initshell(void)
{
shellcmd = stow(shells[0]->name);
shellt = shells[0];
+ setvar("MKSHELL", shellcmd);
}
void
@@ -72,5 +73,6 @@ popshell(void)
shellstack = s->next;
shellt = s->t;
shellcmd = s->w;
+ setvar("MKSHELL", shellcmd);
free(s);
}