/* * quick bms status report. */ /* Initialize */ address command moves. = 0 hosts. = 0 files. = 0 hostcount = 0 filecount = 0 progressing = 0 repout = 't:bms-repout' /* Get the raw data */ 'bms >'repout 'status active' if ~open(repout, repout, 'Read') then do say "Can't create intermediate report file" exit 20 end /* Scan the lines, getting stats */ do while ~eof(repout) line = readln(repout) if line = "" then iterate select when index(line, 'flags=') > 0 then do if index(line, '100%') = 0 | index(line, 'NOTFND') > 0 then iterate /* Skip incompletes and failures */ if direction = in then parse upper var line 'REM=' file . else parse upper var line . . file . if ~files.file then do filecount = filecount + 1 files.filecount = file files.file = 1 end if ~hosts.host then do hostcount = hostcount + 1 hosts.hostcount = host hosts.host = 1 end moves.direction.host.file = moves.direction.host.file + 1 moves.direction.host = moves.direction.host + 1 moves.direction.file = moves.direction.file + 1 end when index(line, ':OUTGOING-DONE-WAIT') > 0 then direction = out when index(line, ':RXDONE-WAIT') > 0 then direction = in when index(line, 'REGISTRATION') > 0 then parse var line . 'ALIAS=' host . when index(line, ':GET-REQ-SENT') > 0 | index(line, ':RECEIVE') > 0 then progressing = progressing + 1 /* ignore things in progress */ otherwise say "Possibly unkown line" i":"line end end call close repout /* Print the stats: incoming */ direction = in do i = 1 to hostcount host = hosts.i if moves.direction.host > 0 then do say "You have gotten" moves.direction.host "file(s) from" host":" do j = 1 to filecount file = files.j if moves.direction.host.file ~= 0 then say " "file moves.direction.host.file "time(s)." end end end say "" /* Outgoing */ direction = out do i = 1 to hostcount host = hosts.i if moves.direction.host > 0 then do say host "has gotten" moves.direction.host "file(s) from you:" do j = 1 to filecount file = files.j if moves.direction.host.file ~= 0 then say " "file moves.direction.host.file "time(s)." end end end say "" /* Outbound count */ do i = 1 to filecount file = files.i if moves.direction.file > 0 then say file "has been gotten" moves.direction.file "time(s)." end /* In progress */ if progressing > 0 then do say "" say progressing "tranfer(s) in progress." end /* Clean up */ 'delete quiet force' repout