Add mandoc-manpage for chmod(1)

and mark it as finished in README.

One small rationale on the way the manpage is set up: Looking at
the coreutils manpage, it does not invite to be a quick reference
guide, whereas I wrote this manpage to be short and concise in regard
to the information the advanced user needs.
No one needs to explain what an octal number is. That's not part of
the scope of this manpage.
Also, nobody wants to read a block of text just to find out how
to build an octal mode string.
This commit is contained in:
FRIGN 2015-01-17 22:33:19 +01:00 committed by sin
parent eff58b5531
commit b55de3d1a2
3 changed files with 68 additions and 76 deletions

2
README
View File

@ -12,7 +12,7 @@ The following tools are implemented (* == finished):
* cal yes none * cal yes none
* cat yes none * cat yes none
chgrp no -h, -H, -L, -P chgrp no -h, -H, -L, -P
chmod yes none * chmod yes none
chown no -h, -H, -L, -P chown no -h, -H, -L, -P
chroot non-posix none chroot non-posix none
cksum yes none cksum yes none

140
chmod.1
View File

@ -1,74 +1,66 @@
.TH CHMOD 1 sbase\-VERSION .Dd January 17, 2015
.SH NAME .Dt CHMOD 1 sbase\-VERSION
chmod \- change file mode .Sh NAME
.SH SYNOPSIS .Nm chmod
.B chmod .Nd change file mode
.RB [ \-r ] .Sh SYNOPSIS
.I octal .Nm chmod
.RI [ file ...] .Op Fl R
.P .Ar mode
.B chmod .Op Ar file ...
.RB [ \-r ] .Sh DESCRIPTION
.RB [ ugoa ]*[ +-= ][ rwxst ]* .Nm
.RI [ file ...] changes the file mode of the given files.
.SH DESCRIPTION .Pp
.B chmod If
changes the file mode for the given files. .Ar mode
.P is
If the mode is an .Em octal
.I octal "[sog]e"
number, the modes are set according to that number's comprising bits. The first .Bl -tag -width Ds
digit defines the setuid (4), setgid (2), and sticky (1) attributes. The second digit .It s
defines the owner's permissions: read (4), write (2), and execute (1); the third .Xr sticky 1 => s += 1
defines permissions for others in the file's group; and the fourth for all other .Pp
users. Leading zeroes may be omitted. .Xr setgid 2 => s += 2
.P .Pp
Alternatively the mode may be symbolic. The symbol meanings are: .Xr setuid 4 => s += 4
.TP .It o|g|e
.B u owner | group | everyone
modifies owner permissions. .Pp
.PD 0 .Xr execute 1 => o|g|e += 1
.TP .Pp
.B g .Xr write 2 => o|g|e += 2
modifies group permissions. .Pp
.TP .Xr read 4 => o|g|e += 4
.B o .El
modifies other user permissions. .Pp
.TP Leading zeroes may be omitted.
.B a .Pp
modifies all user permissions. If
.PD .Ar mode
.TP is
.B + .Em symbolic
adds the given permissions to the mode. "[ugoa]*[+-=][rwxst]*"
.PD 0 .Bl -tag -width Ds
.TP .It u|g|o|a
.B - owner | group | other (non-group) | everyone
removes the given permissions from the mode. .It +|-|=
.TP add | remove | set
.B = .It r|w|x|s|t
sets the mode to the given permissions. read | write | execute | setuid and setgid | sticky
.PD .El
.TP .Sh OPTIONS
.B r .Bl -tag -width Ds
read permissions. .It Fl R
.PD 0 Change modes recursively
.TP .El
.B w .Sh STANDARDS
write permissions. The
.TP .Nm
.B x utility is compliant with the
execute permissions. .St -p1003.1-2008
.TP specification.
.B s .Pp
setuid and setgid attributes. The
.TP .Op Fl R
.B t flag is an extension to that specification.
sticky attribute.
.PD
.SH OPTIONS
.TP
.B \-r
change directory mode recursively.
.SH SEE ALSO
.IR chmod (2)