#!/usr/local/bin/rexx

PARSE arg ko gde

'finger @ns.vet.bg.ac.yu >FIFO'

say COPIES('-', 70)

mes=""
max=QUEUED()
n=0
DO i=1 TO max
   PARSE UPPER PULL line
   IF left(line, 2)='' & STRIP(line)<>'' THEN DO
      n=n+1
      PARSE VAR line user.n .
   END 
END 

PARSE UPPER VALUE DATE('N') WITH d1 m1 sat1
d1=STRIP(RIGHT('0'd1, 2))
m1=STRIP(m1)
SAY 'Date: 'd1 m1 sat1
say COPIES('-', 70)

DO i=1 TO n
'finger 'user.i'@147.91.250.4 >FIFO'
mes=""
max=QUEUED()
DO fr=1 TO max
   PARSE UPPER PULL s w rest
   IF s="LAST" THEN DO
      IF w="NT" THEN DO
      PARSE VAR rest .',' mes dan ',' . . sat .
      END 
      IF w='LOGIN' THEN DO
      PARSE VAR REST . . mes dan sat .
      END      
   END 
END 
IF mes<>'' THEN red=dan' 'LEFT(mes, 3)' 'sat
ELSE red='-'

      PARSE VAR red d m sat .
      d=STRIP(d); m=STRIP(m)
      IF d<>'-' THEN DO
         IF d1=d & m1=m THEN
            SAY user.i m d sat
      END 
END 

EXIT
