Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 1 Jul 2003 17:14:26 -0700
From:      Brooks Davis <brooks@one-eyed-alien.net>
To:        hackers@freebsd.org
Subject:   [PATCH] add -n to repquota
Message-ID:  <20030702001426.GA2442@Odin.AC.HMC.Edu>

next in thread | raw e-mail | index | archive | help

--6c2NcOVqGQ03X4Wi
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Does anyone object to this patch adding a -n option to repquota?  A
student admin on a RedHat system I help administer was running into
problems with their repquota truncating usernames[1] and I realized that
repquota really ought to have a -n option since that would be handy
for some scripts and would optionally eliminate the dependency of the
password database.

-- Brooks

[1] Fixed in 4.4BSD, maybe earlier

Index: repquota.8
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /usr/cvs/src/usr.sbin/repquota/repquota.8,v
retrieving revision 1.9
diff -u -p -r1.9 repquota.8
--- repquota.8	12 Dec 2002 17:26:03 -0000	1.9
+++ repquota.8	1 Jul 2003 23:56:37 -0000
@@ -44,11 +44,13 @@
 .Sh SYNOPSIS
 .Nm
 .Op Fl g
+.Op Fl n
 .Op Fl u
 .Op Fl v
 .Ar filesystem Ar ...
 .Nm
 .Op Fl g
+.Op Fl n
 .Op Fl u
 .Op Fl v
 .Fl a
@@ -66,6 +68,9 @@ Print the quotas of all the file systems
 .It Fl g
 Print only group quotas (the default is to print both
 group and user quotas if they exist).
+.It Fl n
+Display user and group IDs numerically rather than converting to
+a user or group name.
 .It Fl u
 Print only user quotas (the default is to print both
 group and user quotas if they exist).
Index: repquota.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /usr/cvs/src/usr.sbin/repquota/repquota.c,v
retrieving revision 1.15
diff -u -p -r1.15 repquota.c
--- repquota.c	3 May 2003 21:06:39 -0000	1.15
+++ repquota.c	1 Jul 2003 23:51:16 -0000
@@ -96,6 +96,7 @@ u_long highid[MAXQUOTAS];	/* highest add
=20
 int	vflag;			/* verbose */
 int	aflag;			/* all filesystems */
+int	nflag;			/* display user/group by id */
=20
 int hasquota(struct fstab *, int, char **);
 int oneof(char *, char *[], int);
@@ -113,7 +114,7 @@ main(int argc, char **argv)
 	long i, argnum, done =3D 0;
 	char ch, *qfnp;
=20
-	while ((ch =3D getopt(argc, argv, "aguv")) !=3D -1) {
+	while ((ch =3D getopt(argc, argv, "agnuv")) !=3D -1) {
 		switch(ch) {
 		case 'a':
 			aflag++;
@@ -121,6 +122,9 @@ main(int argc, char **argv)
 		case 'g':
 			gflag++;
 			break;
+		case 'n':
+			nflag++;
+			break;
 		case 'u':
 			uflag++;
 			break;
@@ -140,13 +144,13 @@ main(int argc, char **argv)
 			gflag++;
 		uflag++;
 	}
-	if (gflag) {
+	if (gflag && !nflag) {
 		setgrent();
 		while ((gr =3D getgrent()) !=3D 0)
 			(void) addid((u_long)gr->gr_gid, GRPQUOTA, gr->gr_name);
 		endgrent();
 	}
-	if (uflag) {
+	if (uflag && !nflag) {
 		setpwent();
 		while ((pw =3D getpwent()) !=3D 0)
 			(void) addid((u_long)pw->pw_uid, USRQUOTA, pw->pw_name);
@@ -183,8 +187,8 @@ static void
 usage()
 {
 	fprintf(stderr, "%s\n%s\n",
-		"usage: repquota [-v] [-g] [-u] -a",
-		"       repquota [-v] [-g] [-u] filesystem ...");
+		"usage: repquota [-v] [-g] [-n] [-u] -a",
+		"       repquota [-v] [-g] [-n] [-u] filesystem ...");
 	exit(1);
 }
=20

--=20
Any statement of the form "X is the one, true Y" is FALSE.
PGP fingerprint 655D 519C 26A7 82E7 2529  9BF0 5D8E 8BE9 F238 1AD4

--6c2NcOVqGQ03X4Wi
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE/AiPhXY6L6fI4GtQRAu9/AJ4ymTNvsH6vB3n2//3R7S2IwCooGwCfQ5xC
P1JhWYHK9x6SWa9U5hvzeBI=
=VGAe
-----END PGP SIGNATURE-----

--6c2NcOVqGQ03X4Wi--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030702001426.GA2442>