cat.myr 461 B

123456789101112131415161718192021222324252627282930
  1. use std
  2. use bio
  3. use "dispatch"
  4. const cat = {params
  5. var f, i, ofile
  6. ofile=params[0]
  7. match bio.open(ofile, bio.Rd)
  8. | `std.Ok bio: f = bio
  9. | `std.Err e: std.fatal("Unable to open data file: {}\n", e)
  10. ;;
  11. i = 0
  12. while true
  13. match bio.readln(f)
  14. | `std.Err `bio.Eof: break;
  15. | `std.Err e: std.fatal("err: {}\n", e)
  16. | `std.Ok ln:
  17. std.put("{}\n", ln)
  18. i++
  19. ;;
  20. ;;
  21. }
  22. const __init__ = {
  23. dispatch.register("cat", cat)
  24. }