tnew scripts - plan9port - [fork] Plan 9 from user space
 (HTM) git clone git://src.adamsgaard.dk/plan9port
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 3ff9213bcd3493446f29942ea9f1a78a59d48823
 (DIR) parent 2ce287bb130ff77a6547a582fe7df6a28aefedfb
 (HTM) Author: rsc <devnull@localhost>
       Date:   Tue,  4 Jan 2005 22:11:58 +0000
       
       new scripts
       
       Diffstat:
         M bin/9ar                             |       1 -
         A bin/doctype                         |      74 +++++++++++++++++++++++++++++++
         A bin/lookman                         |      30 ++++++++++++++++++++++++++++++
         A bin/spell                           |      21 +++++++++++++++++++++
         A bin/start                           |       3 +++
         A bin/stop                            |       3 +++
         A bin/wintext                         |      16 ++++++++++++++++
       
       7 files changed, 147 insertions(+), 1 deletion(-)
       ---
 (DIR) diff --git a/bin/9ar b/bin/9ar
       t@@ -6,4 +6,3 @@ Darwin)
                ranlib -c $2
                ;;
        esac
       -
 (DIR) diff --git a/bin/doctype b/bin/doctype
       t@@ -0,0 +1,74 @@
       +#!/usr/local/plan9/bin/rc
       +# doctype:  synthesize proper command line for troff
       +
       +troff=troff
       +eqn=eqn
       +prefer=prefer
       +opt=''
       +dev=''
       +while(~ $1 -*){
       +        switch($1){
       +        case -n;
       +                troff=nroff
       +                eqn=neqn
       +                prefer='prefer -n'
       +        case -T
       +                dev=$1
       +        case -*
       +                opt=$opt' $1'
       +        }
       +        shift
       +}
       +ifs='
       +'{
       +        files=`{echo $*}
       +}
       +9grep -h '\$LIST|\|reference|^\.(EQ|TS|\[|PS|IS|GS|G1|GD|PP|BM|LP|BP|PI|cstart|begin|TH...)|^\.P$' $* |
       +sort -u |
       +awk '
       +BEGIN        { files = "'$files'" }
       +/\$LIST/ { e++ }
       +/^\.PP/        { ms++ }
       +/^\.LP/        { ms++ }
       +/^\.EQ/        { eqn++ }
       +/^\.TS/        { tbl++ }
       +/^\.PS/        { pic++ }
       +/^\.IS/        { ideal++ }
       +/^\.GS/ { tped++ }
       +/^\.G1/ { grap++; pic++ }
       +/^\.GD/ { dag++; pic++ }
       +/^\.\[/        { refer++ }
       +/\|reference/ { prefer++ }
       +/^\.cstart/ { chem++; pic++ }
       +/^\.begin +dformat/ { dformat++; pic++ }
       +/^\.TH.../ { man++ }
       +/^\.BM/ { lbits++ }
       +/^\.P$/        { mm++ }
       +/^\.BP/        { pictures++ }
       +/^\.PI/        { pictures++ }
       +END {
       +        x = ""
       +        if (refer) {
       +                if (e)        x = "refer -e " files " | "
       +                else        x =  "refer " files "| "
       +                files = ""
       +        }
       +        else if (prefer) { x = "cat " files "| '$prefer'| "; files = "" }
       +        if (tped)  { x = x "tped " files " | "; files = "" }
       +        if (dag)  { x = x "dag " files " | "; files = "" }
       +        if (ideal) { x = x "ideal -q " files " | "; files = "" }
       +        if (grap)  { x = x "grap " files " | "; files = "" }
       +        if (chem)  { x = x "chem " files " | "; files = "" }
       +        if (dformat)  { x = x "dformat " files " | "; files = "" }
       +        if (pic)   { x = x "pic " files " | "; files = "" }
       +        if (tbl)   { x = x "tbl " files " | "; files = "" }
       +        if (eqn)   { x = x "'$eqn' '$dev' " files " | "; files = "" }
       +        x = x "'$troff' "
       +        if (man) x = x "-man"
       +        else if (ms) x = x "-ms"
       +        else if (mm) x = x "-mm"
       +        if (lbits) x = x "-mbits"
       +        if (pictures) x = x " -mpictures"
       +        x = x " '$opt' '$dev' " files
       +        print x
       +}'
 (DIR) diff --git a/bin/lookman b/bin/lookman
       t@@ -0,0 +1,30 @@
       +#!/usr/local/plan9/bin/rc
       +# Usage: lookman key ...
       +#        prints out the names of all manual pages containing all the given keywords
       +index=/usr/local/plan9/man/lookman.index
       +t1=/tmp/look1.$pid
       +t2=/tmp/look2.$pid
       +fn sigexit sigint sighup sigterm{
       +        rm -f $t1 $t2
       +        exit 1
       +}
       +*=`{echo $*|tr A-Z a-z|tr -dc 'a-z0-9_ \012'}        # fold case, delete funny chars
       +if(~ $#* 0){
       +        echo Usage: lookman key ... >/fd/2
       +        exit 1
       +}
       +look $1 $index|sed 's/.*        //'|sort -u >$t1
       +shift
       +for(i in $*){
       +        look $i $index|sed 's/.*        //'|sort -u|
       +                awk 'BEGIN {
       +                        while (getline < "'$t1'" > 0) table[$0] = 1;
       +                        }
       +                        { if (table[$0]) print }
       +                        ' > $t2
       +        mv $t2 $t1
       +}
       +sort $t1 | sed 's;/usr/local/plan9/man/man[0-9]*/;;
       +        s;(.*)\.(.*);man \2 \1 # \1(\2);'
       +rm -f $t1 $t2
       +exit 0
 (DIR) diff --git a/bin/spell b/bin/spell
       t@@ -0,0 +1,21 @@
       +#!/usr/local/plan9/bin/rc
       +
       +spellflags=()
       +deroffargs=()
       +fflag=''
       +for(x){
       +        switch($x){
       +        case -[abcvx]
       +                spellflags=($spellflags $x)
       +        case -f
       +                fflag=$x
       +        case *
       +                if(~ $fflag -f)        {
       +                        spellflags=($spellflags -f $x)
       +                        fflag=''
       +                }
       +                if not                deroffargs=($deroffargs $x)
       +        }
       +}
       +
       +deroff -w $deroffargs | sort -u | sprog $spellflags
 (DIR) diff --git a/bin/start b/bin/start
       t@@ -0,0 +1,3 @@
       +#!/bin/sh
       +
       +exec /usr/local/plan9/bin/kill -CONT "$@"
 (DIR) diff --git a/bin/stop b/bin/stop
       t@@ -0,0 +1,3 @@
       +#!/bin/sh
       +
       +exec /usr/local/plan9/bin/kill -STOP "$@"
 (DIR) diff --git a/bin/wintext b/bin/wintext
       t@@ -0,0 +1,16 @@
       +#!/bin/sh
       +
       +case "$winid" in
       +[0-9]*)
       +        9p read acme/$winid/body
       +        exit 0
       +esac
       +
       +case "$text9term" in
       +unix!*)
       +        dial -e $text9term </dev/null
       +        exit 0
       +esac
       +
       +echo 'no running window found' 2>&1
       +exit 1