merge
This commit is contained in:
commit
468851cde6
|
@ -496,11 +496,20 @@ Plan 9 command.
|
||||||
Send the range to the standard input of the
|
Send the range to the standard input of the
|
||||||
Plan 9 command.
|
Plan 9 command.
|
||||||
.TP
|
.TP
|
||||||
|
.BI ^ " Plan 9-command
|
||||||
|
Send the standard output of the Plan 9 command
|
||||||
|
to the command window.
|
||||||
|
.TP
|
||||||
.BI | " Plan 9-command
|
.BI | " Plan 9-command
|
||||||
Send the range to the standard input, and replace it by
|
Send the range to the standard input, and replace it by
|
||||||
the standard output, of the
|
the standard output, of the
|
||||||
Plan 9 command.
|
Plan 9 command.
|
||||||
.TP
|
.TP
|
||||||
|
.BI _ " Plan 9-command
|
||||||
|
Send the range to the standard input, and send the
|
||||||
|
standard output of the Plan 9 command to the command
|
||||||
|
window.
|
||||||
|
.TP
|
||||||
.BI \*a! " Plan 9-command
|
.BI \*a! " Plan 9-command
|
||||||
Run the
|
Run the
|
||||||
Plan 9 command.
|
Plan 9 command.
|
||||||
|
@ -515,6 +524,8 @@ is used.
|
||||||
In any of
|
In any of
|
||||||
.BR < ,
|
.BR < ,
|
||||||
.BR > ,
|
.BR > ,
|
||||||
|
.BR ^ ,
|
||||||
|
.BR _ ,
|
||||||
.B |
|
.B |
|
||||||
or
|
or
|
||||||
.BR ! ,
|
.BR ! ,
|
||||||
|
|
|
@ -35,6 +35,8 @@ Cmdtab cmdtab[]={
|
||||||
'>', 0, 0, 0, 0, aDot, 0, linex, plan9_cmd,
|
'>', 0, 0, 0, 0, aDot, 0, linex, plan9_cmd,
|
||||||
'<', 0, 0, 0, 0, aDot, 0, linex, plan9_cmd,
|
'<', 0, 0, 0, 0, aDot, 0, linex, plan9_cmd,
|
||||||
'|', 0, 0, 0, 0, aDot, 0, linex, plan9_cmd,
|
'|', 0, 0, 0, 0, aDot, 0, linex, plan9_cmd,
|
||||||
|
'^', 0, 0, 0, 0, aDot, 0, linex, plan9_cmd,
|
||||||
|
'_', 0, 0, 0, 0, aDot, 0, linex, plan9_cmd,
|
||||||
'=', 0, 0, 0, 0, aDot, 0, linex, eq_cmd,
|
'=', 0, 0, 0, 0, aDot, 0, linex, eq_cmd,
|
||||||
'c'|0x100,0, 0, 0, 0, aNo, 0, wordx, cd_cmd,
|
'c'|0x100,0, 0, 0, 0, aNo, 0, wordx, cd_cmd,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
@ -76,7 +78,13 @@ inputc(void)
|
||||||
|
|
||||||
Again:
|
Again:
|
||||||
nbuf = 0;
|
nbuf = 0;
|
||||||
if(downloaded){
|
if(cmdbufpos > cmdbuf.nc && cmdbuf.nc > 0){
|
||||||
|
cmdbufpos = 0;
|
||||||
|
bufreset(&cmdbuf);
|
||||||
|
}
|
||||||
|
if(cmdbufpos < cmdbuf.nc && cmdbuf.nc > 0)
|
||||||
|
bufread(&cmdbuf, cmdbufpos++, &r, 1);
|
||||||
|
else if(downloaded){
|
||||||
while(termoutp == terminp){
|
while(termoutp == terminp){
|
||||||
cmdupdate();
|
cmdupdate();
|
||||||
if(patset)
|
if(patset)
|
||||||
|
|
|
@ -361,6 +361,8 @@ extern int quitok;
|
||||||
extern Address addr;
|
extern Address addr;
|
||||||
extern Buffer snarfbuf;
|
extern Buffer snarfbuf;
|
||||||
extern Buffer plan9buf;
|
extern Buffer plan9buf;
|
||||||
|
extern Buffer cmdbuf;
|
||||||
|
extern int cmdbufpos;
|
||||||
extern List file;
|
extern List file;
|
||||||
extern List tempfile;
|
extern List tempfile;
|
||||||
extern File *cmd;
|
extern File *cmd;
|
||||||
|
|
|
@ -7,6 +7,8 @@ char errfile[64];
|
||||||
String plan9cmd; /* null terminated */
|
String plan9cmd; /* null terminated */
|
||||||
Buffer plan9buf;
|
Buffer plan9buf;
|
||||||
void checkerrs(void);
|
void checkerrs(void);
|
||||||
|
Buffer cmdbuf;
|
||||||
|
int cmdbufpos;
|
||||||
|
|
||||||
int
|
int
|
||||||
plan9(File *f, int type, String *s, int nest)
|
plan9(File *f, int type, String *s, int nest)
|
||||||
|
@ -28,7 +30,7 @@ plan9(File *f, int type, String *s, int nest)
|
||||||
}
|
}
|
||||||
if(type!='!' && pipe(pipe1)==-1)
|
if(type!='!' && pipe(pipe1)==-1)
|
||||||
error(Epipe);
|
error(Epipe);
|
||||||
if(type=='|')
|
if(type=='|' || type=='_')
|
||||||
snarf(f, addr.r.p1, addr.r.p2, &plan9buf, 1);
|
snarf(f, addr.r.p1, addr.r.p2, &plan9buf, 1);
|
||||||
if((pid=fork()) == 0){
|
if((pid=fork()) == 0){
|
||||||
if(downloaded){ /* also put nasty fd's into errfile */
|
if(downloaded){ /* also put nasty fd's into errfile */
|
||||||
|
@ -48,14 +50,14 @@ plan9(File *f, int type, String *s, int nest)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(type != '!') {
|
if(type != '!') {
|
||||||
if(type=='<' || type=='|')
|
if(type == '>')
|
||||||
dup(pipe1[1], 1);
|
|
||||||
else if(type == '>')
|
|
||||||
dup(pipe1[0], 0);
|
dup(pipe1[0], 0);
|
||||||
|
else
|
||||||
|
dup(pipe1[1], 1);
|
||||||
close(pipe1[0]);
|
close(pipe1[0]);
|
||||||
close(pipe1[1]);
|
close(pipe1[1]);
|
||||||
}
|
}
|
||||||
if(type == '|'){
|
if(type == '|' || type == '_'){
|
||||||
if(pipe(pipe2) == -1)
|
if(pipe(pipe2) == -1)
|
||||||
exits("pipe");
|
exits("pipe");
|
||||||
if((pid = fork())==0){
|
if((pid = fork())==0){
|
||||||
|
@ -87,7 +89,7 @@ plan9(File *f, int type, String *s, int nest)
|
||||||
close(pipe2[0]);
|
close(pipe2[0]);
|
||||||
close(pipe2[1]);
|
close(pipe2[1]);
|
||||||
}
|
}
|
||||||
if(type=='<'){
|
if(type=='<' || type=='^'){
|
||||||
close(0); /* so it won't read from terminal */
|
close(0); /* so it won't read from terminal */
|
||||||
open("/dev/null", 0);
|
open("/dev/null", 0);
|
||||||
}
|
}
|
||||||
|
@ -115,9 +117,14 @@ plan9(File *f, int type, String *s, int nest)
|
||||||
writeio(f);
|
writeio(f);
|
||||||
bpipeok = 0;
|
bpipeok = 0;
|
||||||
closeio((Posn)-1);
|
closeio((Posn)-1);
|
||||||
|
}else if(type == '^' || type == '_'){
|
||||||
|
int nulls;
|
||||||
|
close(pipe1[1]);
|
||||||
|
bufload(&cmdbuf, cmdbufpos, pipe1[0], &nulls);
|
||||||
|
close(pipe1[0]);
|
||||||
}
|
}
|
||||||
retmsg = waitfor(pid);
|
retmsg = waitfor(pid);
|
||||||
if(type=='|' || type=='<')
|
if(type=='|' || type=='<' || type=='_' || type=='^')
|
||||||
if(retmsg[0]!=0)
|
if(retmsg[0]!=0)
|
||||||
warn_s(Wbadstatus, retmsg);
|
warn_s(Wbadstatus, retmsg);
|
||||||
if(downloaded)
|
if(downloaded)
|
||||||
|
|
Loading…
Reference in a new issue