Google
 

Trailing-Edge - PDP-10 Archives - SRI_NIC_PERM_SRC_3_19910112 - utilities/pigs.mac
There are no other files named pigs.mac in the archive.
;
;	pigs -	a program to search for disk pigs
;
;	given a date it will report all files not accessed since then
;

	title	pigs
	search	monsym

	a=1
	b=2
	c=3

start:	reset
	hrroi	a,[asciz/
Last access date and time: /]
	psout			;ask user for time of the pig hunt
	movei	a,.priin
	setz	b,
	idtim			;get a date in usual format
	 jrst	err
	movem	b,unvdt#	;save the date
	hrroi	a,[asciz/File group: /]
	psout
	move	a,[gj%ifg+gj%flg+gj%fns+gj%sht]
	move	b,[.priin,,.priou]
	gtjfn			;check all files
	 jrst	err
	movem	a,jfn#		;save jfn
	hrroi	a,[asciz/Output file: /]
	psout
	move	a,[gj%fns+gj%sht]
	move	b,[.priin,,.priou]
	gtjfn			;get an ouput file
	 jrst	err
	movem	a,ojfn#
	move	a,ojfn
	move	b,[7b5+of%wr]
	openf
	 jrst	err
	setzm	flag#
	setzm	tot#
	setzm	dirtot#
	setzm	cnt#
	setzm	dircnt#

getfdb:	hrrz	a,jfn
	move	b,[2,,.fbwrt]
	movei	c,b
	gtfdb			;get the date for last referenece
	 erjmp	err
	caml	b,unvdt
	 jrst	nxtfil		;write after target date
	caml	c,unvdt
	 jrst	nxtfil		;read after target date
	skipe	flag		;first time is special
	jrst	twice
	move	a,ojfn
	hrroi	b,[asciz/

	/]
	setz	c,
	sout
	 erjmp	err
	move	a,ojfn
	hrrz	b,jfn
	move	c,[10000,,1]
	jfns
	 erjmp	err
	move	a,ojfn
	hrroi	b,[asciz/

/]
	setz	c,
	sout
	 erjmp	err
	setom	flag

twice:	hrrz	a,jfn
	sizef			;get file size
	 jrst	err
	aos	cnt		;bump count
	aos	dircnt
	addm	c,tot		;add to totals
	addm	c,dirtot
	move	a,ojfn
	hrrz	b,jfn
	move	c,[1110,,26003]
	jfns			;print the file name
	 erjmp	err
	move	a,ojfn
	hrroi	b,[asciz/
/]
	setz	c,
	sout
	 erjmp	err

nxtfil:	move	a,jfn
	gnjfn			;get the next file
	 jrst	done
	tdnn	a,[gn%dir]	;did the directory change?
	 jrst	getfdb		;go get'em
	setzm	flag		;unset flag
	skipn	dircnt		;skip print if 0
	 jrst	getfdb
	move	a,ojfn
	hrroi	b,[asciz/
Total of /]
	setz	c,
	sout			;print directory total
	 erjmp	err
	move	a,ojfn
	move	b,dirtot
	movei	c,^d10
	nout
	 jrst	err
	move	a,ojfn
	hrroi	b,[asciz/ pages in /]
	setz	c,
	sout
	 erjmp	err
	move	a,ojfn
	move	b,dircnt
	movei	c,^d10
	nout
	 jrst	err
	move	a,ojfn
	hrroi	b,[asciz/ files
/]
	sout
	 erjmp	err
	setzm	dirtot		;zero out totals
	setzm	dircnt
	jrst	getfdb

done:	move	a,ojfn
	hrroi	b,[asciz/
Grand total of /]
	setz	c,
	sout
	move	a,ojfn
	move	b,tot
	movei	c,^d10
	nout
	 jrst	err
	move	a,ojfn
	hrroi	b,[asciz/ pages in /]
	setz	c,
	sout
	 erjmp	err
	move	a,ojfn
	move	b,cnt
	movei	c,^d10
	nout
	 jrst	err
	move	a,ojfn
	hrroi	b,[asciz/ files

/]
	setz	c,
	sout
	move	a,ojfn
	closf
	 jfcl
	haltf

err:	movei	a,.priou
	hrloi	b,.fhslf
	setz	c,
	erstr			;print the error
	 0
	 0
	jrst	start		;one more time

	end	start