At 2025-02-24T02:44:35+0100, onf wrote:
> On Mon Feb 24, 2025 at 1:09 AM CET, G. Branden Robinson wrote:
> > [...]
> > diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
> > index 2656ff236..cf750bc73 100644
> > --- a/src/roff/troff/input.cpp
> > +++ b/src/roff/troff/input.cpp
> > @@ -6405,12 +6405,14 @@ void line_file()
> > {
> > int n;
> > if (get_integer(&n)) {
> > - const char *filename = 0 /* nullptr */;
> > if (has_arg()) {
> > - symbol s = get_long_name();
> > - filename = s.contents();
> > + const char *reported_file_name = read_string();
> > + (void) input_stack::set_location(reported_file_name, (n - 1));
> > + delete[] reported_file_name;
> > + tok.next();
> > + return;
> > }
> > - (void) input_stack::set_location(filename, (n - 1));
> > + (void) input_stack::set_location(0 /* nullptr */, (n - 1));
> > }
> > skip_line();
> > }
> >
> > [...]
> > Any objections to this being in my next push?
>
> Not really.
Full disclosure: I goofed.
> > if (has_arg()) {
Should become:
if (has_arg(true /* peek */)) {
(because we're going to switch to copy mode to read the input)
...which I didn't discover until I wrote a unit test for `lf`.
Those things really pay off. We should, like, tell people to write 'em.
Regards,
Branden
signature.asc
Description: PGP signature
