summaryrefslogtreecommitdiff
path: root/setquota.c
diff options
context:
space:
mode:
authorjkar8572 <jkar8572>2001-05-02 09:32:22 +0000
committerjkar8572 <jkar8572>2001-05-02 09:32:22 +0000
commit84ec12aa207cb8d5323b63847bfd8115881f2886 (patch)
tree9533951fedda68167081028741a9ec3fd8ad547b /setquota.c
parent9c4a512419c660c0513db48e038169167e3e7d25 (diff)
Added mntopt.h to dependencies in Makefile.in.
Fixed MNTTYPE_REISER to proper string. sprintf->snprintf Merged Marco's patch with errstr(), configurable BSD behaviour Fixed bug in quota detection IO code now opens file only RO if possible. IO code now doesn't open file if not required. Fixed bug in quotaon. Updated all manpages.
Diffstat (limited to 'setquota.c')
-rw-r--r--setquota.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/setquota.c b/setquota.c
index 4f27ca8..8721766 100644
--- a/setquota.c
+++ b/setquota.c
@@ -29,6 +29,7 @@
int flags, fmt = -1;
char **mnt;
+char *progname;
int mntcnt;
qid_t protoid, id;
struct util_dqblk toset;
@@ -37,30 +38,30 @@ struct util_dqblk toset;
static void usage(void)
{
#if defined(RPC_SETQUOTA)
- fprintf(stderr, _("Usage:\n"
+ errstr(_("Usage:\n"
" setquota [-u|-g] [-r] [-F quotaformat] <user|group>\n"
"\t<block-softlimit> <block-hardlimit> <inode-softlimit> <inode-hardlimit> -a|<filesystem>...\n"
" setquota [-u|-g] [-r] [-F quotaformat] <-p protouser|protogroup> <user|group> -a|<filesystem>...\n"
" setquota [-u|-g] [-F quotaformat] -t <blockgrace> <inodegrace> -a|<filesystem>...\n"));
#else
- fprintf(stderr, _("Usage:\n"
+ errstr(_("Usage:\n"
" setquota [-u|-g] [-F quotaformat] <user|group>\n"
"\t<block-softlimit> <block-hardlimit> <inode-softlimit> <inode-hardlimit> -a|<filesystem>...\n"
" setquota [-u|-g] [-F quotaformat] <-p protouser|protogroup> <user|group> -a|<filesystem>...\n"
" setquota [-u|-g] [-F quotaformat] -t <blockgrace> <inodegrace> -a|<filesystem>...\n"));
#endif
- fprintf(stderr, _("Bugs to: %s\n"), MY_EMAIL);
+ errstr(_("Bugs to: %s\n"), MY_EMAIL);
exit(1);
}
-/* Convert string to number - print error message in case of failure */
+/* Convert string to number - print errstr message in case of failure */
static long parse_num(char *str, char *msg)
{
char *errch;
long ret = strtol(str, &errch, 0);
if (*errch) {
- fprintf(stderr, _("Bad %s: %s\n"), msg, str);
+ errstr(_("Bad %s: %s\n"), msg, str);
usage();
}
return ret;
@@ -216,18 +217,22 @@ int main(int argc, char **argv)
struct quota_handle **handles;
gettexton();
+ progname = basename(argv[0]);
+
parse_options(argc, argv);
warn_new_kernel(fmt);
if (flags & FL_ALL)
- handles = create_handle_list(0, NULL, flag2type(flags), fmt, !(flags & FL_RPC));
+ handles = create_handle_list(0, NULL, flag2type(flags), fmt, (flags & FL_RPC) ? 0 : IOI_LOCALONLY);
else
- handles = create_handle_list(mntcnt, mnt, flag2type(flags), fmt, !(flags & FL_RPC));
+ handles = create_handle_list(mntcnt, mnt, flag2type(flags), fmt, (flags & FL_RPC) ? 0 : IOI_LOCALONLY);
if (flags & FL_GRACE)
setgraces(handles);
else
setlimits(handles);
+
dispose_handle_list(handles);
+
return 0;
}