~q3cpma/sxiv-manga-reader

fec36ab0f3b7de8b2d95836c8d17e62a7d8517b7 — q3cpma 1 year, 5 months ago 5b1f78f master
Fix AWK RE escaping (was using mawk, which did things differently, I guess)
2 files changed, 8 insertions(+), 2 deletions(-)

M sxiv-manga-reader
M util.sh
M sxiv-manga-reader => sxiv-manga-reader +2 -2
@@ 103,11 103,11 @@ nav()
		} | "$sort"
	fi | case "$1" in
		next)
			awk -vre="(/|^)$(ere_escape "${2##*/}")\$" '
			awk -vre="(/|^)$(awk_re_escape "${2##*/}")\$" '
				match($0, re) {if (getline == 1) print; exit}'
			;;
		prev)
			awk -vre="(/|^)$(ere_escape "${2##*/}")\$" '
			awk -vre="(/|^)$(awk_re_escape "${2##*/}")\$" '
				match($0, re) {if (prev) print prev; exit}; {prev = $0}'
			;;
		first)

M util.sh => util.sh +6 -0
@@ 152,6 152,12 @@ ere_escape()
	pecho "$1" | sed 's#[()|{}+?[^$*.\\-]#\\&#g'
}

# Escape all BRE metacharacters in $1
awk_re_escape()
{
	pecho "$1" | sed 's#[()|{}+?[^$*.\\-]#\\\\&#g'
}

# Escape all sed substitute metacharacters in $1
sed_repl_escape()
{