summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjkar8572 <jkar8572>2009-10-20 01:15:39 +0000
committerjkar8572 <jkar8572>2009-10-20 01:15:39 +0000
commitfafc3de3d0a002e8e1a02df12f2788602de6bb60 (patch)
treedd490d1d8dd58af3349babdb3a86c0480379e723
parent5244d768e5f9f4b245ca269ecc976cbc7aaba266 (diff)
Improved header of quota and repquota headers in case -s option is used.
-rw-r--r--Changelog1
-rw-r--r--quota.c11
-rw-r--r--quotasys.c5
-rw-r--r--repquota.c8
4 files changed, 21 insertions, 4 deletions
diff --git a/Changelog b/Changelog
index 4cadcdc..c83319d 100644
--- a/Changelog
+++ b/Changelog
@@ -1,4 +1,5 @@
Changes in quota-tools from 3.16 to 3.18
+* Improved header of quota an repquota output when -s option is used (Jan Kara)
* Fixed mountpoint scanning when NFS mountpoint is specified on command line (Jan Kara)
* Updated manpage of quotactl(2) (Jan Kara)
diff --git a/quota.c b/quota.c
index a96c0df..635aca3 100644
--- a/quota.c
+++ b/quota.c
@@ -34,7 +34,7 @@
#ident "$Copyright: (c) 1980, 1990 Regents of the University of California. $"
#ident "$Copyright: All rights reserved. $"
-#ident "$Id: quota.c,v 1.27 2008/04/21 15:37:42 jkar8572 Exp $"
+#ident "$Id: quota.c,v 1.28 2009/10/20 01:15:39 jkar8572 Exp $"
/*
* Disk quota reporting program.
@@ -112,11 +112,18 @@ void usage(void)
void heading(int type, qid_t id, char *name, char *tag)
{
+ char *spacehdr;
+
+ if (flags & FL_SMARTSIZE)
+ spacehdr = _("space");
+ else
+ spacehdr = _("blocks");
+
printf(_("Disk quotas for %s %s (%cid %u): %s\n"), type2name(type),
name, *type2name(type), (uint) id, tag);
if (!(flags & FL_QUIET) && !tag[0]) {
printf("%15s%8s %7s%8s%8s%8s %7s%8s%8s\n", _("Filesystem"),
- _("blocks"), _("quota"), _("limit"), _("grace"),
+ spacehdr,_("quota"), _("limit"), _("grace"),
_("files"), _("quota"), _("limit"), _("grace"));
}
}
diff --git a/quotasys.c b/quotasys.c
index 0f4c5aa..5132905 100644
--- a/quotasys.c
+++ b/quotasys.c
@@ -379,12 +379,15 @@ void space2str(qsize_t space, char *buf, int format)
char suffix[8] = " MGT";
space = qb2kb(space);
- if (format)
+ if (format) {
for (i = 3; i > 0; i--)
if (space >= (1LL << (QUOTABLOCK_BITS*i))*100) {
sprintf(buf, "%llu%c", (unsigned long long)(space+(1 << (QUOTABLOCK_BITS*i))-1) >> (QUOTABLOCK_BITS*i), suffix[i]);
return;
}
+ sprintf(buf, "%lluK", (unsigned long long)space);
+ return;
+ }
sprintf(buf, "%llu", (unsigned long long)space);
}
diff --git a/repquota.c b/repquota.c
index adcfa42..96a6322 100644
--- a/repquota.c
+++ b/repquota.c
@@ -284,12 +284,18 @@ static int output(struct dquot *dquot, char *name)
static void report_it(struct quota_handle *h, int type)
{
char bgbuf[MAXTIMELEN], igbuf[MAXTIMELEN];
+ char *spacehdr;
+
+ if (flags & FL_SHORTNUMS)
+ spacehdr = _("Space");
+ else
+ spacehdr = _("Block");
printf(_("*** Report for %s quotas on device %s\n"), type2name(type), h->qh_quotadev);
time2str(h->qh_info.dqi_bgrace, bgbuf, TF_ROUND);
time2str(h->qh_info.dqi_igrace, igbuf, TF_ROUND);
printf(_("Block grace time: %s; Inode grace time: %s\n"), bgbuf, igbuf);
- printf(_(" Block limits File limits\n"));
+ printf(_(" %s limits File limits\n"), spacehdr);
printf(_("%-9s used soft hard grace used soft hard grace\n"), (type == USRQUOTA)?_("User"):_("Group"));
printf("----------------------------------------------------------------------\n");