summaryrefslogtreecommitdiff
path: root/id.c
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2019-11-01 10:26:58 -0400
committerJakob Kaivo <jkk@ung.org>2019-11-01 10:26:58 -0400
commit347fac6ffae1196b664691771bd60ec1d87ad614 (patch)
tree7678e0627b9e65dfa5fcce7b887e52a0f6e9244c /id.c
parent1ad07756e1f9315c80ac258ba45eeaecf1ca1707 (diff)
rename id_printgids() to print_groups()
Diffstat (limited to 'id.c')
-rw-r--r--id.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/id.c b/id.c
index d02ab4e..01ff84f 100644
--- a/id.c
+++ b/id.c
@@ -72,7 +72,7 @@ static void print_id(const char *prefix, enum type type, id_t id, int mode)
}
}
-static void id_printgids(uid_t uid, int mode)
+static void print_groups(uid_t uid, int mode)
{
struct passwd *pwd = getpwuid(uid);
if (pwd == NULL) {
@@ -133,9 +133,7 @@ int main(int argc, char *argv[])
return 1;
}
- if (optind >= argc) {
- /* TODO: handle -u */
- } else {
+ if (optind == argc - 1) {
struct passwd *pwd = getpwnam(argv[optind]);
if (pwd == NULL) {
fprintf(stderr, "id: user '%s' not found\n",
@@ -148,7 +146,7 @@ int main(int argc, char *argv[])
switch (mode) {
case 'G':
- id_printgids(uid, names ? NAMES : NUMS);
+ print_groups(uid, names ? NAMES : NUMS);
break;
case 'g':
@@ -171,7 +169,7 @@ int main(int argc, char *argv[])
print_id(" egid=", GROUP, getegid(), 0);
}
- id_printgids(uid, FULL);
+ print_groups(uid, FULL);
}
printf("\n");