sh: Reduce code duplication: use setinputfile instead of open/setinputfd

combination.

MFC after:	2 weeks
This commit is contained in:
Jilles Tjoelker 2012-09-14 15:22:15 +00:00
parent 86dcb2ee7f
commit d902a66b99
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=240505

View File

@ -266,14 +266,7 @@ read_profile(char *name)
void
readcmdfile(const char *name)
{
int fd;
INTOFF;
if ((fd = open(name, O_RDONLY)) >= 0)
setinputfd(fd, 1);
else
error("cannot open %s: %s", name, strerror(errno));
INTON;
setinputfile(name, 1);
cmdloop(0);
popfile();
}