Fri Jan 22 05:41:36 2010 UTC ()
Document "-f".  From Andreas Wiese in PR bin/35409, slightly modified.


(snj)
diff -r1.22 -r1.23 src/bin/chmod/chmod.1
diff -r1.34 -r1.35 src/bin/chmod/chmod.c

cvs diff -r1.22 -r1.23 src/bin/chmod/chmod.1 (expand / switch to unified diff)

--- src/bin/chmod/chmod.1 2009/03/24 00:10:58 1.22
+++ src/bin/chmod/chmod.1 2010/01/22 05:41:36 1.23
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1.\" $NetBSD: chmod.1,v 1.22 2009/03/24 00:10:58 joerg Exp $ 1.\" $NetBSD: chmod.1,v 1.23 2010/01/22 05:41:36 snj Exp $
2.\" 2.\"
3.\" Copyright (c) 1989, 1990, 1993, 1994 3.\" Copyright (c) 1989, 1990, 1993, 1994
4.\" The Regents of the University of California. All rights reserved. 4.\" The Regents of the University of California. All rights reserved.
5.\" 5.\"
6.\" This code is derived from software contributed to Berkeley by 6.\" This code is derived from software contributed to Berkeley by
7.\" the Institute of Electrical and Electronics Engineers, Inc. 7.\" the Institute of Electrical and Electronics Engineers, Inc.
8.\" 8.\"
9.\" Redistribution and use in source and binary forms, with or without 9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions 10.\" modification, are permitted provided that the following conditions
11.\" are met: 11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright 12.\" 1. Redistributions of source code must retain the above copyright
13.\" notice, this list of conditions and the following disclaimer. 13.\" notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright 14.\" 2. Redistributions in binary form must reproduce the above copyright
@@ -22,39 +22,39 @@ @@ -22,39 +22,39 @@
22.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 24.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31.\" SUCH DAMAGE. 31.\" SUCH DAMAGE.
32.\" 32.\"
33.\" @(#)chmod.1 8.4 (Berkeley) 3/31/94 33.\" @(#)chmod.1 8.4 (Berkeley) 3/31/94
34.\" 34.\"
35.Dd December 9, 2005 35.Dd January 22, 2010
36.Dt CHMOD 1 36.Dt CHMOD 1
37.Os 37.Os
38.Sh NAME 38.Sh NAME
39.Nm chmod 39.Nm chmod
40.Nd change file modes 40.Nd change file modes
41.Sh SYNOPSIS 41.Sh SYNOPSIS
42.Nm 42.Nm
43.Oo 43.Oo
44.Fl R 44.Fl R
45.Op Fl H | Fl L | Fl P 45.Op Fl H | Fl L | Fl P
46.Oc 46.Oc
47.Op Fl h 47.Op Fl fh
48.Ar mode 48.Ar mode
49.Ar 49.Ar
50.Sh DESCRIPTION 50.Sh DESCRIPTION
51The 51The
52.Nm 52.Nm
53utility modifies the file mode bits of the listed files 53utility modifies the file mode bits of the listed files
54as specified by the 54as specified by the
55.Ar mode 55.Ar mode
56operand. 56operand.
57.Pp 57.Pp
58The options are as follows: 58The options are as follows:
59.Bl -tag -width Ds 59.Bl -tag -width Ds
60.It Fl H 60.It Fl H
@@ -63,26 +63,30 @@ If the @@ -63,26 +63,30 @@ If the
63option is specified, symbolic links on the command line are followed. 63option is specified, symbolic links on the command line are followed.
64(Symbolic links encountered in the tree traversal are not followed.) 64(Symbolic links encountered in the tree traversal are not followed.)
65.It Fl L 65.It Fl L
66If the 66If the
67.Fl R 67.Fl R
68option is specified, all symbolic links are followed. 68option is specified, all symbolic links are followed.
69.It Fl P 69.It Fl P
70If the 70If the
71.Fl R 71.Fl R
72option is specified, no symbolic links are followed. 72option is specified, no symbolic links are followed.
73.It Fl R 73.It Fl R
74Change the modes of the file hierarchies rooted in the files 74Change the modes of the file hierarchies rooted in the files
75instead of just the files themselves. 75instead of just the files themselves.
 76.It Fl f
 77Do not display a diagnostic message or modify the exit status if
 78.Nm
 79fails to change the mode of a file.
76.It Fl h 80.It Fl h
77If 81If
78.Ar file 82.Ar file
79is symbolic link, the mode of the link is changed. 83is symbolic link, the mode of the link is changed.
80.El 84.El
81.Pp 85.Pp
82The 86The
83.Fl H , 87.Fl H ,
84.Fl L 88.Fl L
85and 89and
86.Fl P 90.Fl P
87options are ignored unless the 91options are ignored unless the
88.Fl R 92.Fl R

cvs diff -r1.34 -r1.35 src/bin/chmod/chmod.c (expand / switch to unified diff)

--- src/bin/chmod/chmod.c 2008/07/20 00:52:39 1.34
+++ src/bin/chmod/chmod.c 2010/01/22 05:41:36 1.35
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: chmod.c,v 1.34 2008/07/20 00:52:39 lukem Exp $ */ 1/* $NetBSD: chmod.c,v 1.35 2010/01/22 05:41:36 snj Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1989, 1993, 1994 4 * Copyright (c) 1989, 1993, 1994
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -30,27 +30,27 @@ @@ -30,27 +30,27 @@
30 */ 30 */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33#ifndef lint 33#ifndef lint
34__COPYRIGHT( 34__COPYRIGHT(
35"@(#) Copyright (c) 1989, 1993, 1994\ 35"@(#) Copyright (c) 1989, 1993, 1994\
36 The Regents of the University of California. All rights reserved."); 36 The Regents of the University of California. All rights reserved.");
37#endif /* not lint */ 37#endif /* not lint */
38 38
39#ifndef lint 39#ifndef lint
40#if 0 40#if 0
41static char sccsid[] = "@(#)chmod.c 8.8 (Berkeley) 4/1/94"; 41static char sccsid[] = "@(#)chmod.c 8.8 (Berkeley) 4/1/94";
42#else 42#else
43__RCSID("$NetBSD: chmod.c,v 1.34 2008/07/20 00:52:39 lukem Exp $"); 43__RCSID("$NetBSD: chmod.c,v 1.35 2010/01/22 05:41:36 snj Exp $");
44#endif 44#endif
45#endif /* not lint */ 45#endif /* not lint */
46 46
47#include <sys/param.h> 47#include <sys/param.h>
48#include <sys/stat.h> 48#include <sys/stat.h>
49#include <sys/types.h> 49#include <sys/types.h>
50 50
51#include <err.h> 51#include <err.h>
52#include <errno.h> 52#include <errno.h>
53#include <fts.h> 53#include <fts.h>
54#include <limits.h> 54#include <limits.h>
55#include <locale.h> 55#include <locale.h>
56#include <stdio.h> 56#include <stdio.h>
@@ -81,27 +81,27 @@ main(int argc, char *argv[]) @@ -81,27 +81,27 @@ main(int argc, char *argv[])
81 Hflag = 1; 81 Hflag = 1;
82 Lflag = 0; 82 Lflag = 0;
83 break; 83 break;
84 case 'L': 84 case 'L':
85 Lflag = 1; 85 Lflag = 1;
86 Hflag = 0; 86 Hflag = 0;
87 break; 87 break;
88 case 'P': 88 case 'P':
89 Hflag = Lflag = 0; 89 Hflag = Lflag = 0;
90 break; 90 break;
91 case 'R': 91 case 'R':
92 Rflag = 1; 92 Rflag = 1;
93 break; 93 break;
94 case 'f': /* XXX: undocumented. */ 94 case 'f':
95 fflag = 1; 95 fflag = 1;
96 break; 96 break;
97 case 'h': 97 case 'h':
98 /* 98 /*
99 * In System V the -h option causes chmod to 99 * In System V the -h option causes chmod to
100 * change the mode of the symbolic link. 100 * change the mode of the symbolic link.
101 * 4.4BSD's symbolic links didn't have modes, 101 * 4.4BSD's symbolic links didn't have modes,
102 * so it was an undocumented noop. In NetBSD 102 * so it was an undocumented noop. In NetBSD
103 * 1.3, lchmod(2) is introduced and this 103 * 1.3, lchmod(2) is introduced and this
104 * option does real work. 104 * option does real work.
105 */ 105 */
106 hflag = 1; 106 hflag = 1;
107 break; 107 break;
@@ -197,18 +197,18 @@ done: argv += optind; @@ -197,18 +197,18 @@ done: argv += optind;
197 } 197 }
198 if (errno) { 198 if (errno) {
199 err(EXIT_FAILURE, "fts_read"); 199 err(EXIT_FAILURE, "fts_read");
200 /* NOTREACHED */ 200 /* NOTREACHED */
201 } 201 }
202 exit(rval); 202 exit(rval);
203 /* NOTREACHED */ 203 /* NOTREACHED */
204} 204}
205 205
206void 206void
207usage(void) 207usage(void)
208{ 208{
209 (void)fprintf(stderr, 209 (void)fprintf(stderr,
210 "usage: %s [-R [-H | -L | -P]] [-h] mode file ...\n", 210 "usage: %s [-R [-H | -L | -P]] [-fh] mode file ...\n",
211 getprogname()); 211 getprogname());
212 exit(1); 212 exit(1);
213 /* NOTREACHED */ 213 /* NOTREACHED */
214} 214}