handle /dev/stdin always

This commit is contained in:
rsc 2005-02-13 21:38:32 +00:00
parent 0faf0f0baa
commit 134c20c605
2 changed files with 3 additions and 3 deletions

View file

@ -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)
{ {

View file

@ -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);