summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiltjo Posthuma <hiltjo@codemadness.org>2015-08-22 16:52:46 +0200
committerHiltjo Posthuma <hiltjo@codemadness.org>2015-08-22 16:52:46 +0200
commit9d4e3c762f0742f26d458e84f51559821aecc452 (patch)
tree696a935e323371454e375223e497e31aeebafad3
parentfc39aa9d24d4481189facf0f6197b0e1795716fa (diff)
sfeed_update: simplify path (only $sfeedpath now)
-rw-r--r--sfeed_opml_import.c5
-rwxr-xr-xsfeed_update13
-rw-r--r--sfeedrc.example5
3 files changed, 8 insertions, 15 deletions
diff --git a/sfeed_opml_import.c b/sfeed_opml_import.c
index a2e2082..248d4c2 100644
--- 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
index 99cb517..4aa094c 100755
--- 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
index 2f8d86d..abe8482 100644
--- 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() {