diff options
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | doc/bus-chgrp.1 | 31 | ||||
-rw-r--r-- | doc/bus-chmod.1 | 38 | ||||
-rw-r--r-- | doc/bus-chown.1 | 34 | ||||
-rw-r--r-- | doc/bus.1 | 18 | ||||
-rw-r--r-- | src/cmdline.c | 6 |
6 files changed, 124 insertions, 5 deletions
@@ -16,7 +16,7 @@ MANDIR = ${DATADIR}/man PKGNAME = bus -MAN1 = bus bus-broadcast bus-create bus-listen bus-remove bus-wait +MAN1 = bus bus-broadcast bus-create bus-listen bus-remove bus-wait bus-chmod bus-chown bus-chgrp MAN3 = bus_create bus_unlink bus_open bus_close bus_read bus_write bus_poll bus_chmod bus_chown MAN5 = bus MAN7 = libbus diff --git a/doc/bus-chgrp.1 b/doc/bus-chgrp.1 new file mode 100644 index 0000000..cb59916 --- /dev/null +++ b/doc/bus-chgrp.1 @@ -0,0 +1,31 @@ +.TH BUS-CHGRP 1 BUS-%VERSION% +.SH NAME +bus chgrp - Change group ownership of a bus +.SH SYNOPSIS +.B bus chgrp +.IR group +.IR pathname +.SH DESCRIPTION +Change the group, that owns a bus with an associated \fIpathname\fP, +to the specified \fIgroup\fP. The \fIgroup\fP can be specified either +with a GID or with a group name. +.SH EXIT STATUS +.TP +0 +The command was successful. +.TP +1 +The command failed. +.TP +2 +The command is not recognised. +.SH SEE ALSO +bus-chown(1), bus-chmod(1) +.SH AUTHORS +Principal author, Mattias Andrée. See the LICENSE file for the full +list of authors. +.SH LICENSE +MIT/X Consortium License. +.SH BUGS +Please report bugs to https://github.com/maandree/bus/issues or to +maandree@member.fsf.org diff --git a/doc/bus-chmod.1 b/doc/bus-chmod.1 new file mode 100644 index 0000000..432ac84 --- /dev/null +++ b/doc/bus-chmod.1 @@ -0,0 +1,38 @@ +.TH BUS-CHMOD 1 BUS-%VERSION% +.SH NAME +bus chmod - Change permissions on a bus +.SH SYNOPSIS +.B bus chmod +.IR permissions +.IR pathname +.SH DESCRIPTION +Change whom as access to a bus with an associated \fIpathname\fP. +In the \fIpermissions\fP, the owner, the group, and others (not +in group) are represented by the symbols \fBu\fP, \fBg\fP, and +\fBo\fP, respectively. The \fIpermissions\fP string is imagined +to have always be prefixed with an \fB=\fP. This symbols means +that all user classes list after it, and only those classes, as +permission to use the bus. Similarly the symbols \fB+\fP and +\fB\-\fP can be used to grant and revoke access, respectively. +The symbols \fB=\fP, \fB+\fP, and \fB\-\fP can be maked, and are +interpreted from left to right. +.SH EXIT STATUS +.TP +0 +The command was successful. +.TP +1 +The command failed. +.TP +2 +The command is not recognised. +.SH SEE ALSO +bus-chown(1), bus-chgrp(1) +.SH AUTHORS +Principal author, Mattias Andrée. See the LICENSE file for the full +list of authors. +.SH LICENSE +MIT/X Consortium License. +.SH BUGS +Please report bugs to https://github.com/maandree/bus/issues or to +maandree@member.fsf.org diff --git a/doc/bus-chown.1 b/doc/bus-chown.1 new file mode 100644 index 0000000..64aa7d2 --- /dev/null +++ b/doc/bus-chown.1 @@ -0,0 +1,34 @@ +.TH BUS-CHOWN 1 BUS-%VERSION% +.SH NAME +bus chown - Change ownership of a bus +.SH SYNOPSIS +.B bus chown +.IR owner[:group] +.IR pathname +.SH DESCRIPTION +Change the owner, that owns a bus with an associated \fIpathname\fP, +to the specified \fIowner\fP. The \fIowner\fP can be specified either +with a UID or with a user name. +If a \fIgroup\fP is specified, the bus's owner-group will be set to +that \fIgroup\fP, otherwise the group will remain unchanged. The +\fIgroup\fP can be specified either with a GID or with a group name. +.SH EXIT STATUS +.TP +0 +The command was successful. +.TP +1 +The command failed. +.TP +2 +The command is not recognised. +.SH SEE ALSO +bus-chgrp(1), bus-chmod(1) +.SH AUTHORS +Principal author, Mattias Andrée. See the LICENSE file for the full +list of authors. +.SH LICENSE +MIT/X Consortium License. +.SH BUGS +Please report bugs to https://github.com/maandree/bus/issues or to +maandree@member.fsf.org @@ -31,6 +31,21 @@ for further details. Broadcast a message on a bus, see .BR bus-broadcast (1) for further details. +.TP +.B chmod +Change permissions on a bus, see +.BR bus-chmod (1) +for further details. +.TP +.B chown +Change ownership of a bus, see +.BR bus-chown (1) +for further details. +.TP +.B chgrp +Change group ownership of a bus, see +.BR bus-chgrp (1) +for further details. .SH EXIT STATUS .TP 0 @@ -43,7 +58,8 @@ The command failed. The command is not recognised. .SH SEE ALSO bus-create(1), bus-remove(1), bus-listen(1), bus-wait(1), -bus-broadcast(1), bus(5), libbus(7) +bus-broadcast(1), bus-chmod(1), bus-chown(1) bus-chgrp(1), +bus(5), libbus(7) .SH AUTHORS Principal author, Mattias Andrée. See the LICENSE file for the full list of authors. diff --git a/src/cmdline.c b/src/cmdline.c index a80c462..c23d185 100644 --- a/src/cmdline.c +++ b/src/cmdline.c @@ -345,7 +345,7 @@ main(int argc, char *argv[]) /* TODO add -n */ /* Change permissions. */ - } else if ((argc == 4) && !strcmp(argv[1], "chmod")) { /* TODO doc */ + } else if ((argc == 4) && !strcmp(argv[1], "chmod")) { t(parse_mode(argv[2], &mode_andnot, &mode_or)); t(stat(argv[3], &attr)); attr.st_mode &= ~mode_andnot; @@ -353,7 +353,7 @@ main(int argc, char *argv[]) t(bus_chmod(argv[3], attr.st_mode)); /* Change ownership. */ - } else if ((argc == 4) && !strcmp(argv[1], "chown")) { /* TODO doc */ + } else if ((argc == 4) && !strcmp(argv[1], "chown")) { if (strchr(argv[2], ':')) { t(parse_owner(argv[2], &uid, &gid)); t(bus_chown(argv[3], uid, gid)); @@ -364,7 +364,7 @@ main(int argc, char *argv[]) } /* Change group. */ - } else if ((argc == 4) && !strcmp(argv[1], "chgrp")) { /* TODO doc */ + } else if ((argc == 4) && !strcmp(argv[1], "chgrp")) { t(parse_owner(argv[2], NULL, &gid)); t(stat(argv[3], &attr)); t(bus_chown(argv[3], attr.st_uid, gid)); |