shithub: riscv

Download patch

ref: 4ae2015d865a481829b949a171c055c3ec22fa98
parent: 794197adb16da0f7644cc8b56830316682b89011
author: stanley lieber <stanley.lieber@gmail.com>
date: Fri Apr 11 09:19:18 EDT 2014

newt: add 'kf' command to grep $home/lib/newsgroups for group names

--- a/rc/bin/newt
+++ b/rc/bin/newt
@@ -75,7 +75,7 @@
 	kmnt=`{echo $mnt | sed 's/\//\\\//g'}
 	f $mnt/$* |
 		grep -v -e '\/([0-9]+|article|body|header|post|xover)$' |
-		sed 's/^'$"kmnt'\// g	/g' |
+		sed 's/^'$"kmnt'\//  g	/g' |
 		sort
 }
 fn nshift{ shift; echo $* }
@@ -88,6 +88,7 @@
 h		print message headlines
 help		print this help message
 k ...		list sub-groups under specified group
+kf ...		grep $home/lib/newsgroups for regexp
 l		jump to last message
 n		next
 p		print message with minimal headers
@@ -194,6 +195,9 @@
 		k $group
 	case k' '*
 		k `{nshift $cmd | sed 's/\./\//g'}
+	case kf' '*
+		grep -e `{nshift $cmd} $home/lib/newsgroups |
+			sed 's/^/  g	/g'
 	case l
 		post=$posts($#posts)
 		printp $post
--- a/sys/man/1/newt
+++ b/sys/man/1/newt
@@ -85,6 +85,13 @@
 it instead walks the directories under the group specified
 by the argument.
 .TP
+.BI kf " regexp
+Greps
+.B $home/lib/newsgroups
+for
+.I regexp
+and prints commands suitable for changing to each match.
+.TP
 .B l
 Jump to the last message in the group.
 .TP
@@ -118,6 +125,9 @@
 .TP
 \fB"\fP
 Print the current message in quoted form, suitable for reply.
+.SH FILES
+.B $home/lib/newsgroups
+list of newsgroups, one per line
 .SH SOURCE
 .B /rc/bin/newt
 .SH "SEE ALSO"
@@ -126,7 +136,9 @@
 The list of available newsgroups offered by a given server
 may be quite large. This complicates walking the list over 
 a slow Internet connection, and renders searching in real-time
-all but infeasible.
+all but infeasible. Grepping a pre-generated
+.B newsgroups
+file is a compromise.
 .SH HISTORY
 .I Newt
 first appeared in 9front (April, 2014).