schwarze pushed a commit to branch master
in repository groff.
commit ca9792570e2e907ffa89ee69a6167aa707e14ea4
Author: Ingo Schwarze <[email protected]>
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 <[email protected]>
+
+ * 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 <[email protected]>
* 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]"" \{\
_______________________________________________
Groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit