ref: c75e1913d7dec687abe7810672e966937967fe43
parent: 81ad767e7c490eed99c6c5424c2cbf23f1d0a047
author: kvik <kvik@a-b.xyz>
date: Sat Feb 22 09:10:44 EST 2020
c(1): accept a search on stdin
--- a/bin/c
+++ b/bin/c
@@ -5,6 +5,8 @@
-f find functions
-s find structs'
+fn isatty {grep -s '/dev/cons' /fd/0ctl}
+
fn struct {
ignore = (/sys/include/ape)
search = $*
@@ -57,6 +59,14 @@
}
if(~ $1 --)
shift
+
+if(! isatty){
+ nl = '
+'
+ '*' = `$nl{cat}
+ if(! ~ $#% 0)
+ cd `{basename -d $%}
+}
regex = `{echo $1 | sed 's:%:'$identifier':g'}
if(~ $#regex 0)
regex = $identifier