aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorBrooks Davis <brooks@FreeBSD.org>2003-07-07 21:41:23 +0000
committerBrooks Davis <brooks@FreeBSD.org>2003-07-07 21:41:23 +0000
commit974ac91938b63b8b8ab76d6bf5bb95355186eabd (patch)
tree46a3339984c5d0729f7f5fadcd55c0415cdf176e /usr.sbin
parente14eb5a11822c5b44be8ecab517b9523a426687e (diff)
downloadsrc-974ac91938b63b8b8ab76d6bf5bb95355186eabd.tar.gz
src-974ac91938b63b8b8ab76d6bf5bb95355186eabd.zip
Add support for a -n argument which displays user and group IDs
numerically rather than converting to a user or group name. MFC After: 1 week
Notes
Notes: svn path=/head/; revision=117318
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/repquota/repquota.85
-rw-r--r--usr.sbin/repquota/repquota.c14
2 files changed, 14 insertions, 5 deletions
diff --git a/usr.sbin/repquota/repquota.8 b/usr.sbin/repquota/repquota.8
index 64b86ccfbc3e..81ebd9da8a38 100644
--- a/usr.sbin/repquota/repquota.8
+++ b/usr.sbin/repquota/repquota.8
@@ -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 listed in
.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).
diff --git a/usr.sbin/repquota/repquota.c b/usr.sbin/repquota/repquota.c
index 47438736c190..5930a8a11f2b 100644
--- a/usr.sbin/repquota/repquota.c
+++ b/usr.sbin/repquota/repquota.c
@@ -96,6 +96,7 @@ u_long highid[MAXQUOTAS]; /* highest addid()'ed identifier per type */
int vflag; /* verbose */
int aflag; /* all filesystems */
+int nflag; /* display user/group by id */
int hasquota(struct fstab *, int, char **);
int oneof(char *, char *[], int);
@@ -113,7 +114,7 @@ main(int argc, char **argv)
long i, argnum, done = 0;
char ch, *qfnp;
- while ((ch = getopt(argc, argv, "aguv")) != -1) {
+ while ((ch = getopt(argc, argv, "agnuv")) != -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 = getgrent()) != 0)
(void) addid((u_long)gr->gr_gid, GRPQUOTA, gr->gr_name);
endgrent();
}
- if (uflag) {
+ if (uflag && !nflag) {
setpwent();
while ((pw = getpwent()) != 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);
}