handle /dev/stdin always
This commit is contained in:
parent
0faf0f0baa
commit
134c20c605
2 changed files with 3 additions and 3 deletions
|
|
@ -459,8 +459,8 @@ int Creat(char *file)
|
||||||
int Dup(int a, int b){
|
int Dup(int a, int b){
|
||||||
return dup(a, b);
|
return dup(a, b);
|
||||||
}
|
}
|
||||||
int Dup1(int unused0){
|
int Dup1(int a){
|
||||||
return -1;
|
return dup(a, -1);
|
||||||
}
|
}
|
||||||
void Exit(char *stat)
|
void Exit(char *stat)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -316,11 +316,11 @@ void execdot(void){
|
||||||
strcpy(file, path->word);
|
strcpy(file, path->word);
|
||||||
if(file[0]) strcat(file, "/");
|
if(file[0]) strcat(file, "/");
|
||||||
strcat(file, zero);
|
strcat(file, zero);
|
||||||
if((fd=open(file, 0))>=0) break;
|
|
||||||
if(strcmp(file, "/dev/stdin")==0){ /* for sun & ucb */
|
if(strcmp(file, "/dev/stdin")==0){ /* for sun & ucb */
|
||||||
fd=Dup1(0);
|
fd=Dup1(0);
|
||||||
if(fd>=0) break;
|
if(fd>=0) break;
|
||||||
}
|
}
|
||||||
|
if((fd=open(file, 0))>=0) break;
|
||||||
}
|
}
|
||||||
if(fd<0){
|
if(fd<0){
|
||||||
pfmt(err, "%s: ", zero);
|
pfmt(err, "%s: ", zero);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue