Implement -g and -u for id(1)
This commit is contained in:
parent
d3e332c72d
commit
db0ea785f0
8
id.1
8
id.1
@ -2,13 +2,19 @@
|
||||
.SH NAME
|
||||
\fBid\fR - Print real and effective user and group IDs
|
||||
.SH SYNOPSIS
|
||||
\fBid\fR [\fB-G\fR] \fR[\fIuser\fR|\fIuid\fR]
|
||||
\fBid\fR [\fB-g\fR] [\fB-u\fR] [\fB-G\fR] \fR[\fIuser\fR|\fIuid\fR]
|
||||
.SH DESCRIPTION
|
||||
\fBid\fR prints user and group information of the calling process to standard output.
|
||||
If a login name or uid is specified, the user and group information of that
|
||||
user is displayed.
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
\fB-g\fR
|
||||
Print only the effective group ID.
|
||||
.TP
|
||||
\fB-u\fR
|
||||
Print only the effective user ID.
|
||||
.TP
|
||||
\fB-G\fR
|
||||
Display group information as whitespace separated numbers, in no particular order.
|
||||
.SH SEE ALSO
|
||||
|
8
id.c
8
id.c
@ -18,7 +18,7 @@ static void usernam(const char *nam);
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
eprintf("usage: %s [-G] [user | uid]\n", argv0);
|
||||
eprintf("usage: %s [-g] [-u] [-G] [user | uid]\n", argv0);
|
||||
}
|
||||
|
||||
static int Gflag = 0;
|
||||
@ -27,6 +27,12 @@ int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
ARGBEGIN {
|
||||
case 'g':
|
||||
printf("%d\n", getegid());
|
||||
return EXIT_SUCCESS;
|
||||
case 'u':
|
||||
printf("%d\n", geteuid());
|
||||
return EXIT_SUCCESS;
|
||||
case 'G':
|
||||
Gflag = 1;
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user