aboutsummaryrefslogtreecommitdiffstats
path: root/filters
diff options
context:
space:
mode:
authorTimon Reinold <tirei+aerc@agon.one>2024-07-16 16:25:41 +0200
committerRobin Jarry <robin@jarry.cc>2024-07-16 22:40:11 +0200
commita604acceac0fec4c3ba7bcb1923dcef73453cd1f (patch)
treee6d6ee509dbda74ab2c8f84c5ef593bcaa578b4c /filters
parentd13823b8f63a6383ca7a61434f5e57dc37f62f94 (diff)
downloadaerc-a604acceac0fec4c3ba7bcb1923dcef73453cd1f.tar.gz
calendar: fix error with non-gnu awk
Use the POSIX-specified function Awk keyword instead of the non-standard func to define the prepare function in the text/calendar filter. The GNU Awk manual[1] mentions that gawk supports abbreviating function to func, but recommends against using the func abbreviation, as POSIX only specifies function. On my system (Debian sid), gawk isn't installed and mawk (Debian priority "required", i.e. installed by default) provides /usr/bin/awk instead. mawk appears to not support the abbreviated func keyword. When viewing a text/calendar part, I only see the following: awk: /usr/libexec/aerc/filters/calendar: line 211: return outside function body Using the standardized function keyword allows mawk to parse the prepare function (including its return) and execute the script as intended. [1]: https://www.gnu.org/software/gawk/manual/html_node/Definition-Syntax.html (section 9.2.1 "Function Definition Syntax") Fixes: 0db924dc14a3 ("filters: fix calendar filter parsing") Changelog-fixed: Builtin `calendar` filter error with non-GNU Awk. Signed-off-by: Timon Reinold <tirei+aerc@agon.one> Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'filters')
-rwxr-xr-xfilters/calendar3
1 files changed, 2 insertions, 1 deletions
diff --git a/filters/calendar b/filters/calendar
index 8d7e67dc..aeddeadf 100755
--- a/filters/calendar
+++ b/filters/calendar
@@ -205,7 +205,8 @@ BEGIN {
}
}
-func prepare(line) {
+function prepare(line)
+{
gsub($1, "", line)
gsub(/^[: ]/, "", line)
return line