From 678a130358ee3a83c4e6427b940abc2db5bd2b5a Mon Sep 17 00:00:00 2001
From: Evgeny Grin <k2k@narod.ru>
Date: Fri, 19 May 2023 18:29:56 +0300
Subject: [PATCH 3/3] Replaced unportable 'inplace' sed command
'-i' sed option is not portable, not specified by POSIX and does not
work on same platforms.
Replaced with simple and obvious workarounds.
Signed-off-by: Karlson2k (Evgeny Grin) <k2k@narod.ru>
---
Makefile.am | 40 ++++++++++++++++++++++---------------
configure.ac | 3 ++-
maint/utils/update-years.sh | 3 ++-
3 files changed, 28 insertions(+), 18 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 951243e4a..ec5b4dc3b 100644
a
|
b
|
CPPCHECK_SED_FILTER = \ |
65 | 65 | -e "/Skipping configuration '.*' since the value of '.*' is unknown./d" |
66 | 66 | |
67 | 67 | cppcheck: |
68 | | $(CPPCHECK_CMD) --enable=all $(CPPCHECK_DIRS) 2>$(CPPCHECK_OUT_PREFIX)all.$(CPPCHECK_OUT_EXT); |
69 | | $(SED) -i $(CPPCHECK_SED_FILTER) $(CPPCHECK_OUT_PREFIX)all.$(CPPCHECK_OUT_EXT) |
| 68 | $(CPPCHECK_CMD) --enable=all $(CPPCHECK_DIRS) 2>$(CPPCHECK_OUT_PREFIX)all.$(CPPCHECK_OUT_EXT).tmp; |
| 69 | $(SED) $(CPPCHECK_SED_FILTER) $(CPPCHECK_OUT_PREFIX)all.$(CPPCHECK_OUT_EXT).tmp > $(CPPCHECK_OUT_PREFIX)all.$(CPPCHECK_OUT_EXT) |
| 70 | rm -f $(CPPCHECK_OUT_PREFIX)all.$(CPPCHECK_OUT_EXT).tmp |
70 | 71 | |
71 | 72 | cppcheck-all: cppcheck |
72 | 73 | |
73 | 74 | cppcheck-information: |
74 | | $(CPPCHECK_CMD) --enable=information $(CPPCHECK_DIRS) 2>$(CPPCHECK_OUT_PREFIX)information.$(CPPCHECK_OUT_EXT); |
75 | | $(SED) -i $(CPPCHECK_SED_FILTER) $(CPPCHECK_OUT_PREFIX)information.$(CPPCHECK_OUT_EXT) |
| 75 | $(CPPCHECK_CMD) --enable=information $(CPPCHECK_DIRS) 2>$(CPPCHECK_OUT_PREFIX)information.$(CPPCHECK_OUT_EXT).tmp; |
| 76 | $(SED) $(CPPCHECK_SED_FILTER) $(CPPCHECK_OUT_PREFIX)information.$(CPPCHECK_OUT_EXT).tmp > $(CPPCHECK_OUT_PREFIX)information.$(CPPCHECK_OUT_EXT) |
| 77 | rm -f $(CPPCHECK_OUT_PREFIX)all.$(CPPCHECK_OUT_EXT).tmp |
76 | 78 | |
77 | 79 | cppcheck-performance: |
78 | | $(CPPCHECK_CMD) --enable=performance $(CPPCHECK_DIRS) 2>$(CPPCHECK_OUT_PREFIX)performance.$(CPPCHECK_OUT_EXT); |
79 | | $(SED) -i $(CPPCHECK_SED_FILTER) $(CPPCHECK_OUT_PREFIX)performance.$(CPPCHECK_OUT_EXT) |
| 80 | $(CPPCHECK_CMD) --enable=performance $(CPPCHECK_DIRS) 2>$(CPPCHECK_OUT_PREFIX)performance.$(CPPCHECK_OUT_EXT).tmp; |
| 81 | $(SED) $(CPPCHECK_SED_FILTER) $(CPPCHECK_OUT_PREFIX)performance.$(CPPCHECK_OUT_EXT).tmp > $(CPPCHECK_OUT_PREFIX)performance.$(CPPCHECK_OUT_EXT) |
| 82 | rm -f $(CPPCHECK_OUT_PREFIX)performance.$(CPPCHECK_OUT_EXT).tmp |
80 | 83 | |
81 | 84 | cppcheck-portability: |
82 | | $(CPPCHECK_CMD) --enable=portability $(CPPCHECK_DIRS) 2>$(CPPCHECK_OUT_PREFIX)portability.$(CPPCHECK_OUT_EXT); |
83 | | $(SED) -i $(CPPCHECK_SED_FILTER) $(CPPCHECK_OUT_PREFIX)portability.$(CPPCHECK_OUT_EXT) |
| 85 | $(CPPCHECK_CMD) --enable=portability $(CPPCHECK_DIRS) 2>$(CPPCHECK_OUT_PREFIX)portability.$(CPPCHECK_OUT_EXT).tmp; |
| 86 | $(SED) $(CPPCHECK_SED_FILTER) $(CPPCHECK_OUT_PREFIX)portability.$(CPPCHECK_OUT_EXT).tmp > $(CPPCHECK_OUT_PREFIX)portability.$(CPPCHECK_OUT_EXT) |
| 87 | rm -f $(CPPCHECK_OUT_PREFIX)portability.$(CPPCHECK_OUT_EXT).tmp |
84 | 88 | |
85 | 89 | cppcheck-style: |
86 | | $(CPPCHECK_CMD) --enable=style $(CPPCHECK_DIRS) 2>$(CPPCHECK_OUT_PREFIX)style.$(CPPCHECK_OUT_EXT); |
87 | | $(SED) -i $(CPPCHECK_SED_FILTER) $(CPPCHECK_OUT_PREFIX)style.$(CPPCHECK_OUT_EXT) |
| 90 | $(CPPCHECK_CMD) --enable=style $(CPPCHECK_DIRS) 2>$(CPPCHECK_OUT_PREFIX)style.$(CPPCHECK_OUT_EXT).tmp; |
| 91 | $(SED) $(CPPCHECK_SED_FILTER) $(CPPCHECK_OUT_PREFIX)style.$(CPPCHECK_OUT_EXT).tmp > $(CPPCHECK_OUT_PREFIX)style.$(CPPCHECK_OUT_EXT) |
| 92 | rm -f $(CPPCHECK_OUT_PREFIX)style.$(CPPCHECK_OUT_EXT).tmp |
88 | 93 | |
89 | 94 | cppcheck-warning: |
90 | | $(CPPCHECK_CMD) --enable=warning $(CPPCHECK_DIRS) 2>$(CPPCHECK_OUT_PREFIX)warning.$(CPPCHECK_OUT_EXT); |
91 | | $(SED) -i $(CPPCHECK_SED_FILTER) $(CPPCHECK_OUT_PREFIX)warning.$(CPPCHECK_OUT_EXT) |
| 95 | $(CPPCHECK_CMD) --enable=warning $(CPPCHECK_DIRS) 2>$(CPPCHECK_OUT_PREFIX)warning.$(CPPCHECK_OUT_EXT).tmp; |
| 96 | $(SED) $(CPPCHECK_SED_FILTER) $(CPPCHECK_OUT_PREFIX)warning.$(CPPCHECK_OUT_EXT).tmp > $(CPPCHECK_OUT_PREFIX)warning.$(CPPCHECK_OUT_EXT) |
| 97 | rm -f $(CPPCHECK_OUT_PREFIX)warning.$(CPPCHECK_OUT_EXT).tmp |
92 | 98 | |
93 | 99 | cppcheck-unusedFunction: |
94 | | $(CPPCHECK_CMD) --enable=unusedFunction $(CPPCHECK_DIRS) 2>$(CPPCHECK_OUT_PREFIX)unusedFunction.$(CPPCHECK_OUT_EXT); |
95 | | $(SED) -i $(CPPCHECK_SED_FILTER) $(CPPCHECK_OUT_PREFIX)unusedFunction.$(CPPCHECK_OUT_EXT) |
| 100 | $(CPPCHECK_CMD) --enable=unusedFunction $(CPPCHECK_DIRS) 2>$(CPPCHECK_OUT_PREFIX)unusedFunction.$(CPPCHECK_OUT_EXT).tmp; |
| 101 | $(SED) $(CPPCHECK_SED_FILTER) $(CPPCHECK_OUT_PREFIX)unusedFunction.$(CPPCHECK_OUT_EXT).tmp > $(CPPCHECK_OUT_PREFIX)unusedFunction.$(CPPCHECK_OUT_EXT) |
| 102 | rm -f $(CPPCHECK_OUT_PREFIX)unusedFunction.$(CPPCHECK_OUT_EXT).tmp |
96 | 103 | |
97 | 104 | cppcheck-missingInclude: |
98 | | $(CPPCHECK_CMD) --enable=missingInclude $(CPPCHECK_DIRS) 2>$(CPPCHECK_OUT_PREFIX)missingInclude.$(CPPCHECK_OUT_EXT); |
99 | | $(SED) -i $(CPPCHECK_SED_FILTER) $(CPPCHECK_OUT_PREFIX)missingInclude.$(CPPCHECK_OUT_EXT) |
| 105 | $(CPPCHECK_CMD) --enable=missingInclude $(CPPCHECK_DIRS) 2>$(CPPCHECK_OUT_PREFIX)missingInclude.$(CPPCHECK_OUT_EXT).tmp; |
| 106 | $(SED) $(CPPCHECK_SED_FILTER) $(CPPCHECK_OUT_PREFIX)missingInclude.$(CPPCHECK_OUT_EXT).tmp > $(CPPCHECK_OUT_PREFIX)missingInclude.$(CPPCHECK_OUT_EXT) |
| 107 | rm -f $(CPPCHECK_OUT_PREFIX)missingInclude.$(CPPCHECK_OUT_EXT).tmp |
100 | 108 | |
101 | 109 | cppcheck-split-all: \ |
102 | 110 | cppcheck-information \ |
diff --git a/configure.ac b/configure.ac
index 90934491c..36912dd94 100644
a
|
b
|
po/Makefile.in |
708 | 708 | |
709 | 709 | dnl https://stackoverflow.com/questions/30897170/ac-subst-does-not-expand-variable/30932102#30932102 |
710 | 710 | AC_CONFIG_FILES( |
711 | | [misc/syntax/Syntax], [${SED-sed} -i -e "s%\${prefix}%$PREFIX%" misc/syntax/Syntax], [export PREFIX=$prefix] |
| 711 | [misc/syntax/Syntax], [${SED-sed} -e "s%\${prefix}%$PREFIX%" misc/syntax/Syntax > misc/syntax/Syntax.tmp && \ |
| 712 | mv -f misc/syntax/Syntax.tmp misc/syntax/Syntax], [export PREFIX=$prefix] |
712 | 713 | ) |
713 | 714 | |
714 | 715 | AC_CONFIG_FILES([ |
diff --git a/maint/utils/update-years.sh b/maint/utils/update-years.sh
index 7370d2559..b14b128f7 100755
a
|
b
|
for i in "$SOURCES"; do |
19 | 19 | done |
20 | 20 | |
21 | 21 | # special case |
22 | | ${SED-sed} -i -e "/$LINE/s/-[0-9]\{4\} the/-$YEAR the/" src/editor/editwidget.c |
| 22 | ${SED-sed} -e "/$LINE/s/-[0-9]\{4\} the/-$YEAR the/" src/editor/editwidget.c > src/editor/editwidget.c.tmp && \ |
| 23 | mv -f src/editor/editwidget.c.tmp src/editor/editwidget.c |