Plan 9 from Bell Labs’s /usr/web/sources/contrib/steve/rc/seloc

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#!/bin/rc

fn list {

	hget 'http://forums.seloc.org/forumdisplay.php?fid=35' |
	htmlfmt -a -w 1000 |
	awk '
		BEGIN {
			FS="\n"
			RS=""
		}

		NF >= 6 && $(NF-3) ~ "viewthread" {

			disc=$(NF-3);
			gsub("\]\\).*$", "]", disc);
			gsub("\\[.*\\]", "", disc);
			id=$(NF-3);
			gsub("\].*$", "", id);
			gsub("^.*tid=", "", id);
			if(disc != "")
				printf("seloc %-7s  # %-3s\n", id, disc);
		}
	'
}

fn show {
	hget 'http://forums.seloc.org/viewthread.php?tid='$1 |
		tcs -f 8859-1 |
		htmlfmt -w 1000 |
	awk  '
		/^Subject:/{
			getline;
			user=$0;
			next;
		}

		/^Quote: .*Report Post/ {
			enable=1;
			printf("---- %s\n", user);
			next;
		}

		/^View User''s Profile/{
			prnt(0);
			enable=0;
			getline;
			user=$0;
			next;
		}

		enable == 1 {
			for(i = 1; i <= NF; i++)
				word($i);
			prnt(1);
			next;
		}


		function word(w) {
			if(length(line) +length(w) > 80)
				prnt(0);
			line = line " " w;
		}

		function prnt(nl) {
			if(length(line) > 0 || nl != 0){
				print line;
				line = "";
			}
		}
	'
}


if ( ~ $#* 0)
	list
if not
	show $*


Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].