summaryrefslogtreecommitdiff
path: root/quot.c
diff options
context:
space:
mode:
authorjkar8572 <jkar8572>2003-12-12 15:14:23 +0000
committerjkar8572 <jkar8572>2003-12-12 15:14:23 +0000
commitdf68deb04b7802b9af0e7ac9e46a515cddd4feac (patch)
treefbbd5eea7033f2a28165b3572afc5e063ab6e721 /quot.c
parenta7c3f429fe0f41033c658e5df63a7ab16375d0e7 (diff)
Added option -T and -q to quot(8) utility (Andre Nathan)
Diffstat (limited to 'quot.c')
-rw-r--r--quot.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/quot.c b/quot.c
index 6fc737c..2184f80 100644
--- a/quot.c
+++ b/quot.c
@@ -68,6 +68,8 @@ static int gflag;
static int uflag;
static int vflag;
static int iflag;
+static int qflag;
+static int Tflag;
static time_t now;
char *progname;
@@ -78,7 +80,7 @@ static void creport(const char *, char *);
static void usage(void)
{
- errstr(_("Usage: %s [-acfugvVi] [filesystem...]\n"), progname);
+ errstr(_("Usage: %s [-acfugvViTq] [filesystem...]\n"), progname);
exit(1);
}
@@ -89,7 +91,7 @@ int main(int argc, char **argv)
now = time(0);
progname = basename(argv[0]);
- while ((c = getopt(argc, argv, "acfguvV")) != -1) {
+ while ((c = getopt(argc, argv, "acfguvVTq")) != -1) {
switch (c) {
case 'a':
aflag++;
@@ -112,6 +114,12 @@ int main(int argc, char **argv)
case 'i':
iflag++;
break;
+ case 'q':
+ qflag++;
+ break;
+ case 'T':
+ Tflag++;
+ break;
case 'V':
version();
exit(0);
@@ -187,7 +195,8 @@ static void report(const char *file, char *fsdir, int type)
du_t *dp;
printf(_("%s (%s) %s:\n"), file, fsdir, type? "groups" : "users");
- qsort(du[type], ndu[type], sizeof(du[type][0]), (int (*)(const void *, const void *))qcmp);
+ if (!qflag)
+ qsort(du[type], ndu[type], sizeof(du[type][0]), (int (*)(const void *, const void *))qcmp);
for (dp = du[type]; dp < &du[type][ndu[type]]; dp++) {
char *cp;
@@ -196,9 +205,12 @@ static void report(const char *file, char *fsdir, int type)
printf(_("%8llu "), (unsigned long long) dp->blocks);
if (fflag)
printf(_("%8llu "), (unsigned long long) dp->nfiles);
- if ((cp = idname(dp->id, type)) != NULL)
- printf(_("%-8.8s"), cp);
- else
+ if ((cp = idname(dp->id, type)) != NULL) {
+ if (Tflag)
+ printf(_("%s"), cp);
+ else
+ printf(_("%-8.8s"), cp);
+ } else
printf(_("#%-7d"), dp->id);
if (vflag)
printf(_(" %8llu %8llu %8llu"),