(Resending to the list. Sorry about that...)
On 09/11/11 07:13, Jean-Pierre André wrote:
You also need to add a 'q' to sopt for the new option
to be effective :
- static const char *sopt = "-dfhmo:O:rst";
+ static const char *sopt = "-dfhmo:O:qrst";
Ah yes, well spotted! I've been testing with --quiet rather than -q
+#ifdef HAVE_UNISTD_H
+ /* avoid showing a progress-bar unless it's being sent to a terminal */
+ if (!isatty(fileno(msg_out)))
+ opt.quiet++;
+#endif
This is not desirable : it would prevent an application
relying on ntfsclone to display a progress bar in its GUI.
Fair enough, I hadn't considered that as a use case. I only added that
as an afterthought anyway, so I'm not concerned about removing it :-)
I have attached an updated patch containing these changes, and the
documentation (manpage and --help output) you requested in your previous
email.
Regards,
--Matt
--
Matthew Boyle, Systems Administrator, CoreFiling Limited
Telephone: +44-1865-203192 Website: http://www.corefiling.com
diff --git a/ntfsprogs/ntfsclone.8.in b/ntfsprogs/ntfsclone.8.in
index 031578f..b7f44b4 100644
--- a/ntfsprogs/ntfsclone.8.in
+++ b/ntfsprogs/ntfsclone.8.in
@@ -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
diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c
index 7d56cc6..de99d44 100644
--- a/ntfsprogs/ntfsclone.c
+++ b/ntfsprogs/ntfsclone.c
@@ -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;
------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
ntfs-3g-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ntfs-3g-devel