Plan 9 from Bell Labs’s /usr/web/sources/extra/changes/2006/0212

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


New getflags(8).  Thanks to Christoph Lohmann.
 [rsc] --rwxrwxr-x M 840072 glenda sys 240 Feb 12 06:37 rc/bin/ape/ar89
	/n/sourcesdump/2006/0212/plan9/rc/bin/ape/ar89:1,13 - 
	/n/sourcesdump/2006/0213/plan9/rc/bin/ape/ar89:1,15
	  #!/bin/rc
	- ifs='' eval `{getflags cdprtxuv $*}
	  
	+ flagfmt='c,d,p,r,t,u,v,x'
	+ args='archive [files ...]'
	+ 
	+ if(! ifs=() eval `{aux/getflags $*} || ~ $#* 0) {
	+ 	aux/usage
	+ 	exit usage
	+ }
	+ 
	  key=''
	- if (~ $#FLAGc 1) key=$key^c
	- if (~ $#FLAGd 1) key=$key^d
	- if (~ $#FLAGp 1) key=$key^p
	- if (~ $#FLAGr 1) key=$key^r
	- if (~ $#FLAGt 1) key=$key^t
	- if (~ $#FLAGx 1) key=$key^x
	- if (~ $#FLAGu 1) key=$key^u
	- if (~ $#FLAGv 1) key=$key^v
	+ for(i in c d p r t x u v)
	+ 	if(f=flag$i ~ $#$f 1)
	+ 		key=$key$i
	  exec /$cputype/bin/ar $key $*
 [rsc] --rwxrwxr-x M 840072 glenda sys 280 Feb 12 06:37 rc/bin/ape/yacc
	/n/sourcesdump/2006/0212/plan9/rc/bin/ape/yacc:1,8 - 
	/n/sourcesdump/2006/0213/plan9/rc/bin/ape/yacc:1,16
	  #!/bin/rc
	- # ifs='' eval `{getflags dltvb:1p:1 $*}
	+ 
	+ flagfmt='d,l,t,v,b stem'
	+ args='grammar'
	+ 
	+ if(! ifs=() eval `{aux/getflags $*} || ! ~ $#* 1){
	+ 	aux/usage
	+ 	exit usage
	+ }
	+ 
	  y=-S
	- #if (~ $#FLAGd 1) y=($y -d)
	- #if (~ $#FLAGt 1) y=($y -D2)
	- #if (~ $#FLAGv 1) y=($y -v)
	- #if (~ $#FLAGb 1) y=($y -s $FLAGb)
	+ if (~ $#flagb 1) y=($y -s $flagb)
	+ if (~ $#flagd 1) y=($y -d)
	+ if (~ $#flagt 1) y=($y -D2)
	+ if (~ $#flagv 1) y=($y -v)
	  exec /$cputype/bin/yacc $y $*
 [rsc] --rwxrwxr-x M 840072 glenda sys 1052 Feb 12 06:37 rc/bin/leak
	/n/sourcesdump/2006/0212/plan9/rc/bin/leak:2,38 - 
	/n/sourcesdump/2006/0213/plan9/rc/bin/leak:2,33
	  
	  rfork e
	  
	- usage='prog-or-pid'
	- FLAGs=()
	- FLAGb=()
	- FLAGr=()
	- FLAGx=()
	- eval `{aux/getflags bsx:1r:1f:1 $*}
	- 
	- if(~ $#* 0) {
	- 	echo 'usage: leak [-s] [-f binary] [-b [-r res] [-x width]] '$usage >[1=2]
	+ flagfmt='b,s,f binary,r res,x width'
	+ args='name | pid list'
	+ if(! ifs=() eval `{aux/getflags $*} || ~ $#* 0){
	+ 	aux/usage
	  	exit usage
	  }
	  
	- sflag=()
	- xflag=()
	- if(~ $#FLAGs 1)
	- 	sflag=($sflag -s)
	- if(~ $#FLAGf 1)
	- 	sflag=($sflag -f $FLAGf)
	- if(~ $#FLAGb 1)
	- 	xflag=($xflag -b)
	- if(~ $#FLAGr 1)
	- 	xflag=($xflag -r $FLAGr)
	- if(~ $#FLAGx 1)
	- 	xflag=($xflag -x $FLAGx)
	- 
	- if(~ $#FLAGs 1 && ~ $#FLAGb 1){
	- 	echo 'cannot use both -s and -b' >[1=2]
	+ if(~ $#flags 1 && ~ $#flagb 1){
	+ 	echo 'cannot use both -b and -s' >[1=2]
	  	exit usage
	  }
	  
	+ leakflags=()
	+ if(~ $#flags 1)
	+ 	leakflags=($leakflags -s)
	+ if(~ $#flagf 1)
	+ 	leakflags=($leakflags -f $flagf)
	  
	+ acidleakflags=()
	+ if(~ $#flagb 1)
	+ 	acidleakflags=($acidleakflags -b)
	+ if(~ $#flagr 1)
	+ 	acidleakflags=($acidleakflags -r $flagr)
	+ if(~ $#flagx 1)
	+ 	acidleakflags=($acidleakflags -x $flagx)
	+ 
	  if(! test -d /proc/$1) {
	  	# x=`{psu | awk '$NF=="'$1'" {print $2}'}
	  	x=`{psu | grep ' '$1'$' | sed 's/^[^ ]+ +([0-9]+).*/\1/'}
	/n/sourcesdump/2006/0212/plan9/rc/bin/leak:40,58 - 
	/n/sourcesdump/2006/0213/plan9/rc/bin/leak:35,54
	  		echo 'no processes named '$1 >[1=2]
	  		exit usage
	  	}
	- 	x=($sflag $xflag $x)
	- 	echo leak $"x
	+ 	echo leak $leakflags $acidleakflags $x
	  	exit
	  }
	  
	- x=`{echo $"* | tr ' ' ,}
	+ pidlist=`{echo $"* | tr ' ' ,}
	  
	- echo 'leakdump({'$x'})' | acid -lpool -lleak $1 $FLAGf | aux/acidleak $xflag $binary |
	- {
	- 	if(~ $#FLAGs 1)
	- 		awk '{print $4}' |
	- 			sort | uniq -c | sort -nr |
	- 			sed 's! *(.*) (0x.*)!src(\2); // \1!'
	- 	if not
	- 		cat
	- }
	+ echo 'leakdump({'$pidlist'})' | 
	+ 	acid -lpool -lleak $1 $flagf | 
	+ 	aux/acidleak $acidleakflags $flagf |
	+ 	{
	+ 		if(~ $#flags 1)
	+ 			awk '{print $4}' |
	+ 				sort | uniq -c | sort -nr |
	+ 				sed 's! *(.*) (0x.*)!src(\2); // \1!'
	+ 		if not
	+ 			cat
	+ 	}
 [rsc] --rwxrwxr-x M 840072 glenda sys 5119 Feb 12 06:37 rc/bin/lp
	[diffs elided - too long]
	[diff -c /n/sourcesdump/2006/0212/plan9/rc/bin/lp /n/sourcesdump/2006/0213/plan9/rc/bin/lp]
 [rsc] --rw-rw-r-- M 840072 rsc sys 1703 Feb 12 06:37 sys/man/8/getflags
 [rsc] --rw-rw-r-- M 840072 rsc sys 1360 Feb 12 06:37 sys/src/cmd/aux/getflags.c
 [rsc] --rw-rw-r-- M 840072 glenda sys 1011 Feb 12 06:38 sys/src/cmd/aux/mkfile
	/n/sourcesdump/2006/0212/plan9/sys/src/cmd/aux/mkfile:12,17 - 
	/n/sourcesdump/2006/0213/plan9/sys/src/cmd/aux/mkfile:12,18
	  	data2s\
	  	depend\
	  	disksim\
	+ 	getflags\
	  	lines\
	  	listen\
	  	listen1\
	/n/sourcesdump/2006/0212/plan9/sys/src/cmd/aux/mkfile:32,37 - 
	/n/sourcesdump/2006/0213/plan9/sys/src/cmd/aux/mkfile:33,39
	  	timesync\
	  	trampoline\
	  	typepasswd\
	+ 	usage\
	  	write\
	  	zerotrunc\
	  
 [rsc] --rw-rw-r-- M 840072 rsc sys 1095 Feb 12 06:37 sys/src/cmd/aux/usage.c
 [rsc] --rwxrwxr-x M 840072 glenda sys 5119 Feb 12 06:37 sys/src/cmd/lp/lp.rc
	[diffs elided - too long]
	[diff -c /n/sourcesdump/2006/0212/plan9/sys/src/cmd/lp/lp.rc /n/sourcesdump/2006/0213/plan9/sys/src/cmd/lp/lp.rc]

Diagnose bad times.  Thanks to Uriel.
 [rsc] --rw-rw-r-- M 840072 glenda sys 960 Feb 12 10:28 sys/src/cmd/touch.c
	/n/sourcesdump/2006/0212/plan9/sys/src/cmd/touch.c:14,19 - 
	/n/sourcesdump/2006/0213/plan9/sys/src/cmd/touch.c:14,20
	  void
	  main(int argc, char **argv)
	  {
	+ 	char *t, *s;
	  	int nocreate = 0;
	  	int status = 0;
	  
	/n/sourcesdump/2006/0212/plan9/sys/src/cmd/touch.c:20,26 - 
	/n/sourcesdump/2006/0213/plan9/sys/src/cmd/touch.c:21,30
	  	now = time(0);
	  	ARGBEGIN{
	  	case 't':
	- 		now = strtoul(EARGF(usage()), 0, 0);
	+ 		t = EARGF(usage());
	+ 		now = strtoul(t, &s, 0);
	+ 		if(s == t || *s != '\0')
	+ 			usage();
	  		break;
	  	case 'c':
	  		nocreate = 1;
	/n/sourcesdump/2006/0212/plan9/sys/src/cmd/touch.c:51,57 - 
	/n/sourcesdump/2006/0213/plan9/sys/src/cmd/touch.c:55,61
	  		fprint(2, "touch: %s: cannot wstat: %r\n", name);
	  		return 1;
	  	}
	- 	if ((fd = create(name, OREAD|OEXCL, 0666)) < 0) {
	+ 	if((fd = create(name, OREAD|OEXCL, 0666)) < 0){
	  		fprint(2, "touch: %s: cannot create: %r\n", name);
	  		return 1;
	  	}
 [rsc] --rw-rw-r-- M 840072 glenda sys 960 Feb 12 10:28 sys/src/cmd/touch.c

Your text here.
 [rsc] --rw-rw-r-- M 840072 glenda sys 2184 Feb 12 06:37 sys/man/2/arg
	/n/sourcesdump/2006/0212/plan9/sys/man/2/arg:122,124 - 
	/n/sourcesdump/2006/0213/plan9/sys/man/2/arg:122,126
	  .PP
	  .SH SOURCE
	  .B /sys/include/libc.h
	+ .SH SEE ALSO
	+ .IR getflags (8)


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].