[parted-devel] [PATCH] Make ---pretend-input-tty inhibit output word-wrap.

Jim Meyering jim at meyering.net
Mon May 7 14:56:10 UTC 2007


Another tiny patch, for improved testability.
Without this patch, testing expected output against actual was
a royal pain, since I have to edit the expected output file to
match the wrapping performed by parted itself, and that depends
on "screen width".  With this change, using the ---pretend-input-tty
option disables the bothersome wrapping:

	Make ---pretend-input-tty inhibit output word-wrap.
	* parted/ui.c (screen_width): Use effectively-unlimited screen width
	with ---pretend-input-tty, just as for '--script' mode.

This probably breaks the existing tests, but, as I said, they're
about to be replaced wholesale with better ones.

Signed-off-by: Jim Meyering <jim at meyering.net>
---
 parted/ui.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/parted/ui.c b/parted/ui.c
index 25700ac..fb311e2 100644
--- a/parted/ui.c
+++ b/parted/ui.c
@@ -213,7 +213,7 @@ screen_width ()
 {
         int    width = 0;

-        if (opt_script_mode)
+        if (opt_script_mode || pretend_input_tty)
                 return 32768;    /* no wrapping ;) */

 /* HACK: don't specify termcap separately - it'll annoy the users. */



More information about the parted-devel mailing list