diff options
author | jkar8572 <jkar8572> | 2001-11-05 07:43:09 +0000 |
---|---|---|
committer | jkar8572 <jkar8572> | 2001-11-05 07:43:09 +0000 |
commit | e3cd20e7ae77e71cd859b09849c1f68e57f9f580 (patch) | |
tree | 7d1f3987cb23fbf6b31ed11759606bb9d3d4924f /repquota.c | |
parent | 4b6e612eec355fda234e7957e08d943eb6872813 (diff) | |
download | linuxquota-e3cd20e7ae77e71cd859b09849c1f68e57f9f580.tar.gz |
Added -n option (don't resolve names) to repquota (not tested)
Diffstat (limited to 'repquota.c')
-rw-r--r-- | repquota.c | 19 |
1 files changed, 16 insertions, 3 deletions
@@ -30,6 +30,7 @@ #define FL_ALL 8 #define FL_TRUNCNAMES 16 #define FL_SHORTNUMS 32 +#define FL_NONAME 64 int flags, fmt = -1; char **mnt; @@ -40,7 +41,7 @@ char *progname; static void usage(void) { - errstr(_("Utility for reporting quotas.\nUsage:\n%s [-vugts] [-F quotaformat] (-a | mntpoint)\n"), progname); + errstr(_("Utility for reporting quotas.\nUsage:\n%s [-vugs] [-t|n] [-F quotaformat] (-a | mntpoint)\n"), progname); fprintf(stderr, _("Bugs to %s\n"), MY_EMAIL); exit(1); } @@ -55,7 +56,7 @@ static void parse_options(int argcnt, char **argstr) else slash++; - while ((ret = getopt(argcnt, argstr, "VavughtsF:")) != -1) { + while ((ret = getopt(argcnt, argstr, "VavughtsnF:")) != -1) { switch (ret) { case '?': case 'h': @@ -85,6 +86,9 @@ static void parse_options(int argcnt, char **argstr) if ((fmt = name2fmt(optarg)) == QF_ERROR) exit(1); break; + case 'n': + flags |= FL_NONAME; + break; } } @@ -97,6 +101,10 @@ static void parse_options(int argcnt, char **argstr) fputs(_("Repquota can't report through RPC calls.\n"), stderr); exit(1); } + if (flags & FL_NONAME && flags & FL_TRUNCNAMES) { + fputs(_("Specified both -n and -t but only one of them can be used.\n"), stderr); + exit(1); + } if (!(flags & (FL_USER | FL_GROUP))) flags |= FL_USER; if (!(flags & FL_ALL)) { @@ -184,8 +192,13 @@ static void dump_cached_dquots(int type) static int output(struct dquot *dquot, char *name) { + if (flags & FL_NONAME) { + char namebuf[MAXNAMELEN]; - if (name) + sprintf(namebuf, "#%u", dquot->dq_id); + print(dquot, namebuf); + } + else if (name) print(dquot, name); else { memcpy(dquot_cache+cached_dquots++, dquot, sizeof(struct dquot)); |