Make lex safer for 8-bit data.
[rsc] --rw-rw-r-- M 1487869 glenda sys 4074 Jan 29 11:18 sys/src/cmd/lex/ncform
/n/sourcesdump/2006/0129/plan9/sys/src/cmd/lex/ncform:9,15 -
/n/sourcesdump/2006/0130/plan9/sys/src/cmd/lex/ncform:9,15
extern struct yysvf *yyestate;
int yyprevious = YYNEWLINE;
# ifdef LEXDEBUG
- extern void allprint(char);
+ extern void allprint(int);
# endif
yylook(void){
struct yysvf *yystate, **lsp;
/n/sourcesdump/2006/0129/plan9/sys/src/cmd/lex/ncform:113,119 -
/n/sourcesdump/2006/0130/plan9/sys/src/cmd/lex/ncform:113,119
}
# ifdef LEXDEBUG
if(debug){
- fprintf(yyout,"stopped at %d with ",*(lsp-1)-yysvec-1);
+ fprintf(yyout,"stopped at %d with ",lsp>yylstate?*(lsp-1)-yysvec-1:0);
allprint(yych);
putchar('\n');
}
[rsc] --rw-rw-r-- M 1487869 glenda sys 10162 Jan 29 11:18 sys/src/cmd/lex/sub1.c
/n/sourcesdump/2006/0129/plan9/sys/src/cmd/lex/sub1.c:462,467 -
/n/sourcesdump/2006/0130/plan9/sys/src/cmd/lex/sub1.c:462,469
void
allprint(int c)
{
+ if(c < 0)
+ c += 256; /* signed char */
switch(c){
case 014:
print("\\f");
Make tbl read stdin if only flags are given.
[rsc] --rw-rw-r-- M 1487869 glenda sys 1554 Jan 29 11:17 sys/src/cmd/tbl/t1.c
/n/sourcesdump/2006/0129/plan9/sys/src/cmd/tbl/t1.c:43,52 -
/n/sourcesdump/2006/0130/plan9/sys/src/cmd/tbl/t1.c:43,49
sargv = argv;
sargc--;
sargv++;
- if (sargc > 0) {
- if(swapin() == 0)
- error("flags but no input files");
- } else {
+ if (sargc == 0 || swapin() == 0) {
tabin = (Biobuf*)getcore(sizeof(Biobuf), 1);
Binit(tabin, 0, OREAD);
}
Add -w, -b, and -S flags to man. Make it case-insensitive.
[rsc] --rwxrwxr-x M 1487869 glenda sys 2520 Jan 29 12:21 rc/bin/man
/n/sourcesdump/2006/0129/plan9/rc/bin/man:48,56 -
/n/sourcesdump/2006/0130/plan9/rc/bin/man:48,57
}
+ search=yes
while(~ $d 0) {
if(~ $#* 0) {
- echo 'Usage: man [-ntp] [-s sec] [0-9] [0-9] ... name1 name2 ...' >[1=2]
+ echo 'Usage: man [-bntpPSw] [0-9] [0-9] ... name1 name2 ...' >[1=2]
exit
}
if(test -d $S/$1){
/n/sourcesdump/2006/0129/plan9/rc/bin/man:62,67 -
/n/sourcesdump/2006/0130/plan9/rc/bin/man:63,71
case -n ; cmd=n ; shift
case -p ; cmd=p ; shift
case -P ; cmd=P ; shift
+ case -w ; cmd=w ; shift
+ case -b ; cmd=b ; shift
+ case -S ; search=no ; shift
case * ; d=1
}
}
/n/sourcesdump/2006/0129/plan9/rc/bin/man:72,80 -
/n/sourcesdump/2006/0130/plan9/rc/bin/man:76,85
if(~ $#* 1) pat='^'^$1^' '
if not pat='^('^`{echo $* | sed 's/ /|/g'}^') '
fils=()
+ if(~ $search yes)
for(i in $S/$sec){
if(/bin/test -f $i/INDEX){
- try=`{grep $pat $i/INDEX | sed 's/^[^ ]* //'}
+ try=`{grep -i $pat $i/INDEX | sed 's/^[^ ]* //'}
if(! ~ $#try 0)
fils=($fils $i/$try)
}
/n/sourcesdump/2006/0129/plan9/rc/bin/man:83,90 -
/n/sourcesdump/2006/0130/plan9/rc/bin/man:88,96
if(~ $#fils 0) {
# nothing in INDEX. try for file of given name
for(i) {
+ if(~ $i intro) i=0intro
for(n in $sec) {
- try=$S/$n/$i
+ try=`{echo $S/$n/$i | tr A-Z a-z}
if (/bin/test -f $try)
fils=($fils $try)
}
/n/sourcesdump/2006/0129/plan9/rc/bin/man:99,104 -
/n/sourcesdump/2006/0130/plan9/rc/bin/man:105,113
echo need $i >[1=2]
if not {
switch($cmd) {
+ case w
+ echo $i
+
case t
roff t $i
/n/sourcesdump/2006/0129/plan9/rc/bin/man:115,120 -
/n/sourcesdump/2006/0130/plan9/rc/bin/man:124,140
}
//N
/^\n$/D'
+
+ case b
+ x=`{echo $i | sed 's;/sys/man/(.*)/(.*);\1 \2;'}
+ if(~ $x(2) 0intro) x=($x(1) intro)
+ roff n $i | sed '
+ ${
+ /^$/p
+ }
+ //N
+ /^\n$/D' |
+ plumb -i -d edit -a 'action=showdata filename=/man/'$x(2)^'('$x(1)^')'
}
}
}
[rsc] --rw-rw-r-- M 1487869 glenda sys 2006 Jan 29 12:18 sys/man/1/man
/n/sourcesdump/2006/0129/plan9/sys/man/1/man:4,10 -
/n/sourcesdump/2006/0130/plan9/sys/man/1/man:4,10
.SH SYNOPSIS
.B man
[
- .B -ntpP
+ .B -bnpPStw
]
[
.I section ...
/n/sourcesdump/2006/0129/plan9/sys/man/1/man:45,50 -
/n/sourcesdump/2006/0130/plan9/sys/man/1/man:45,57
Print the pages on the standard output using
.IR nroff .
.TP
+ .B -b
+ Print the pages using
+ .I nroff
+ and send them to
+ .IR plumber (1)
+ for display in the editor.
+ .TP
.B -p
Run
.IR proof (1)
/n/sourcesdump/2006/0129/plan9/sys/man/1/man:55,65 -
/n/sourcesdump/2006/0130/plan9/sys/man/1/man:62,79
.IR page (1)
on the specified man pages.
.TP
+ .B -S
+ Do not search the manual indices for the names.
+ Only print pages whose file names match the names.
+ .TP
.B -t
Run
.IR troff (1)
and send its output
to standard output.
+ .TP
+ .B -w
+ Print the names of the man page source files.
.PD
.PP
.B Lookman
Use new man flags in plumber.
[rsc] --rw-rw-r-- M 1487869 glenda sys 2877 Jan 29 12:21 sys/lib/plumb/basic
/n/sourcesdump/2006/0129/plan9/sys/lib/plumb/basic:86,92 -
/n/sourcesdump/2006/0130/plan9/sys/lib/plumb/basic:86,92
# man index entries are synthesized
type is text
data matches '([a-zA-Z¡-0-9_\-./]+)\(([1-8])\)'
- plumb start rc -c 'man '$2' '$1' >[2=1] | plumb -i -d edit -a ''action=showdata filename=/man/'$1'('$2')'''
+ plumb start rc -c 'man -S -b '$2' '$1'
# start rule for images without known suffixes
dst is image
|