Implemented a new option -q to avoid updating the progress information (Matthew Boyle)

The progress bars complexify the integration of ntfsclone into other
tools, the option -q (or --quiet) gets rid of them.
edge.strict_endians
Jean-Pierre André 2012-01-23 18:10:26 +01:00
parent cd0be288b9
commit 4a0892eb26
2 changed files with 12 additions and 1 deletions

View File

@ -233,6 +233,9 @@ option.
Forces ntfsclone to proceed if the filesystem is marked
"dirty" for consistency check.
.TP
\fB\-q\fR, \fB\-\-quiet\fR
Do not display any progress-bars during operation.
.TP
\fB\-h\fR, \fB\-\-help\fR
Show a list of options with a brief description of each one.
.SH EXIT CODES

View File

@ -317,6 +317,7 @@ static void usage(void)
" -m, --metadata Clone *only* metadata (for NTFS experts)\n"
" --ignore-fs-check Ignore the filesystem check result\n"
" -t, --preserve-timestamps Do not clear the timestamps\n"
" -q, --quiet Do not display any progress bars\n"
" -f, --force Force to progress (DANGEROUS)\n"
" -h, --help Display this help\n"
#ifdef DEBUG
@ -332,11 +333,12 @@ static void usage(void)
static void parse_options(int argc, char **argv)
{
static const char *sopt = "-dfhmo:O:rst";
static const char *sopt = "-dfhmo:O:qrst";
static const struct option lopt[] = {
#ifdef DEBUG
{ "debug", no_argument, NULL, 'd' },
#endif
{ "quiet", no_argument, NULL, 'q' },
{ "force", no_argument, NULL, 'f' },
{ "help", no_argument, NULL, 'h' },
{ "metadata", no_argument, NULL, 'm' },
@ -364,6 +366,9 @@ static void parse_options(int argc, char **argv)
case 'd':
opt.debug++;
break;
case 'q':
opt.quiet++;
break;
case 'f':
opt.force++;
break;
@ -499,6 +504,9 @@ static void progress_update(struct progress_bar *p, u64 current)
{
float percent = p->unit * current;
if (opt.quiet)
return;
if (current != p->stop) {
if ((current - p->start) % p->resolution)
return;