sh: Reduce code duplication: use setinputfile instead of open/setinputfd
combination. MFC after: 2 weeks
This commit is contained in:
parent
86dcb2ee7f
commit
d902a66b99
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=240505
@ -266,14 +266,7 @@ read_profile(char *name)
|
|||||||
void
|
void
|
||||||
readcmdfile(const char *name)
|
readcmdfile(const char *name)
|
||||||
{
|
{
|
||||||
int fd;
|
setinputfile(name, 1);
|
||||||
|
|
||||||
INTOFF;
|
|
||||||
if ((fd = open(name, O_RDONLY)) >= 0)
|
|
||||||
setinputfd(fd, 1);
|
|
||||||
else
|
|
||||||
error("cannot open %s: %s", name, strerror(errno));
|
|
||||||
INTON;
|
|
||||||
cmdloop(0);
|
cmdloop(0);
|
||||||
popfile();
|
popfile();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user