Off by default, build behaves normally.
WITH_META_MODE we get auto objdir creation, the ability to
start build from anywhere in the tree.
Still need to add real targets under targets/ to build packages.
Differential Revision: D2796
Reviewed by: brooks imp
For these simple utilities, it doesn't harm to make all global variables
static. In fact, this allows the compiler to perform better forms of
optimisation and analysis.
call returns `EISDIR', not `EEXIST', so that be prepared for that. This should
fix number of ports, that often call `mkdir -p //usr/local/foobar'. This
is just a quick workaround, the real fix would be either to avoid calling
mkdir("/", ...) or fix VFS code to return consistent errno for this case.
o Old-style K&R declarations have been converted to new C89 style
o register has been removed
o prototype for main() has been removed (gcc3 makes it an error)
o int main(int argc, char *argv[]) is the preferred main definition.
o Attempt to not break style(9) conformance for declarations more than
they already are.
This makes "mkdir /nonexistant/foo" complain that /nonexistant
doesn't exist rather than /nonexistant/foo which doesn't make much
sense.
Submitted (in a different form) by: W.H.Scholten <whs@xs4all.nl>
1) Fix mkdir -p to exit with the proper exit status and issue an error
message if it was unable to create all of the specified directories
and they did not previously exist. POSIX says:
The mkdir utility shall exit with one of the following values:
0 All the specified directories were created successfully or the
-p option was specified and all the specified directories now
exist.
E.g.
% mkdir -p /var/mkdir
mkdir: /var/mkdir: Permission denied
% touch /tmp/file
% mkdir -p /tmp/file/dir
mkdir: /tmp/file: Not a directory
Previously the above examples would exit with a zero exit status
and no error message. Something like the following run as a
normal user will still not produce an error:
% id
uid=629(mpp) gid=629(mpp)....
% mkdir -p /usr/local/etc
% ls -ld /usr/local/etc
drwxr-xr-x 4 bin bin 512 Dec 26 14:55 /usr/local/etc/
2) Cleaned up the mode handling to be more efficient when multiple
directories are being created.
3) Fixed a problem where directories could be created with the wrong mode
if the the -p option was specified and the build() routine returned
and error. It would leave the umask set incorrectly at this point.
4) Removed an unused variable.
Closes PR# 2304.