Issue an error when . (dot) is invoked without a filename. The synopsis

is just ". file" according to POSIX, however many other shells allow
arguments to be passed after the file.  For compatibility (we even use that
feature in buildworld) additional arguments are not considered to be an
error, even though this shell does not do anything with the arguments at all.
This commit is contained in:
Stefan Farfeleder 2006-04-02 18:51:32 +00:00
parent 905330ab78
commit e5f1cf0838
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=157414

View File

@ -316,19 +316,21 @@ int
dotcmd(int argc, char **argv)
{
struct strlist *sp;
char *fullname;
if (argc < 2)
error("missing filename");
exitstatus = 0;
for (sp = cmdenviron; sp ; sp = sp->next)
setvareq(savestr(sp->text), VSTRFIXED|VTEXTFIXED);
if (argc >= 2) { /* That's what SVR2 does */
char *fullname = find_dot_file(argv[1]);
setinputfile(fullname, 1);
commandname = fullname;
cmdloop(0);
popfile();
}
fullname = find_dot_file(argv[1]);
setinputfile(fullname, 1);
commandname = fullname;
cmdloop(0);
popfile();
return exitstatus;
}