gbranden pushed a commit to branch master
in repository groff.

commit c1adec1a292f3d839eaf2ea61f05893d66c20d52
Author: G. Branden Robinson <[email protected]>
AuthorDate: Fri Mar 1 18:40:01 2024 -0600

    [troff]: Stop `mso` request from rewriting arg.
    
    [troff]: The `mso` request no longer rewrites its argument to search for
    a file other than that named in the argument.
    
    * src/roff/troff/input.cpp (do_macro_source): Drop logic that attempts
      to open a macro file named "tmac.s" if "s.tmac" was specified in the
      argument and not found, or vice versa.
    
    * NEWS:
    * doc/groff.texi.in (I/O):
    * man/groff_diff.7.man (New requests): Document it.
    
    See
    <https://lists.gnu.org/archive/html/groff/2024-02/msg00086.html>
    and follow-ups.
    
    I had already changed _some_ of the documentation, in the mistaken
    belief that this that was already the case, in commits f16b028093 (14
    February) and commit ce57681f23 (16 September).  It's consistent now
    (knock wood).
---
 ChangeLog                | 24 +++++++++++++++++-------
 NEWS                     |  9 +++++++++
 doc/groff.texi.in        |  6 ++----
 man/groff_diff.7.man     |  8 --------
 src/roff/troff/input.cpp | 25 -------------------------
 5 files changed, 28 insertions(+), 44 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index d319f1e6b..aded40439 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2024-03-01  G. Branden Robinson <[email protected]>
+
+       [troff]: `mso` request no longer rewrites its argument to search
+       for a file other than that named in the argument.
+
+       * src/roff/troff/input.cpp (do_macro_source): Drop logic that
+       attempts to open a macro file named "tmac.s" if "s.tmac" was
+       specified in the argument and not found, or vice versa.
+
+       * NEWS:
+       * doc/groff.texi.in (I/O):
+       * man/groff_diff.7.man (New requests): Document it.
+
+       See
+       <https://lists.gnu.org/archive/html/groff/2024-02/msg00086.html>
+       and follow-ups.
+
 2024-02-25  G. Branden Robinson <[email protected]>
 
        [mdoc]: Implement hyperlink support.
@@ -2489,13 +2506,6 @@
        Fixes <https://savannah.gnu.org/bugs/?64695>.  Thanks to
        Alexander Kanavin for the report.
 
-2023-09-16  G. Branden Robinson <[email protected]>
-
-       * doc/groff.texi (I/O) <mso, msoquiet>: Fix error.  These
-       requests do _not_ alter the argument in an attempt to locate
-       a file corresponding to it.  (That is, one says "groff -m trace"
-       but ".mso trace.tmac".)
-
 2023-09-16  G. Branden Robinson <[email protected]>
 
        * doc/doc.am (doc/webpage.ps, doc/webpage.html): Update and
diff --git a/NEWS b/NEWS
index 44c339510..d7330d5fa 100644
--- a/NEWS
+++ b/NEWS
@@ -13,6 +13,15 @@ VERSION next
 troff
 -----
 
+o The `mso` request no longer attempts to open a macro file named, say,
+  "tmac.s" if "s.tmac" was specified in the argument and not found, or
+  vice versa.  This feature was a convenience for some old AT&T troff
+  installations, but few of those remain in the field, and of those that
+  we know to survive, neither (DWB 3.3 and Solaris 10) uses a macro file
+  naming convention for which this feature is any help.  `mso` now
+  simply processes the macro search path for a file name matching the
+  request argument, and succeeds or fails depending on an exact match.
+
 o The `color`, `cp`, `linetabs`, and `vpt` requests now interpret
   arguments with negative values as instructions to disable the
   corresponding feature, using the *roff integer-to-Boolean conversion
diff --git a/doc/groff.texi.in b/doc/groff.texi.in
index e365c398f..1e83dc26e 100644
--- a/doc/groff.texi.in
+++ b/doc/groff.texi.in
@@ -464,7 +464,7 @@ Documentation License''.
 @title groff
 @subtitle The GNU implementation of @code{troff}
 @subtitle version @VERSION@
-@subtitle February 2024
+@subtitle March 2024
 @author Trent@tie{}A.@: Fisher
 @author Werner Lemberg
 @author G.@tie{}Branden Robinson
@@ -16192,9 +16192,7 @@ for @code{pso} also.
 Identical to the @code{so} and @code{soquiet} requests, respectively,
 except that @command{gtroff} searches for the specified @var{file} in
 the same directories as macro files for the @option{-m} command-line
-option.  Unlike that option, @var{file} must be the file name as it
-appears in the file system; these requests do not add a @file{.tmac}
-suffix or @file{tmac.} prefix to locate @var{file}.
+option.
 @endDefreq
 
 @DefreqList {trf, file}
diff --git a/man/groff_diff.7.man b/man/groff_diff.7.man
index 1e287d15d..a03d52c43 100644
--- a/man/groff_diff.7.man
+++ b/man/groff_diff.7.man
@@ -3029,14 +3029,6 @@ and
 command-line option are
 (the \[lq]tmac path\[rq]).
 .
-If the file name to be interpolated has the form
-.IB name .tmac
-and it isn't found,
-.B mso
-tries to include
-.BI tmac. name
-instead and vice versa.
-.
 If
 .I file
 does not exist,
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 6735b845c..4b157dfe1 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -8133,31 +8133,6 @@ void do_macro_source(bool quietly)
       tok.next();
     char *path;
     FILE *fp = mac_path->open_file(nm.contents(), &path);
-    // .mso cannot go through open_mac_file, which handles the -m option
-    // and expects only an identifier like "s" or "an", not a file name.
-    // We need to do it here manually: If we have tmac.FOOBAR, try
-    // FOOBAR.tmac and vice versa.
-    if (!fp) {
-      const char *fn = nm.contents();
-      size_t fnlen = strlen(fn);
-      if (strncasecmp(fn, MACRO_PREFIX, sizeof(MACRO_PREFIX) - 1) == 0) {
-       char *s = new char[fnlen + sizeof(MACRO_POSTFIX)];
-       strcpy(s, fn + sizeof(MACRO_PREFIX) - 1);
-       strcat(s, MACRO_POSTFIX);
-       fp = mac_path->open_file(s, &path);
-       delete[] s;
-      }
-      if (!fp) {
-       if (strncasecmp(fn + fnlen - sizeof(MACRO_POSTFIX) + 1,
-                       MACRO_POSTFIX, sizeof(MACRO_POSTFIX) - 1) == 0) {
-         char *s = new char[fnlen + sizeof(MACRO_PREFIX)];
-         strcpy(s, MACRO_PREFIX);
-         strncat(s, fn, fnlen - sizeof(MACRO_POSTFIX) + 1);
-         fp = mac_path->open_file(s, &path);
-         delete[] s;
-       }
-      }
-    }
     if (fp) {
       input_stack::push(new file_iterator(fp, symbol(path).contents()));
       free(path);

_______________________________________________
Groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit

Reply via email to