|
|
sfeed_markread - sfeed_curses - sfeed curses UI (now part of sfeed, development is in sfeed) |
|
|
 |
git clone git://git.codemadness.org/sfeed_curses (git://git.codemadness.org) |
|
|
 |
Log |
|
|
 |
Files |
|
|
 |
Refs |
|
|
 |
README |
|
|
 |
LICENSE |
|
|
|
--- |
|
|
|
sfeed_markread (737B) |
|
|
|
--- |
|
|
|
1 #!/bin/sh |
|
|
|
2 # Mark items as read/unread: the input is the read / unread URL per line. |
|
|
|
3 |
|
|
|
4 usage() { |
|
|
|
5 echo "usage: $0 <read|unread> [urlfile]" >&2 |
|
|
|
6 echo "" >&2 |
|
|
|
7 echo "An urlfile must be specified as an argument or with the environment variable \$SFEED_URL_FILE" >&2 |
|
|
|
8 exit 1 |
|
|
|
9 } |
|
|
|
10 |
|
|
|
11 urlfile="${2:-${SFEED_URL_FILE}}" |
|
|
|
12 if test -z "${urlfile}"; then |
|
|
|
13 usage |
|
|
|
14 fi |
|
|
|
15 |
|
|
|
16 case "$1" in |
|
|
|
17 read) |
|
|
|
18 cat >> "${urlfile}" |
|
|
|
19 ;; |
|
|
|
20 unread) |
|
|
|
21 tmp=$(mktemp) |
|
|
|
22 trap "rm -f ${tmp}" EXIT |
|
|
|
23 test -f "${urlfile}" || touch "${urlfile}" 2>/dev/null |
|
|
|
24 LC_CTYPE=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 |
|