From df68deb04b7802b9af0e7ac9e46a515cddd4feac Mon Sep 17 00:00:00 2001 From: jkar8572 Date: Fri, 12 Dec 2003 15:14:23 +0000 Subject: Added option -T and -q to quot(8) utility (Andre Nathan) --- Changelog | 4 ++++ quot.8 | 6 ++++++ quot.c | 24 ++++++++++++++++++------ 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/Changelog b/Changelog index 7263e5c..097edd3 100644 --- a/Changelog +++ b/Changelog @@ -1,3 +1,7 @@ +Changes in quota-tools form 3.10 to 3.11 +* added -T flag to quot(8) to avoid truncation of names (Andre Nathan) +* added -q flag to quot(8) to avoid sorting of names (Andre Nathan) + Changes in quota-tools from 3.09 to 3.10 * alternative port can be specified to rpc.rquotad by -p option (Jan Kara) * Fixed processing of device-backed loop mounts (Jari Ruusu) diff --git a/quot.8 b/quot.8 index f8fa801..25dfcd2 100644 --- a/quot.8 +++ b/quot.8 @@ -39,6 +39,12 @@ the last 30, 60, and 90 days. .TP .B \-i Ignore mountpoints mounted by automounter. +.TP +.B \-T +Avoid truncation of user names longer than 8 characters. +.TP +.B \-q +Do not sort the output. .SH FILES .PD 0 .TP 20 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"), -- cgit v1.2.3