summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorShaun McCance <shaunm@gnome.org>2015-05-31 23:52:05 -0400
committerShaun McCance <shaunm@gnome.org>2015-05-31 23:52:05 -0400
commit529e23b8bb5357f33fef143564b0dac64186a177 (patch)
tree3c8163e0c1cf9b14d88973348e954a5450afb596 /tools
parent6286b53fe217657d527c5776dff177e15f6372a1 (diff)
downloadyelp-tools-529e23b8bb5357f33fef143564b0dac64186a177.tar.gz
yelp-build: Fix some broken and non-portable expr usage, #743911
Both `expr index` and `expr substr` are non-portable. What's more, my usage of `expr index` was wrong, and there was a bug that nobody ever seemed to trip up. Fix it and use portable stuff. Bug #743911 partially addressed.
Diffstat (limited to 'tools')
-rwxr-xr-xtools/yelp-build.in10
1 files changed, 4 insertions, 6 deletions
diff --git a/tools/yelp-build.in b/tools/yelp-build.in
index a38bbf8..aeb8e56 100755
--- a/tools/yelp-build.in
+++ b/tools/yelp-build.in
@@ -295,9 +295,8 @@ yelp_html_db2html () {
moutput="$html_out/$mfile"
mkdir_p `dirname "$moutput"`
if [ ! -f "$minput" -a "x$html_paths" != "x" ]; then
- if [ $(expr index "$minput" "$(pwd)/") = 1 ]; then
- minput_rel=$(expr substr "$minput" \
- $(expr length "$(pwd)//") $(expr length "$minput"))
+ minput_rel=${minput#"$(pwd)/"}
+ if [ "x$minput_rel" != "x$minput_src" ]; then
for path in $html_paths; do
if [ -f "$path/$minput_rel" ]; then
minput="$path/$minput_rel"
@@ -434,9 +433,8 @@ yelp_html_mal2html () {
line_dest="$html_out/"`echo "$line" | cut -d' ' -f2`
fi
if [ ! -f "$line_src" -a "x$html_paths" != "x" ]; then
- if [ $(expr index "$line_src" "$(pwd)/") = 1 ]; then
- line_src_rel=$(expr substr "$line_src" \
- $(expr length "$(pwd)//") $(expr length "$line_src"))
+ line_src_rel=${line_src#"$(pwd)/"}
+ if [ "x$line_src_rel" != "x$line_src" ]; then
for path in $html_paths; do
if [ -f "$path/$line_src_rel" ]; then
line_src="$path/$line_src_rel"