History log of /openbsd-current/usr.sbin/mtree/mtree.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.28 04-Dec-2022 cheloha

userspace: remove vestigial '?' cases from top-level getopt(3) loops

getopt(3) returns '?' when it encounters a flag not present in the in
the optstring or if a flag is missing its option argument. We can
handle this case with the "default" failure case with no loss of
legibility. Hence, remove all the redundant "case '?':" lines.

Prompted by dlg@. With help from dlg@ and millert@.

Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2

ok naddy@ millert@ dlg@


Revision tags: OPENBSD_7_1_BASE OPENBSD_7_2_BASE
# 1.27 15-Nov-2021 millert

No need to declare optind, optarg or opterr; unistd.h does this for us.
From Jan Stary. OK deraadt@


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE OPENBSD_7_0_BASE
# 1.26 16-Sep-2018 millert

Add missing includes for setpassent() and setgroupent().


# 1.25 16-Sep-2018 millert

Use user_from_uid(3), group_from_gid(3), uid_from_user(3) and
gid_from_group(3) to avoid repeatedly looking up the same user/group.
Also keep the passwd and group files open to avoid opening and
closing them all the time. OK tb@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.24 20-Dec-2015 benno

need to include err.h for err().
ok deraadt@


# 1.23 19-Dec-2015 tb

Add pledge(2). It is not currently possible to pledge -u and -U
because of chown(2) and chmod(2).

If -u and -U aren't specified, the basic pledge is "stdio rpath getpw".
"getpw" is used to resolve uid and gid to names and vice versa.
The -r flag makes use of rmdir(2) and unlink(2), so we need "cpath"
The -t flag uses utimes(2), so we need "fattr"

ok deraadt@


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.22 16-Jan-2015 deraadt

Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible. Annotate <sys/param.h> lines with their current reasons. Switch
to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change
MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where
sensible to avoid pulling in the pollution. These are the files confirmed
through binary verification.
ok guenther, millert, doug (helped with the verification protocol)


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.21 27-Nov-2013 okan

remove erroneous char cast to switch expression processing getopt(3);
not used in any cases.

ok deraadt@, guenther@, millert@


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE
# 1.20 27-Oct-2009 deraadt

rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
unmaintainable). these days, people use source. these id's do not provide
any benefit, and do hurt the small install media
(the 33,000 line diff is essentially mechanical)
ok with the idea millert, ok dms


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.19 17-May-2008 sobrado

documentation tweaks.

ok (some time ago) jmc@


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE
# 1.18 26-Jul-2003 millert

Add missing "break" in -s case and make usage() explicitly take void.
From Andrey Matveev.


# 1.17 26-Jun-2003 deraadt

strict proto cleanups


# 1.16 16-Jun-2003 millert

Bitwise AND was used where logical AND was intended; from mpech@


# 1.15 02-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_3_1_BASE OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.14 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


Revision tags: OPENBSD_3_0_BASE
# 1.13 01-Oct-2001 jakob

add -l flag - do loose permissions checks, in which more stringent permissions
will match less stringent ones. ok millert@, deraadt@.


# 1.12 10-Aug-2001 millert

pass -Wall


Revision tags: OPENBSD_2_7_BASE OPENBSD_2_8_BASE OPENBSD_2_9_BASE
# 1.11 20-Jan-2000 millert

getcwd() does not stuff an error string in buf on error, call strerror()
instead.


Revision tags: OPENBSD_2_5_BASE OPENBSD_2_6_BASE
# 1.10 24-Jan-1999 rohee

-q was not in usage()


# 1.9 28-Dec-1998 deraadt

use getcwd(3)


Revision tags: OPENBSD_2_4_BASE
# 1.8 20-Aug-1998 marc

add -q flag to silent messages of the type:
missing: some-file-name (not created: File exists)
which occurred of some-file-name was a path that contained a symbolic link


Revision tags: OPENBSD_2_2_BASE OPENBSD_2_3_BASE
# 1.7 18-Jul-1997 millert

err() -> error() so we don't conflict with err(3).


# 1.6 18-Jul-1997 millert

Add rmd160 support. Sheesh, you'd think this was tripwire.


Revision tags: OPENBSD_2_1_BASE
# 1.5 15-Jan-1997 millert

getopt(3) returns -1 when out of args, not EOF, whee!


# 1.4 03-Jan-1997 millert

From NetBSD:
Add a `-t' (touch) option to update time stamps.
Only record size for regular files.


# 1.3 10-Dec-1996 deraadt

merge freebsd mtree diffs, plus -Wall cleanup


# 1.2 08-Dec-1996 niklas

64-bit clean + RCS tags


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.27 15-Nov-2021 millert

No need to declare optind, optarg or opterr; unistd.h does this for us.
From Jan Stary. OK deraadt@


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE OPENBSD_7_0_BASE
# 1.26 16-Sep-2018 millert

Add missing includes for setpassent() and setgroupent().


# 1.25 16-Sep-2018 millert

Use user_from_uid(3), group_from_gid(3), uid_from_user(3) and
gid_from_group(3) to avoid repeatedly looking up the same user/group.
Also keep the passwd and group files open to avoid opening and
closing them all the time. OK tb@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.24 20-Dec-2015 benno

need to include err.h for err().
ok deraadt@


# 1.23 19-Dec-2015 tb

Add pledge(2). It is not currently possible to pledge -u and -U
because of chown(2) and chmod(2).

If -u and -U aren't specified, the basic pledge is "stdio rpath getpw".
"getpw" is used to resolve uid and gid to names and vice versa.
The -r flag makes use of rmdir(2) and unlink(2), so we need "cpath"
The -t flag uses utimes(2), so we need "fattr"

ok deraadt@


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.22 16-Jan-2015 deraadt

Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible. Annotate <sys/param.h> lines with their current reasons. Switch
to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change
MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where
sensible to avoid pulling in the pollution. These are the files confirmed
through binary verification.
ok guenther, millert, doug (helped with the verification protocol)


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.21 27-Nov-2013 okan

remove erroneous char cast to switch expression processing getopt(3);
not used in any cases.

ok deraadt@, guenther@, millert@


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE
# 1.20 27-Oct-2009 deraadt

rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
unmaintainable). these days, people use source. these id's do not provide
any benefit, and do hurt the small install media
(the 33,000 line diff is essentially mechanical)
ok with the idea millert, ok dms


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.19 17-May-2008 sobrado

documentation tweaks.

ok (some time ago) jmc@


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE
# 1.18 26-Jul-2003 millert

Add missing "break" in -s case and make usage() explicitly take void.
From Andrey Matveev.


# 1.17 26-Jun-2003 deraadt

strict proto cleanups


# 1.16 16-Jun-2003 millert

Bitwise AND was used where logical AND was intended; from mpech@


# 1.15 02-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_3_1_BASE OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.14 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


Revision tags: OPENBSD_3_0_BASE
# 1.13 01-Oct-2001 jakob

add -l flag - do loose permissions checks, in which more stringent permissions
will match less stringent ones. ok millert@, deraadt@.


# 1.12 10-Aug-2001 millert

pass -Wall


Revision tags: OPENBSD_2_7_BASE OPENBSD_2_8_BASE OPENBSD_2_9_BASE
# 1.11 20-Jan-2000 millert

getcwd() does not stuff an error string in buf on error, call strerror()
instead.


Revision tags: OPENBSD_2_5_BASE OPENBSD_2_6_BASE
# 1.10 24-Jan-1999 rohee

-q was not in usage()


# 1.9 28-Dec-1998 deraadt

use getcwd(3)


Revision tags: OPENBSD_2_4_BASE
# 1.8 20-Aug-1998 marc

add -q flag to silent messages of the type:
missing: some-file-name (not created: File exists)
which occurred of some-file-name was a path that contained a symbolic link


Revision tags: OPENBSD_2_2_BASE OPENBSD_2_3_BASE
# 1.7 18-Jul-1997 millert

err() -> error() so we don't conflict with err(3).


# 1.6 18-Jul-1997 millert

Add rmd160 support. Sheesh, you'd think this was tripwire.


Revision tags: OPENBSD_2_1_BASE
# 1.5 15-Jan-1997 millert

getopt(3) returns -1 when out of args, not EOF, whee!


# 1.4 03-Jan-1997 millert

From NetBSD:
Add a `-t' (touch) option to update time stamps.
Only record size for regular files.


# 1.3 10-Dec-1996 deraadt

merge freebsd mtree diffs, plus -Wall cleanup


# 1.2 08-Dec-1996 niklas

64-bit clean + RCS tags


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.26 16-Sep-2018 millert

Add missing includes for setpassent() and setgroupent().


# 1.25 16-Sep-2018 millert

Use user_from_uid(3), group_from_gid(3), uid_from_user(3) and
gid_from_group(3) to avoid repeatedly looking up the same user/group.
Also keep the passwd and group files open to avoid opening and
closing them all the time. OK tb@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.24 20-Dec-2015 benno

need to include err.h for err().
ok deraadt@


# 1.23 19-Dec-2015 tb

Add pledge(2). It is not currently possible to pledge -u and -U
because of chown(2) and chmod(2).

If -u and -U aren't specified, the basic pledge is "stdio rpath getpw".
"getpw" is used to resolve uid and gid to names and vice versa.
The -r flag makes use of rmdir(2) and unlink(2), so we need "cpath"
The -t flag uses utimes(2), so we need "fattr"

ok deraadt@


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.22 16-Jan-2015 deraadt

Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible. Annotate <sys/param.h> lines with their current reasons. Switch
to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change
MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where
sensible to avoid pulling in the pollution. These are the files confirmed
through binary verification.
ok guenther, millert, doug (helped with the verification protocol)


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.21 27-Nov-2013 okan

remove erroneous char cast to switch expression processing getopt(3);
not used in any cases.

ok deraadt@, guenther@, millert@


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE
# 1.20 27-Oct-2009 deraadt

rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
unmaintainable). these days, people use source. these id's do not provide
any benefit, and do hurt the small install media
(the 33,000 line diff is essentially mechanical)
ok with the idea millert, ok dms


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.19 17-May-2008 sobrado

documentation tweaks.

ok (some time ago) jmc@


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE
# 1.18 26-Jul-2003 millert

Add missing "break" in -s case and make usage() explicitly take void.
From Andrey Matveev.


# 1.17 26-Jun-2003 deraadt

strict proto cleanups


# 1.16 16-Jun-2003 millert

Bitwise AND was used where logical AND was intended; from mpech@


# 1.15 02-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_3_1_BASE OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.14 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


Revision tags: OPENBSD_3_0_BASE
# 1.13 01-Oct-2001 jakob

add -l flag - do loose permissions checks, in which more stringent permissions
will match less stringent ones. ok millert@, deraadt@.


# 1.12 10-Aug-2001 millert

pass -Wall


Revision tags: OPENBSD_2_7_BASE OPENBSD_2_8_BASE OPENBSD_2_9_BASE
# 1.11 20-Jan-2000 millert

getcwd() does not stuff an error string in buf on error, call strerror()
instead.


Revision tags: OPENBSD_2_5_BASE OPENBSD_2_6_BASE
# 1.10 24-Jan-1999 rohee

-q was not in usage()


# 1.9 28-Dec-1998 deraadt

use getcwd(3)


Revision tags: OPENBSD_2_4_BASE
# 1.8 20-Aug-1998 marc

add -q flag to silent messages of the type:
missing: some-file-name (not created: File exists)
which occurred of some-file-name was a path that contained a symbolic link


Revision tags: OPENBSD_2_2_BASE OPENBSD_2_3_BASE
# 1.7 18-Jul-1997 millert

err() -> error() so we don't conflict with err(3).


# 1.6 18-Jul-1997 millert

Add rmd160 support. Sheesh, you'd think this was tripwire.


Revision tags: OPENBSD_2_1_BASE
# 1.5 15-Jan-1997 millert

getopt(3) returns -1 when out of args, not EOF, whee!


# 1.4 03-Jan-1997 millert

From NetBSD:
Add a `-t' (touch) option to update time stamps.
Only record size for regular files.


# 1.3 10-Dec-1996 deraadt

merge freebsd mtree diffs, plus -Wall cleanup


# 1.2 08-Dec-1996 niklas

64-bit clean + RCS tags


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.24 20-Dec-2015 benno

need to include err.h for err().
ok deraadt@


# 1.23 19-Dec-2015 tb

Add pledge(2). It is not currently possible to pledge -u and -U
because of chown(2) and chmod(2).

If -u and -U aren't specified, the basic pledge is "stdio rpath getpw".
"getpw" is used to resolve uid and gid to names and vice versa.
The -r flag makes use of rmdir(2) and unlink(2), so we need "cpath"
The -t flag uses utimes(2), so we need "fattr"

ok deraadt@


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.22 16-Jan-2015 deraadt

Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible. Annotate <sys/param.h> lines with their current reasons. Switch
to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change
MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where
sensible to avoid pulling in the pollution. These are the files confirmed
through binary verification.
ok guenther, millert, doug (helped with the verification protocol)


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.21 27-Nov-2013 okan

remove erroneous char cast to switch expression processing getopt(3);
not used in any cases.

ok deraadt@, guenther@, millert@


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE
# 1.20 27-Oct-2009 deraadt

rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
unmaintainable). these days, people use source. these id's do not provide
any benefit, and do hurt the small install media
(the 33,000 line diff is essentially mechanical)
ok with the idea millert, ok dms


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.19 17-May-2008 sobrado

documentation tweaks.

ok (some time ago) jmc@


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE
# 1.18 26-Jul-2003 millert

Add missing "break" in -s case and make usage() explicitly take void.
From Andrey Matveev.


# 1.17 26-Jun-2003 deraadt

strict proto cleanups


# 1.16 16-Jun-2003 millert

Bitwise AND was used where logical AND was intended; from mpech@


# 1.15 02-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_3_1_BASE OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.14 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


Revision tags: OPENBSD_3_0_BASE
# 1.13 01-Oct-2001 jakob

add -l flag - do loose permissions checks, in which more stringent permissions
will match less stringent ones. ok millert@, deraadt@.


# 1.12 10-Aug-2001 millert

pass -Wall


Revision tags: OPENBSD_2_7_BASE OPENBSD_2_8_BASE OPENBSD_2_9_BASE
# 1.11 20-Jan-2000 millert

getcwd() does not stuff an error string in buf on error, call strerror()
instead.


Revision tags: OPENBSD_2_5_BASE OPENBSD_2_6_BASE
# 1.10 24-Jan-1999 rohee

-q was not in usage()


# 1.9 28-Dec-1998 deraadt

use getcwd(3)


Revision tags: OPENBSD_2_4_BASE
# 1.8 20-Aug-1998 marc

add -q flag to silent messages of the type:
missing: some-file-name (not created: File exists)
which occurred of some-file-name was a path that contained a symbolic link


Revision tags: OPENBSD_2_2_BASE OPENBSD_2_3_BASE
# 1.7 18-Jul-1997 millert

err() -> error() so we don't conflict with err(3).


# 1.6 18-Jul-1997 millert

Add rmd160 support. Sheesh, you'd think this was tripwire.


Revision tags: OPENBSD_2_1_BASE
# 1.5 15-Jan-1997 millert

getopt(3) returns -1 when out of args, not EOF, whee!


# 1.4 03-Jan-1997 millert

From NetBSD:
Add a `-t' (touch) option to update time stamps.
Only record size for regular files.


# 1.3 10-Dec-1996 deraadt

merge freebsd mtree diffs, plus -Wall cleanup


# 1.2 08-Dec-1996 niklas

64-bit clean + RCS tags


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision