summaryrefslogtreecommitdiffstats
path: root/usr.sbin/repquota
diff options
context:
space:
mode:
authorbrooks <brooks@FreeBSD.org>2003-07-07 21:41:23 +0000
committerbrooks <brooks@FreeBSD.org>2003-07-07 21:41:23 +0000
commit0aa9da7467fbf7135f12fbf4ca5c3448648aece4 (patch)
tree46a3339984c5d0729f7f5fadcd55c0415cdf176e /usr.sbin/repquota
parent65d372d4a1e43e3d93de04ab797d05e9960b35fd (diff)
downloadFreeBSD-src-0aa9da7467fbf7135f12fbf4ca5c3448648aece4.zip
FreeBSD-src-0aa9da7467fbf7135f12fbf4ca5c3448648aece4.tar.gz
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
Diffstat (limited to 'usr.sbin/repquota')
-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 64b86cc..81ebd9d 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 4743873..5930a8a 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);
}
OpenPOWER on IntegriCloud