summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authoriedowse <iedowse@FreeBSD.org>2002-08-09 00:43:36 +0000
committeriedowse <iedowse@FreeBSD.org>2002-08-09 00:43:36 +0000
commit10e78eec8cdc3b77ab3d31c96f2759f477f6e855 (patch)
treedcea9fd4cef7769d7e5767a8484f950057ea4739 /usr.bin
parent170fb8b34d55cd9f478b6dd03f73ad369ade2695 (diff)
downloadFreeBSD-src-10e78eec8cdc3b77ab3d31c96f2759f477f6e855.zip
FreeBSD-src-10e78eec8cdc3b77ab3d31c96f2759f477f6e855.tar.gz
Fix a few compiler warnings, sort options and make the usage()
output match the synopsis.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/quota/quota.123
-rw-r--r--usr.bin/quota/quota.c33
2 files changed, 29 insertions, 27 deletions
diff --git a/usr.bin/quota/quota.1 b/usr.bin/quota/quota.1
index 76c5932..314c083 100644
--- a/usr.bin/quota/quota.1
+++ b/usr.bin/quota/quota.1
@@ -43,17 +43,16 @@
.Nd display disk usage and limits
.Sh SYNOPSIS
.Nm
-.Op Fl g
-.Op Fl u
+.Op Fl gu
.Op Fl v | Fl q
.Nm
.Op Fl u
.Op Fl v | Fl q
-.Ar user
+.Ar user ...
.Nm
-.Op Fl g
+.Fl g
.Op Fl v | Fl q
-.Ar group
+.Ar group ...
.Sh DESCRIPTION
The
.Nm
@@ -65,16 +64,18 @@ The following options are available:
.It Fl g
Print group quotas for the group
of which the user is a member.
-The optional
-.Fl u
-flag is equivalent to the default.
-.It Fl v
-Display quotas on filesystems
-where no storage is allocated.
.It Fl q
Print a more terse message,
containing only information
on filesystems where usage is over quota.
+.It Fl u
+Print the user quotas.
+This is the default unless
+.Fl g
+is specified.
+.It Fl v
+Display quotas on filesystems
+where no storage is allocated.
.El
.Pp
Specifying both
diff --git a/usr.bin/quota/quota.c b/usr.bin/quota/quota.c
index 342bdad..be83e64 100644
--- a/usr.bin/quota/quota.c
+++ b/usr.bin/quota/quota.c
@@ -116,20 +116,20 @@ main(int argc, char *argv[])
int i, gflag = 0, uflag = 0;
char ch;
- while ((ch = getopt(argc, argv, "ugvq")) != -1) {
+ while ((ch = getopt(argc, argv, "gquv")) != -1) {
switch(ch) {
case 'g':
gflag++;
break;
+ case 'q':
+ qflag++;
+ break;
case 'u':
uflag++;
break;
case 'v':
vflag++;
break;
- case 'q':
- qflag++;
- break;
default:
usage();
}
@@ -180,9 +180,9 @@ usage(void)
{
fprintf(stderr, "%s\n%s\n%s\n",
- "usage: quota [-guqv]",
- " quota [-qv] -u username ...",
- " quota [-qv] -g groupname ...");
+ "usage: quota [-gu] [-v | -q]",
+ " quota [-u] [-v | -q] user ...",
+ " quota -g [-v | -q] group ...");
exit(1);
}
@@ -371,10 +371,10 @@ showquotas(int type, u_long id, const char *name)
, (msgb == (char *)0) ? ""
:timeprt(qup->dqblk.dqb_btime));
printf("%8lu%c%7lu%8lu%8s\n"
- , qup->dqblk.dqb_curinodes
+ , (u_long)qup->dqblk.dqb_curinodes
, (msgi == (char *)0) ? ' ' : '*'
- , qup->dqblk.dqb_isoftlimit
- , qup->dqblk.dqb_ihardlimit
+ , (u_long)qup->dqblk.dqb_isoftlimit
+ , (u_long)qup->dqblk.dqb_ihardlimit
, (msgi == (char *)0) ? ""
: timeprt(qup->dqblk.dqb_itime)
);
@@ -424,14 +424,15 @@ timeprt(time_t seconds)
minutes = (seconds + 30) / 60;
hours = (minutes + 30) / 60;
if (hours >= 36) {
- sprintf(buf, "%lddays", (hours + 12) / 24);
+ sprintf(buf, "%lddays", ((long)hours + 12) / 24);
return (buf);
}
if (minutes >= 60) {
- sprintf(buf, "%2ld:%ld", minutes / 60, minutes % 60);
+ sprintf(buf, "%2ld:%ld", (long)minutes / 60,
+ (long)minutes % 60);
return (buf);
}
- sprintf(buf, "%2ld", minutes);
+ sprintf(buf, "%2ld", (long)minutes);
return (buf);
}
@@ -441,7 +442,7 @@ timeprt(time_t seconds)
static struct quotause *
getprivs(long id, int quotatype)
{
- struct quotause *qup, *quptail;
+ struct quotause *qup, *quptail = NULL;
struct fstab *fs;
struct quotause *quphead;
struct statfs *fst;
@@ -607,8 +608,8 @@ getnfsquota(struct statfs *fst, struct quotause *qup, long id, int quotatype)
gq_args.gqa_pathp = cp + 1;
gq_args.gqa_uid = id;
if (callaurpc(fst->f_mntfromname, RQUOTAPROG, RQUOTAVERS,
- RQUOTAPROC_GETQUOTA, xdr_getquota_args, (char *)&gq_args,
- xdr_getquota_rslt, (char *)&gq_rslt) != 0) {
+ RQUOTAPROC_GETQUOTA, (xdrproc_t)xdr_getquota_args, (char *)&gq_args,
+ (xdrproc_t)xdr_getquota_rslt, (char *)&gq_rslt) != 0) {
*cp = ':';
return (0);
}
OpenPOWER on IntegriCloud