[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 12/35: [troff]: `nx` now accepts spacey file names.
From: |
G. Branden Robinson |
Subject: |
[groff] 12/35: [troff]: `nx` now accepts spacey file names. |
Date: |
Tue, 10 Dec 2024 16:35:33 -0500 (EST) |
gbranden pushed a commit to branch master
in repository groff.
commit 4812e5548ff21e24eaa516e719e950f6fa3fd204
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sat Dec 7 12:01:45 2024 -0600
[troff]: `nx` now accepts spacey file names.
The `nx` request now accepts leading and embedded spaces in its optional
"file" argument, similarly to `so`.
* src/roff/troff/input.cpp (next_file): Peek at the input stream for an
argument, and if there is one, gather it with `read_string()` (which
reads a potentially spaceful argument including a discardable leading
double quote), not `get_long_name()` (which reads a GNU troff
identifier).
* doc/groff.texi.in (I/O):
* man/groff.7.man (Request short reference):
* man/groff_diff.7.man (New requests): Document it.
* NEWS: Update existing items.
A more general revision to groff(7) will follow.
---
ChangeLog | 17 +++++++++++++++++
NEWS | 10 +++++-----
doc/groff.texi.in | 2 +-
man/groff_diff.7.man | 14 ++++++++++++++
src/roff/troff/input.cpp | 14 ++++++++------
5 files changed, 45 insertions(+), 12 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index f00413fec..60f42135b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2024-12-07 G. Branden Robinson <g.branden.robinson@gmail.com>
+
+ [troff]: The `nx` request now accepts leading and embedded
+ spaces in its optional "file" argument, similarly to `so`.
+
+ * src/roff/troff/input.cpp (next_file): Peek at the input stream
+ for an argument, and if there is one, gather it with
+ `read_string()` (which reads a potentially spaceful argument
+ including a discardable leading double quote), not
+ `get_long_name()` (which reads a GNU troff identifier).
+
+ * doc/groff.texi.in (I/O):
+ * man/groff.7.man (Request short reference):
+ * man/groff_diff.7.man (New requests): Document it.
+
+ * NEWS: Update existing items.
+
2024-12-07 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: The `hpf` and `hpfa` requests now accept leading and
diff --git a/NEWS b/NEWS
index d89d7c7a7..1eee9288e 100644
--- a/NEWS
+++ b/NEWS
@@ -57,13 +57,13 @@ troff
warning diagnostic in the "range" category.
* GNU troff now strips a leading neutral double quote from the argument
- to the `cf`, `hpf`, `hpfa`, `mso`, `msoquiet`, `pi`, `pso`, `so`,
- `soquiet`, `sy`, and `trf` requests, allowing it to contain embedded
- leading spaces.
+ to the `cf`, `hpf`, `hpfa`, `mso`, `msoquiet`, `nx`, `pi`, `pso`,
+ `so`, `soquiet`, `sy`, and `trf` requests, allowing it to contain
+ embedded leading spaces.
* GNU troff now accepts space characters in the argument to the `cf`,
- `hpf`, `hpfa`, `mso`, `msoquiet`, `so`, `soquiet`, `trf` requests.
- See "soelim" below.
+ `hpf`, `hpfa`, `mso`, `msoquiet`, `nx`, `so`, and `soquiet`
+ requests. See "soelim" below.
* The "el" warning category has been withdrawn. If enabled (which it
was not by default), the formatter would emit a diagnostic if it
diff --git a/doc/groff.texi.in b/doc/groff.texi.in
index 713e19570..a64cdf8a2 100644
--- a/doc/groff.texi.in
+++ b/doc/groff.texi.in
@@ -16377,7 +16377,7 @@ The calls to @code{ev} prevent the partially collected
output line
from becoming part of the diversion (@pxref{Diversions}).
@endDefreq
-@Defreq {nx, [@Var{file}]}
+@Defreq {nx, [[@code{"}]@Var{file}]}
@cindex read next file (@code{nx})
@cindex file, next, read (@code{nx})
@cindex next file, read (@code{nx})
diff --git a/man/groff_diff.7.man b/man/groff_diff.7.man
index cb153bb7e..57e1a6696 100644
--- a/man/groff_diff.7.man
+++ b/man/groff_diff.7.man
@@ -4139,6 +4139,20 @@ request is selected.
.
.
.TP
+.BR .nx\~ [[ \[dq] ]\c
+.IR file ]
+GNU
+.I troff \" GNU
+strips a leading neutral double quote from the optional argument,
+allowing it to contain embedded leading spaces.
+.
+Further,
+spaces in
+.I file
+are accepted as part of the file name.
+.
+.
+.TP
.BR .pi\~ [ \[dq] ]\c
.I command
GNU
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index e0066cdfa..f763f5047 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -911,18 +911,20 @@ void backtrace_request()
void next_file()
{
- symbol nm = get_long_name();
- while (!tok.is_newline() && !tok.is_eof())
+ char *filename = 0 /* nullptr */;
+ if (has_arg(true /* peek */)) {
+ filename = read_string();
tok.next();
- if (nm.is_null())
+ }
+ if (0 /* nullptr */ == filename)
input_stack::end_file();
else {
errno = 0;
- FILE *fp = include_search_path.open_file_cautious(nm.contents());
+ FILE *fp = include_search_path.open_file_cautious(filename);
if (0 /* nullptr */ == fp)
- error("cannot open '%1': %2", nm.contents(), strerror(errno));
+ error("cannot open '%1': %2", filename, strerror(errno));
else
- input_stack::next_file(fp, nm.contents());
+ input_stack::next_file(fp, filename);
}
tok.next();
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 12/35: [troff]: `nx` now accepts spacey file names.,
G. Branden Robinson <=