[Toybox] [PATCH] toys/id: Fix output formating and ask for correct group id.

Georgi Chorbadzhiyski gf at unixsol.org
Thu Mar 8 04:53:14 PST 2012


---
 toys/id.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/toys/id.c b/toys/id.c
index 6ae3efe..ce315e4 100644
--- a/toys/id.c
+++ b/toys/id.c
@@ -14,7 +14,7 @@ config ID
 	bool "id"
 	default y
 	help
-	  usage: id [-nGgru]
+	  usage: id [-nGgru] [user]
 
 	  Print user and group ID.
 
@@ -40,10 +40,10 @@ void
 pretty_print(struct passwd *pw, struct group *grp, struct group **grps, int n)
 {
 	int i;
-	printf("uid= %d(%s) gid= %d(%s)", pw->pw_uid, pw->pw_name,
+	printf("uid=%d(%s) gid=%d(%s)", pw->pw_uid, pw->pw_name,
 									  grp->gr_gid, grp->gr_name);
 	if (n) {
-		printf(" groups= ");
+		printf(" groups=");
 	}
 	for (i = 0; i < n; i++) {
 		printf("%d(%s)%s", grps[i]->gr_gid, grps[i]->gr_name,
@@ -95,7 +95,7 @@ void id_main(void)
 		return;
 	}
 	
-	grp = getgrgid(pw->pw_gid);
+	grp = getgrgid(gid);
 	if (!grp) {
 		perror("id");
 		toys.exitval = 1;
-- 
1.7.5.1


 1331211194.0


More information about the Toybox mailing list