Introduction
Introduction Statistics Contact Development Disclaimer Help
sfeed_markread - sfeed - RSS and Atom parser
git clone git://git.codemadness.org/sfeed
Log
Files
Refs
README
LICENSE
---
sfeed_markread (754B)
---
1 #!/bin/sh
2 # Mark items as read/unread: the input is the read / unread URL per line.
3
4 usage() {
5 printf "usage: %s <read|unread> [urlfile]\n" "$0" >&2
6 echo "" >&2
7 echo "An urlfile must be specified as an argument or with the en…
8 exit 1
9 }
10
11 urlfile="${2:-${SFEED_URL_FILE}}"
12 if [ -z "${urlfile}" ]; then
13 usage
14 fi
15
16 case "$1" in
17 read)
18 cat >> "${urlfile}"
19 ;;
20 unread)
21 tmp="$(mktemp)" || exit 1
22 trap "rm -f ${tmp}" EXIT
23 [ -f "${urlfile}" ] || touch "${urlfile}" 2>/dev/null
24 LC_ALL=C awk -F '\t' '
25 { FILENR += (FNR == 1) }
26 FILENR == 1 { urls[$0] = 1 }
27 FILENR == 2 { if (!urls[$0]) { print $0 } }
28 END { exit(FILENR != 2) }' \
29 "-" "${urlfile}" > "${tmp}" && \
30 cp "${tmp}" "${urlfile}"
31 ;;
32 *)
33 usage
34 ;;
35 esac
You are viewing proxied material from codemadness.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.