Viewing contents of file '../idllib/deutsch/local/printerstats.pro'
pro printerstats,whichqueues
;+
; NAME:
;   PRINTERSTATS
; PURPOSE:
;   This program assembles some stats from print accounting log files.
; CALLING SEQEUNCE:
;   printerstats,whichqueues
;-

  acctfiles=strarr(3)
  if (n_elements(whichqueues) eq 0) then whichqueues='sol,dione'

  i=0
  if (strpos(whichqueues,'sol') ne -1) then begin
    acctfiles(i)='/host/sol/var/spool/sol/acct' & i=i+1 & endif
  if (strpos(whichqueues,'dione') ne -1) then begin
    acctfiles(i)='/host/margon/var/spool/dione/acct' & i=i+1 & endif
  if (strpos(whichqueues,'orca') ne -1) then begin
    acctfiles(i)='/host/orca/var/spool/orca/acct' & i=i+1 & endif
  acctfiles=acctfiles(0:i-1)

  nptmp=0.0 & usertmp=' '
  users=strarr(500) & nusers=0
  pages=fltarr(500) & tpg=0

  for af=0,n_elements(acctfiles)-1 do begin
    pg=0
    print,'Scanning ',acctfiles(af)
    openr,1,acctfiles(af)
    while not EOF(1) do begin
      readf,1,nptmp,usertmp
      usertmp=strtrim(usertmp,2)
      tmp22=strpos(usertmp,' ')
      if (tmp22 ne -1) then usertmp=strmid(usertmp,0,tmp22)
;print,usertmp & wait,.1
      usertmp=strmid(usertmp,strpos(usertmp,':')+1,99)
      which=where(users eq usertmp)
      if (which(0) eq -1) then begin
	users(nusers)=usertmp
	which=nusers
	nusers=nusers+1
	endif
      pages(which(0))=pages(which(0))+nptmp
      pg=pg+nptmp
      endwhile
    close,1
    print,' Total of ',strn(pg),' pages'
    tpg=tpg+pg
    endfor

  users=users(0:nusers-1)
  pages=pages(0:nusers-1)
  s1=reverse(sort(pages))
  users=users(s1)
  pages=pages(s1)

  hpcc='brendan,caq,carlberg,couchman,gammie,kolson,lake,marios,moore,'+ $
       'nsk,stadel,tron,trq,wpp'
  hpccpag=0

  for i=0,nusers-1 do begin
    print,format='(a15,i10)',users(i),pages(i)
    if (strpos(hpcc,users(i)) ne -1) then hpccpag=hpccpag+pages(i)
    endfor

  print,'Total pages: ',strn(total(pages))
  print,'HPCC pages: ',strn(hpccpag),'  is ',strn(hpccpag/total(pages)*100),' %'

  return


end