Skip to content

phonologus/edam

Repository files navigation

The Edam editor

Edam is the Research Unix Version 10 text editor sam without the graphical terminal driver. It only has the ed-like line editor terminal interface. It should be able to serve as a drop-in replacement for sam -d.

The name comes from ed + headless sam, or, edam (which is a bit cheesy).

The Unix and Plan9 Sam editor was written by Rob Pike. Edam is derived from the Research Unix Version 10 Sam sourcecode, with all the graphical terminal code removed, and a lightweight UTF-8 processing library added.

Edam is described completely in the edam(1) manpage. It is a line editor, in the tradition of ed, with multi-file editing, with structural regular expressions, and an elegant command language. Edam works with UTF-8 encoded text.

Included with Edam is a wrapper script sedam, and its associated manpage sedam.1, which provides a sed-like interface to edam. Thus one can do things like

cat foo | sedam 's/a/z/g'

Building

Building and installing Edam should be as easy as:

make clean && make && make install

Installation is into /usr/local/bin by default. A custom install location can be given by setting the PREFIX environment variable. For example, to install edam into /opt/bin invoke:

make install PREFIX=/opt

or:

PREFIX=/opt make install

The edam binary is self-contained, and can be moved anywhere. The manpage is installed to $(PREFIX)/share/man/man1. The sedam script and its manpage are also installed.

To uninstall, make uninstall, being sure to set PREFIX if make install was invoked with PREFIX set. For example, to uninstall the custom installation above:

make uninstall PREFIX=/opt

New Features

UTF-8

Although the Plan9 Sam editor processes UTF-8, it uses a completely different implementation strategy. Edam works on the raw UTF-8 encoded text itself, temporarily converting to Unicode code-points only when absolutely necessary. This drastically reduces the memory and on-disk storage requirements, at the expense of a little extra processing.

Edam will refuse to work with malformed UTF-8. This can be annoying!

Sources

Edam is derived from the Research Unix Version 10 Sam sources available from the Unix Archive here, and located in directory /jerq/src/sam/.

Sedam, and both manpages, are derived from the Plan9 port versions of these files (ssam and ssam.1).

Authors

Sam was written by Rob Pike in the late 1980s. It survives to this day in the Plan 9 port.

In 2023, Sean Jensen reformatted the original 1980s Unix sourcecode to be ANSI-compliant C, and made changes to (i) make it compile on an up-to-date ANSI/POSIX system; (ii) to add new capabilities for processing UTF-8 encoded text; and (iii) to remove the graphical terminal/GUI dependencies.

The source files utf.[ch] were written entirely by Sean Jensen.

About

Edam is a text editor. It is a port of Research Unix `sam -d`. It is a GUI-less sam. It is UTF-8 aware.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages