commit 9d4e3c762f0742f26d458e84f51559821aecc452
parent fc39aa9d24d4481189facf0f6197b0e1795716fa
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Sat, 22 Aug 2015 16:52:46 +0200

sfeed_update: simplify path (only $sfeedpath now)

Diffstat:
Msfeed_opml_import.c | 5+----
Msfeed_update | 13++++++-------
Msfeedrc.example | 5+----
3 files changed, 8 insertions(+), 15 deletions(-)

diff --git a/sfeed_opml_import.c b/sfeed_opml_import.c @@ -90,10 +90,7 @@ main(void) parser.xmltagend = xml_handler_end_element; fputs( - "# paths\n" - "# NOTE: make sure to uncomment all these if you change it.\n" - "#sfeedpath=\"$HOME/.sfeed\"\n" - "#sfeeddir=\"${sfeedpath}/feeds\"\n" + "#sfeedpath=\"$HOME/.sfeed/feeds\"\n" "\n" "# list of feeds to fetch:\n" "feeds() {\n" diff --git a/sfeed_update b/sfeed_update @@ -3,8 +3,7 @@ # NOTE: assumes "sfeed_*" executables are in $PATH. # defaults -sfeedpath="$HOME/.sfeed" -sfeeddir="${sfeedpath}/feeds" +sfeedpath="$HOME/.sfeed/feeds" # load config (evaluate shellscript). # loadconfig(configfile) @@ -18,8 +17,8 @@ loadconfig() { config="$HOME/.sfeed/sfeedrc" fi - # load config: config is loaded here to be able to override above variables - # (sfeedpath, sfeedfile, etc). + # load config: config is loaded here to be able to override $sfeedpath + # or functions. if [ -r "${config}" ]; then . "${config}" else @@ -67,7 +66,7 @@ feed() { tmpfeedfile="${sfeedtmpdir}/${name}" tmpencfile="" encoding="$4" - sfeedfile="${sfeeddir}/$1" + sfeedfile="${sfeedpath}/$1" if [ ! "${encoding}" = "" ]; then fetchfeed "$2" "$1" "${sfeedfile}" | convertencoding "${encoding}" "utf-8" else # detect encoding. @@ -78,7 +77,7 @@ feed() { fi | sfeed "$3" > "${tmpfeedfile}" # get new data and merge with old. - sfeedfilenew="${sfeeddir}/${name}.new" + sfeedfilenew="${sfeedpath}/${name}.new" # if file exists, merge if [ -e "${sfeedfile}" ]; then merge "${sfeedfile}" "${tmpfeedfile}" > "${sfeedfilenew}" @@ -115,7 +114,7 @@ trap -- "terminated" "15" # SIGINT: kill all running childs >:D trap -- "kill -TERM -$$" "2" # make sure path exists. -mkdir -p "${sfeeddir}" +mkdir -p "${sfeedpath}" # fetch feeds specified in config file. feeds # wait till all feeds are fetched (concurrently). diff --git a/sfeedrc.example b/sfeedrc.example @@ -1,7 +1,4 @@ -# paths -# NOTE: make sure to uncomment all these if you change it. -#sfeedpath="$HOME/.sfeed" -#sfeeddir="${sfeedpath}/feeds" +#sfeedpath="$HOME/.sfeed/feeds" # list of feeds to fetch: feeds() {