Home | History | Annotate | only in /src/bin/mkdir
History log of /src/bin/mkdir
RevisionDateAuthorComments
 1.8 20-Jul-1997  christos branches: 1.8.112;
Remove WARNS=1 from all the subdirectory Makefiles, and add it to Makefile.inc
now that all /bin has been cleaned.
 1.7 20-Jul-1997  christos Fix compiler warnings
Add WARNS=1
 1.6 21-Mar-1995  cgd clean up slightly; id tags, alphabetization, prototypes, etc.
 1.5 22-Sep-1994  mycroft Merge 4.4-Lite version.
 1.4 01-Aug-1993  mycroft Add RCS identifiers.
 1.3 23-Mar-1993  cgd changed "Id" to "Header" for rcsids
 1.2 22-Mar-1993  cgd added rcs ids to all files
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2 22-Sep-1994  mycroft Import original 4.4-Lite version.
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.8.112.2 21-Apr-2020  martin Ooops, restore accidently removed files from merge mishap
 1.8.112.1 21-Apr-2020  martin Sync with HEAD
 1.21 04-Jul-2017  wiz branches: 1.21.6;
Use Ex. Remove superfluous Pp.
 1.20 03-Jul-2017  wiz Remove workaround for ancient HTML generation code.
 1.19 10-Aug-2016  sevan Grammar
 1.18 10-Aug-2016  sevan Document the version mkdir first appeared.
 1.17 22-Mar-2012  wiz Fix whitespace nits. Suggested by Bug Hunting.
 1.16 07-Aug-2003  agc branches: 1.16.54;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22249, verified by myself.
 1.15 25-Sep-2002  wiz New policy: New sentences start on a new line.
Patches by Robert Elz <kre at munnari oz au>, with minimal changes by me.
 1.14 08-Feb-2002  ross Generate <>& symbolically. I'm avoiding .../dist/... directories for now.
 1.13 07-Oct-2000  abs xref mkdir(2)
 1.12 04-Sep-2000  kleink For commands and utilities, use EXIT STATUS rather than RETURN VALUES as
appropriate (and documented in mdoc(7)).
 1.11 28-Aug-2000  hubertf Add 'RETURN VALUE' section header.
 1.10 20-Oct-1997  enami branches: 1.10.12;
Fix .Nm usage.
 1.9 25-Jul-1995  jtc Use "utility" instead of "command". Modern definitions of these terms
are distinct (See POSIX.2 glossary).

A utility is a executable, script or shell builtin; while a command
can be any of those things plus lists, pipelines, compound commands
(if, for, while) and shell function definitions.
 1.8 25-Jun-1995  mycroft Don't complain if a directory already exists. From Greg Hudson, but
slightly edited.
 1.7 21-Mar-1995  cgd clean up slightly; id tags, alphabetization, prototypes, etc.
 1.6 22-Sep-1994  mycroft Merge 4.4-Lite version.
 1.5 01-Aug-1993  mycroft Add RCS indentifiers.
 1.4 20-Jul-1993  jtc Make Posix 1003.2 (D11.2) compliant by adding -m (mode) option.
 1.3 23-Mar-1993  cgd changed "Id" to "Header" for rcsids
 1.2 22-Mar-1993  cgd added rcs ids to all files
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2 22-Sep-1994  mycroft Import original 4.4-Lite version.
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.10.12.2 08-Oct-2000  abs Pullup basesrc/bin/mkdir/mkdir.1 1.13 - xref mkdir(2)
approved by jhawk
 1.10.12.1 28-Aug-2000  hubertf Pull up to netbsd-1-5 branch, OK'd by thorpej:

Log Message:
> Add 'RETURN VALUE' section header.

Files & Revisionis:
> cvs rdiff -r1.19 -r1.20 basesrc/bin/cat/cat.1
> cvs rdiff -r1.12 -r1.13 basesrc/bin/chmod/chmod.1
> cvs rdiff -r1.14 -r1.15 basesrc/bin/cp/cp.1
> cvs rdiff -r1.8 -r1.9 basesrc/bin/dd/dd.1
> cvs rdiff -r1.9 -r1.10 basesrc/bin/echo/echo.1
> cvs rdiff -r1.11 -r1.12 basesrc/bin/expr/expr.1
> cvs rdiff -r1.25 -r1.26 basesrc/bin/ls/ls.1
> cvs rdiff -r1.10 -r1.11 basesrc/bin/mkdir/mkdir.1
> cvs rdiff -r1.23 -r1.24 basesrc/bin/mt/mt.1
> cvs rdiff -r1.12 -r1.13 basesrc/bin/mv/mv.1
> cvs rdiff -r1.16 -r1.17 basesrc/bin/pwd/pwd.1
> cvs rdiff -r1.9 -r1.10 basesrc/bin/rm/rm.1
> cvs rdiff -r1.11 -r1.12 basesrc/bin/rmdir/rmdir.1
> cvs rdiff -r1.35 -r1.36 basesrc/bin/sh/sh.1
> cvs rdiff -r1.11 -r1.12 basesrc/bin/sleep/sleep.1
> cvs rdiff -r1.20 -r1.21 basesrc/bin/stty/stty.1
 1.16.54.1 17-Apr-2012  yamt sync with head
 1.21.6.2 21-Apr-2020  martin Ooops, restore accidently removed files from merge mishap
 1.21.6.1 21-Apr-2020  martin Sync with HEAD
 1.39 13-Sep-2021  kre PR bin/56398

The final component of both a/b/c and a/b/c/ is "c", so that's the one
to which the -m arg applies.
 1.38 29-Aug-2011  joerg branches: 1.38.36; 1.38.44; 1.38.46;
static + __dead
 1.37 20-Jul-2008  lukem Remove the \n and tabs from the __COPYRIGHT() strings.
 1.36 01-Oct-2005  christos branches: 1.36.20;
Fix setmode error handling.
 1.35 04-Jan-2004  jschauma remove unused code left from printescaped() backput as pointed out by Jeff
Ito in PR bin/23969 and PR bin/23970.
 1.34 14-Sep-2003  jschauma Following private discussion with kleink@ and hubertf@ and public discussion
on tech-userlevel@, back out printescaped() functionality.
kleink: ``We sell rope.''
 1.33 11-Sep-2003  christos Comment out unneeded code now that the kernel has been fixed to ignore
trailing slashes.
 1.32 13-Aug-2003  itojun use bounded string op
 1.31 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22249, verified by myself.
 1.30 04-Aug-2003  jschauma As discusses a little while back on tech-userlevel:

If stdout is a tty, use vis(3) to print any filenames to prevent garbage
from being printed if the filename contains control- or other non-printable
characters.

While here, sprinkle some EXIT_FAILURE and NOTREACHED where appropriate.
 1.29 10-Mar-2003  lukem Fix typo in mkpath()'s test before chmod().
Noted in [bin/20652] by Anthony Mallet.
 1.28 05-Mar-2003  lukem Rework -p support again;
- If mkdir() fails on a component (no matter what the error is),
stat() the result. If the stat() fails, print the error mkdir() generated.
Otherwise, if the result is not a directory, explicitly fail with ENOTDIR.
- Move the chmod() of last element to be done only if the mkdir() succeeded
(i.e, it wasn't an existing directory)

Fixes problem introduced in previous commit where "mkdir -p existing"
on a read-only file system would incorrectly return a non zero exit code,
whilst retaining the race-condition fix of the previous commit.

Thanks to simonb@ for sanity checking my fix versus the standards.
 1.27 24-Nov-2002  chs in mkpath(), don't try to stat() the to-be-created directory beforehand,
just try to create it and interpret any error appropriately.
this fixes a problem where multiple "mkdir -p" processes can race,
with the loser returning a spurious error.
 1.26 19-Feb-2002  enami Cosmetic changes.
 1.25 16-Sep-2001  wiz ANSIfy, KNF, use [gs]etprogname. By Petri Koistinen.
 1.24 10-Oct-2000  enami - The type of return value of setmode is a void * and getmode takes it,
rather than mode_t *.
- Free the storage allocated by setmode unless it is obvious that program
exits immediately.
 1.23 26-May-1999  kleink Change previous to use symbolic names for file modes. Also, clean up some
whitespace lossage and use EXIT_{SUCCESS,FAILURE}.
 1.22 25-May-1999  tron Only call chmod(2) if we create a directory with a mode which isn't
accepted by mkdir(2).
 1.21 13-Oct-1998  scw Insert a missing 'else' which caused mknod(2) to still be called
even if mkdir(2) failed. At best this caused two (different)
error messages to be printed. At worst, it changed the mode of
an existing file/directory.
 1.20 08-Oct-1998  wsanchez umask()/mkdir() system calls will not set the setuid bit; the kernel intentionally
discards the high bits, so "mkdir -m 1777 foo" won't set the sticky bit. So call
chmod() on the directory.
 1.19 28-Jul-1998  mycroft Delint.
 1.18 05-Nov-1997  cgd lint
 1.17 20-Jul-1997  christos Fix compiler warnings
Add WARNS=1
 1.16 09-Jan-1997  tls kill use of register
 1.15 12-Aug-1996  explorer Fix mkdir -p to not ignore terminal directory mode specified.
Closes pr bin/2686.
 1.14 25-Jun-1995  mycroft Style and format police.
 1.13 25-Jun-1995  mycroft Don't complain if a directory already exists. From Greg Hudson, but
slightly edited.
 1.12 21-Mar-1995  cgd clean up slightly; id tags, alphabetization, prototypes, etc.
 1.11 01-Mar-1995  jtc Revert to code before it was merged with 4.4lite.
Updated to conform to new NetBSD RCS ID conventions.
 1.10 22-Sep-1994  mycroft Merge 4.4-Lite version.
 1.9 29-Apr-1994  jtc Strip trailing slashes, to make "mkdir -p" work as specified by POSIX.2.
 1.8 28-Apr-1994  jtc simplify recursive directory create (mkdir -p) code
 1.7 31-Dec-1993  jtc Localization changes.
Updated to use standard error message routines.
 1.6 13-Oct-1993  jtc #include <unistd.h>, so getopt(), optarg, opterr, optind, and optopt
declarations can be removed from <stdlib.h>.
 1.5 01-Aug-1993  mycroft Add RCS identifiers.
 1.4 20-Jul-1993  jtc Make Posix 1003.2 (D11.2) compliant by adding -m (mode) option.
 1.3 23-Mar-1993  cgd changed "Id" to "Header" for rcsids
 1.2 22-Mar-1993  cgd added rcs ids to all files
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2 22-Sep-1994  mycroft Import original 4.4-Lite version.
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.36.20.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.38.46.1 23-Sep-2021  martin Pull up following revision(s) (requested by kre in ticket #1347):

bin/mkdir/mkdir.c: revision 1.39

PR bin/56398

The final component of both a/b/c and a/b/c/ is "c", so that's the one
to which the -m arg applies.
 1.38.44.2 21-Apr-2020  martin Ooops, restore accidently removed files from merge mishap
 1.38.44.1 21-Apr-2020  martin Sync with HEAD
 1.38.36.1 23-Sep-2021  martin Pull up following revision(s) (requested by kre in ticket #1697):

bin/mkdir/mkdir.c: revision 1.39

PR bin/56398

The final component of both a/b/c and a/b/c/ is "c", so that's the one
to which the -m arg applies.

RSS XML Feed