From d325d2226cf55b63037dc62cefb7fa952d770d50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Sun, 31 Jan 2021 14:14:05 +0000 Subject: Bind $home/bin/rc to rc/ instead of ./ --- rc/summary | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 rc/summary (limited to 'rc/summary') diff --git a/rc/summary b/rc/summary new file mode 100755 index 0000000..b527afd --- /dev/null +++ b/rc/summary @@ -0,0 +1,30 @@ +#!/bin/rc -e + +flagfmt='o,h,x,a' +if(! ifs=() eval `{aux/getflags $*}){ + aux/usage + exit usage +} +if(~ $#flago$#flagh$#flagx 000){ + flago=1 + flagh=1 +} + +cat $home/notes | awk ' + /^ o / { o = o $0 "\n"; mode = "o"; next } # important + /^ - / { h = h $0 "\n"; mode = "h"; next } # normal + /^ x / { x = x $0 "\n"; mode = "x"; next } # done + /^ / { + if (! ENVIRON["flaga"]) next + if (mode == "o") o = o $0 "\n" + if (mode == "h") h = h $0 "\n" + if (mode == "x") x = x $0 "\n" + next + } + { mode = "" } + END { + if (ENVIRON["flago"]) printf "%s", o + if (ENVIRON["flagh"]) printf "%s", h + if (ENVIRON["flagx"]) printf "%s", x + } +' -- cgit v1.2.3