Align the -t implementation with the Heirloom project.
* src/ptx.c (usage): Describe -t, and also mention
the default width is 72 when not used.
* doc/coreutils.texi (ptx invocation): Likewise.
(main): Override the default width if -t is specified.
* tests/ptx/ptx.pl: Add test cases.
* NEWS: Mention the change in behavior.
** Changes in behavior
+ 'ptx' -t is no longer a no-op, and now sets the default width to 100 columns.
+
'timeout' now honors ignored signals and will not propagate them. E.g.,
timeout(1) in a shell backgrounded job, will not terminate upon receiving
SIGINT or SIGQUIT, as these are ignored by default in shell background jobs.
Select the size of the minimum white space gap between the fields on the
output line.
+@optItem{ptx,-t,}
+@optItemx{ptx,--typeset-mode,}
+Prepare the output for a phototypesetter.
+I.e., change the default output width from 72 to 100 columns.
+This is equivalent to @option{--width=100}.
+
@optItem{ptx,-w,@w{ }@var{number}}
@optItemx{ptx,--width,=@var{number}}
Select the maximum output width of each final line. If references are
static bool auto_reference = false; /* refs are 'file_name:line_number:' */
static bool input_reference = false; /* refs at beginning of input lines */
static bool right_reference = false; /* output refs after right context */
-static idx_t line_width = 72; /* output line width in characters */
+static idx_t line_width = -1; /* output line width in characters */
static idx_t gap_size = 3; /* number of spaces between output fields */
static char const *truncation_string = "/";
/* string used to mark line truncations */
"), stdout);
fputs (_("\
-r, --references first field of each line is a reference\n\
- -t, --typeset-mode - not implemented -\n\
+ -t, --typeset-mode change the default width from 72 to 100\n\
-w, --width=NUMBER output width in columns, reference excluded\n\
"), stdout);
fputs (HELP_OPTION_DESCRIPTION, stdout);
break;
case 't':
- /* Yet to understand... */
+ if (line_width < 0)
+ line_width = 100;
break;
case 'w':
}
}
+ if (line_width < 0)
+ line_width = 72;
+
/* Process remaining arguments. If GNU extensions are enabled, process
all arguments as input parameters. If disabled, accept at most two
arguments, the second of which is an output parameter. */
["1tok", '-w10', {IN=>"bar\n"}, {OUT=>" bar\n"}],
["2tok", '-w10', {IN=>"foo bar\n"}, {OUT=>" / bar\n foo/\n"}],
+# Ensure -w overrides -t
+["width-1", '-t -w10', {IN=>"bar\n"}, {OUT=>" " x 8 . "bar\n"}],
+# Ensure default width is 72
+["width-3", '', {IN=>"bar\n"}, {OUT=>" " x 39 . "bar\n"}],
+# Ensure default width is 100 with -t
+["width-2", '-t', {IN=>"bar\n"}, {OUT=>" " x 53 . "bar\n"}],
+
# with coreutils-6.12 and earlier, this would infloop with -wN, N < 10
["narrow", '-w2', {IN=>"qux\n"}, {OUT=>" qux\n"}],
["narrow-g", '-g1 -w2', {IN=>"ta\n"}, {OUT=>" ta\n"}],