groff-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[groff] 01/01: Improve shell script portability in the hdtbl fonts examp


From: Ingo Schwarze
Subject: [groff] 01/01: Improve shell script portability in the hdtbl fonts examples.
Date: Thu, 6 Dec 2018 16:59:53 -0500 (EST)

schwarze pushed a commit to branch master
in repository groff.

commit ca9792570e2e907ffa89ee69a6167aa707e14ea4
Author: Ingo Schwarze <address@hidden>
Date:   Thu Dec 6 18:21:21 2018 +0100

    Improve shell script portability in the hdtbl fonts examples.
    
    1. POSIX requires "echo -n" to print "-n" followed by
       a newline character, so use printf(1) instead.
    2. According to POSIX, behaviour of tr(1) is undefined
       if string2 contains fewer characters than string1,
       and on Oracle Solaris, the excess characters in string1
       are not translated.  So make sure string2 contains
       a sufficient number of characters.
    
    OK bgarrigues@
---
 contrib/hdtbl/ChangeLog           | 12 ++++++++++++
 contrib/hdtbl/examples/fonts_n.in |  4 ++--
 contrib/hdtbl/examples/fonts_x.in |  4 ++--
 3 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/contrib/hdtbl/ChangeLog b/contrib/hdtbl/ChangeLog
index ecd7755..86ede58 100644
--- a/contrib/hdtbl/ChangeLog
+++ b/contrib/hdtbl/ChangeLog
@@ -1,3 +1,15 @@
+2018-12-06  Ingo Schwarze  <address@hidden>
+
+       * examples/fonts_n.in, examples/fonts_x.in:
+         Make the shell script in the .pso request more portable:
+         1. POSIX requires "echo -n" to print "-n" followed by
+            a newline character, so use printf(1) instead.
+         2. According to POSIX, behaviour of tr(1) is undefined
+            if string2 contains fewer characters than string1,
+            and on Oracle Solaris, the excess characters in string1
+            are not translated.  So make sure string2 contains
+            a sufficient number of characters.
+
 2018-08-09  Ingo Schwarze  <address@hidden>
 
        * examples/common.roff: Remove more dead code
diff --git a/contrib/hdtbl/examples/fonts_n.in 
b/contrib/hdtbl/examples/fonts_n.in
index 58f9acd..72b5d2f 100644
--- a/contrib/hdtbl/examples/fonts_n.in
+++ b/contrib/hdtbl/examples/fonts_n.in
@@ -52,9 +52,9 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>.
 .    ds *args \\n[.fn]
 .
 .  pso sh -c \
-       "echo -n .ds *f\ ; \
+       "printf '%s' '.ds *f ' ; \
         ls \\*[fontpath]/dev\*[.T] \
-        | tr '[:cntrl:]' ' '"
+        | tr '[:cntrl:]' '[ *32]'"
 .  \"  This dummy line is necessary; the preceding line eats it.
 .
 .  while !"\\*[*args]"" \{\
diff --git a/contrib/hdtbl/examples/fonts_x.in 
b/contrib/hdtbl/examples/fonts_x.in
index f036f81..a4f2eab 100644
--- a/contrib/hdtbl/examples/fonts_x.in
+++ b/contrib/hdtbl/examples/fonts_x.in
@@ -52,9 +52,9 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>.
 .    ds *args \\n[.fn]
 .
 .  pso sh -c \
-       "echo -n .ds *f\ ; \
+       "printf '%s' '.ds *f ' ; \
         ls \\*[fontpath]/dev\*[.T] \
-        | tr '[:cntrl:]' ' '"
+        | tr '[:cntrl:]' '[ *32]'"
 .  \"  This dummy line is necessary; the preceding line eats it.
 .
 .  while !"\\*[*args]"" \{\



reply via email to

[Prev in Thread] Current Thread [Next in Thread]