config

OpenBSD system configuration
git clone git://jacobedwards.org/config
Log | Files | Refs | README

commit 0bf0f5c4775e3029d3cee84a02e00dc86d5c1454
parent f5f74247e4048567bc4bc72c87015e5749c8a35f
Author: Jacob R. Edwards <n/a>
Date:   Mon,  5 Dec 2022 22:56:30 -0600

Improvements for sfeed_curses

Comment processing is done with the nocomment script. Also, further
configuration validation and processing is done with awk(1) instead
of sed now, which keeps it from being too clever. (Clever in a bad
way).

Diffstat:
Mlocal/bin/bin/sfeed_curses | 31++++++++++++++++---------------
1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/local/bin/bin/sfeed_curses b/local/bin/bin/sfeed_curses @@ -2,26 +2,27 @@ # Copyright 2022 Jacob R. Edwards # Allow configuration file for sfeed_curses -IFS=' -' - -getargs() sed '/[ ]*#/d -s/[ ]+#.*// -/=/ ! { - i\ -sh\ --c\ -echo "Invalid sfeed_curses config (not an assignment)" 1>&2; exit 1\ - - q +getargs() { + nocomment "$@" | awk '! /=/ { + print "Invalid sfeed_curses config (not an assignment)" > "/dev/stderr" + exit 1 + } + 1 { + gsub("\\$HOME", ENVIRON["HOME"], $0); + print + }' } -s!\$HOME!'"$HOME"'!g' "$@" + +IFS=' +' rc="$HOME"/.sfeed/sfeed_cursesrc s="$(whereis sfeed_curses)" +set -e + test $# -eq 0 && set -- ${sfeedpath:-"$HOME"/.sfeed/feeds}/* test -f "$rc" && - exec env $(getargs "$rc") "$s" "$@" -exec "$s" "$@" + args="$(getargs "$rc")" +exec env $args "$s" "$@"