ported program to java for use on unix systems