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:
parent
905330ab78
commit
e5f1cf0838
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user