README 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. Old UNIX V6 ed, lightly ported to modern systems.
  2. The old UNIX version of 'ed', the line editor. This is
  3. intended to be for academic interest more than anything and
  4. perhaps shouldn't be used for any serious editing of system
  5. files etc. You have been warned! :)
  6. The binary is named 'ed-v6' so as not to clobber gnu ed.
  7. There are some major differences between this and POSIX ed
  8. (see the notes at the end for more info.)
  9. NOTE: The linked sources are redistributed on github
  10. with no associated license.
  11. OPTIONS
  12. Build a 32 bit binary on x86_64 (Multilib needed):
  13. M32=yes
  14. Build a static binary (size is ~ 800k vs. ~ 18k for the
  15. dynamic):
  16. STATIC=yes
  17. DEVELOPER'S NOTES
  18. 1. compile with a K&R compiler (not even ansified);
  19. replacing =+ with += and using "=" for default
  20. assignment
  21. 2. assume 32-bits or better (ldiv and ldivr, increasing the
  22. sbrk to 4096)
  23. 3. use setjmp+longjmp instead of sysexit+reset
  24. 4. use lseek() instead of seek() (although still assumes
  25. 512 bytes)
  26. 5. copies the tempfilename to work on systems without
  27. writable strings
  28. 6. use SIG_IGN instead of the numeric value "1"
  29. 7. remove the goto errlab since that doesn't work in ANSI C
  30. 8. commented out getpid() in favor of a local copy
  31. 9. renamed unix() to run_unix() because some systems (at
  32. least some linux) annoyingly do a -Dunix=1
  33. 10. use sizeof(buf) instead of buf
  34. 11. renamed putchar() to putc() because gcc and clang
  35. generate errors if you create a function called putchar()
  36. with a different signature.
  37. 12. added a prototype for errfunc() because clang refuses to
  38. honor `-ansi`
  39. I've tried to keep these modifications as minimal as
  40. possible in an effort to preserve the editor that I learned
  41. unix on.
  42. `ed.c.orig` is included so you can verify how minimal my
  43. changes were.
  44. MAINTAINER'S NOTES
  45. Compilation:
  46. Added -D_XOPEN_SOURCE=500 to compile with fcntl.h in
  47. glibc-2.23.
  48. Manual page:
  49. If you are unfamiliar with ed then gnu ed has a very good
  50. info page.
  51. This is the closest I can find to the original man page:
  52. https://freebsd.org/cgi/man.cgi?query=ed&manpath=Unix+Seventh+Edition
  53. Among other things, there is no -p option, single , or ;
  54. will throw errors, no G//, and r does not support shell
  55. commands. H and h are also unsupported, so errors will lack
  56. any explanation.
  57. Using with rlwrap:
  58. This does work with rlwrap, however it repeats every
  59. command. This doesn't affect the functionality, but it can
  60. look quite confusing to have everything repeated.