begin ; !RENAME: old1/new1,old2/new2,...
! JGH moded 24-Jan-84 to use PAM options instead of always '/'

include  "inc:util.imp"

byte  sep='/', log=0

routine  pair(string (255)s)
string (255)from,to
  onevent  3,4,9 start 
    printline(event_message); return 
  finish 
  returnif  s=""
  unless  s -> from.(TO STRING(sep)).to start 
    printline("Rename old".TO STRING(sep)."new"); return 
  finish 
  rename(from,to)
  print line (from." renamed to ".to) if  log=1
end 

string (255)line,one,rest

  sep = PAM_group sep if  pam_group sep >=' '
  line = cliparam.","
  to upper (line)
  log=1 and  line = one.rest if  line -> one.("-L").rest
  while  line -> one.(",").rest cycle 
    pair(one)
    line = rest
  repeat 
endofprogram