diff options
author | jkar8572 <jkar8572> | 2005-03-10 16:20:44 +0000 |
---|---|---|
committer | jkar8572 <jkar8572> | 2005-03-10 16:20:44 +0000 |
commit | 0e56cfc7e38ee2304257ff0afb631fee6e953bf7 (patch) | |
tree | 90626e1f2381f5e9180635626b4424d11718ff18 | |
parent | 4a2a9227184822676224b51c300832ed5e8f683a (diff) |
Added "very verbose" option to quotacheck(8) for printing the current directory (Jan Kara, Jan Engelhardt)
-rw-r--r-- | Changelog | 1 | ||||
-rw-r--r-- | quotacheck.8 | 1 | ||||
-rw-r--r-- | quotacheck.c | 29 | ||||
-rw-r--r-- | quotacheck.h | 1 |
4 files changed, 23 insertions, 9 deletions
@@ -1,4 +1,5 @@ Changes in quota-tools from 3.12 to 3.13 +* added printing of directories to quotacheck (Jan Kara, Jan Engelhardt) * added dynamic mountpoint array allocation (Jan Kara) * made quotacheck(8) more friendly for journaled quota (Jan Kara) * changed configure to detect whether nls is needed (Tomasz Kloczko, Jan Kara) diff --git a/quotacheck.8 b/quotacheck.8 index 470c2f2..10190f7 100644 --- a/quotacheck.8 +++ b/quotacheck.8 @@ -78,6 +78,7 @@ to make backups of the quota file before writing the new data. .B \-v .B quotacheck reports its operation as it progresses. Normally it operates silently. +If the option is specified twice, also the current directory is printed. .TP .B \-d Enable debugging mode. It will result in a lot of information which can diff --git a/quotacheck.c b/quotacheck.c index 0e691b5..7d63ace 100644 --- a/quotacheck.c +++ b/quotacheck.c @@ -8,7 +8,7 @@ * New quota format implementation - Jan Kara <jack@suse.cz> - Sponsored by SuSE CR */ -#ident "$Id: quotacheck.c,v 1.42 2004/09/20 07:46:50 jkar8572 Exp $" +#ident "$Id: quotacheck.c,v 1.43 2005/03/10 16:20:45 jkar8572 Exp $" #include <dirent.h> #include <stdio.h> @@ -267,13 +267,17 @@ static loff_t getqsize(char *fname, struct stat *st) /* * Show a blitting cursor as means of visual progress indicator. */ -static inline void blit(void) +static inline void blit(char *msg) { static short bitc = 0; static const char bits[] = "|/-\\"; - putc(bits[bitc], stdout); - putc('\b', stdout); + if (flags & FL_VERYVERBOSE && msg) { + putchar('\r'); + printf("%-70s ", msg); + } + putchar(bits[bitc]); + putchar('\b'); fflush(stdout); bitc++; bitc %= BITS_SIZE; @@ -306,7 +310,10 @@ static void parse_options(int argcnt, char **argstr) setlinebuf(stderr); break; case 'v': - flags |= FL_VERBOSE; + if (flags & FL_VERBOSE) + flags |= FL_VERYVERBOSE; + else + flags |= FL_VERBOSE; break; case 'f': flags |= FL_FORCE; @@ -404,7 +411,7 @@ static int ext2_direct_scan(char *device) if (inode.i_links_count) { debug(FL_DEBUG, _("Found i_num %ld, blocks %ld\n"), (long)i_num, (long)inode.i_blocks); if (flags & FL_VERBOSE) - blit(); + blit(NULL); uid = inode.i_uid | (inode.i_uid_high << 16); gid = inode.i_gid | (inode.i_gid_high << 16); if (inode.i_uid_high | inode.i_gid_high) @@ -463,11 +470,13 @@ static int scan_dir(char *pathname) die(2, _("\nCan open directory %s: %s\n"), pathname, strerror(errno)); chdir(pathname); + if (flags & FL_VERYVERBOSE) + blit(pathname); while ((de = readdir(dp)) != (struct dirent *)NULL) { if (!strcmp(de->d_name, ".") || !strcmp(de->d_name, "..")) continue; if (flags & FL_VERBOSE) - blit(); + blit(NULL); if ((lstat(de->d_name, &st)) == -1) { errstr(_("lstat Cannot stat `%s/%s': %s\nGuess you'd better run fsck first !\nexiting...\n"), @@ -821,7 +830,7 @@ static void check_dir(struct mntent *mnt) if (lstat(mnt->mnt_dir, &st) < 0) die(2, _("Cannot stat mountpoint %s: %s\n"), mnt, strerror(errno)); if (!S_ISDIR(st.st_mode)) - die(2, _("Mountpoint %s isn't directory?!\n"), mnt); + die(2, _("Mountpoint %s isn't a directory?!\n"), mnt); cur_dev = st.st_dev; files_done = dirs_done = 0; if (ucheck) @@ -864,6 +873,8 @@ Please stop all programs writing to filesystem or use -m flag to force checking. #else if (mnt->mnt_dir) { #endif + if (flags & FL_VERYVERBOSE) + putchar('\n'); if (scan_dir(mnt->mnt_dir) < 0) goto out; } @@ -877,7 +888,7 @@ Please stop all programs writing to filesystem or use -m flag to force checking. sub_quota_file(mnt, GRPQUOTA, GRPQUOTA); } if (flags & FL_VERBOSE) - fputs(_("done\n"), stderr); + fputs(_("done\n"), stdout); debug(FL_DEBUG | FL_VERBOSE, _("Checked %d directories and %d files\n"), dirs_done, files_done); if (remounted) { diff --git a/quotacheck.h b/quotacheck.h index 09a5c09..10ac6d1 100644 --- a/quotacheck.h +++ b/quotacheck.h @@ -25,6 +25,7 @@ #define FL_ALL 256 /* Scan all mountpoints with quota? */ #define FL_NOROOT 512 /* Scan all mountpoints except root */ #define FL_BACKUPS 1024 /* Create backup of old quota file? */ +#define FL_VERYVERBOSE 2048 /* Print directory names when checking */ extern int flags; /* Options from command line */ extern struct util_dqinfo old_info[MAXQUOTAS]; /* Loaded info from file */ |