"Linux Gazette...making Linux just a little more fun! "

Slang Applications for Linux

by Larry Ayers

Copyright (c) 1996

Published in Issue 12 of the Linux Gazette


John E. Davis of the Center for Space Research at MIT has written an interpreted programming language called Slang, which has a C-like syntax. He has written several programs using this language, including the slrn newsreader and the emacs-like Jed editor. Lately a few other programmers have begun to make use of Slang; one reason for this is that Slang allows the use of color in a text-mode program which will display equally well in an rxvt window under X.

Applications which are linked with the Slang library always seem to be text-mode programs. Typically Linux text-mode applications use the ncurses library to handle screen display. Ncurses enables the use of menus, a certain amount of color, and a more complex screen layout. These traits don't always translate well into an X-Windows environment; i.e. running in an xterm or rxvt window. If an application is linked with the Slang library instead its behavior is more consistent between the console and X sessions, especially when started from an rxvt window.

An Aside Concerning Rxvt and Xterm

I get the impression that the xterm terminal emulator is used more commonly than rxvt, though this may be due more to tradition than innate superiority. Rxvt has been revised several times recently and in its current form (version 2.19) has much to recommend it. One feature which I appreciate is that it's memory usage is much lower than that of xterm. Rxvt handles color requests well, both background/foreground specifications and extension-specific colorization such as "color-ls". The most recent version even allows the use of Xpm images as background, similar to a web-page, though as with a web-page a background image would have to be carefully chosen so as not to obscure the text.

Some xterm variants make use of color, but some don't. I find the plenitude of xterms and color-xterms rather confusing; it's hard to tell just which ones you have, and they vary from distribution to distribution. Then there is xterm's Tektronix compatibility, which I've never seen a use for. Reading the xterm man page I get the impression that xterm was developed for older mainframe-and-terminal systems.

Applications Which Use Slang

  1. Slrn is a fast, high quality news-reader which supports threading of messages, decoding of MIME attachments, and has the ability to tell a web-browser to load a URL contained within a message. It has many other features and options; it is one of John Davis's programs and he actively supports it in the newsgroup news.software.readers.
  2. Lynx, the text-mode web-browser, looks less archaic when compiled with Slang support. If you can't see the images on a page, at least the text elements and background can be nicely colored!
  3. Jed, John Davis's emacs-like editor, is surprisingly capable considering it is a fraction of the size of any real emacs. If you've ever hesitated to start up Gnu Emacs or Xemacs just to read an info page, try Jed; it reads them just as well and is quicker to invoke. Jed has syntax-highlighting for a variety of file types.
  4. The Midnight Commander, the exemplary text-mode file-manager, now includes enough of the Slang files in its source distribution to compile with Slang screen management without Slang libraries on your system. Slang is the default in recent versions of MC and the two are well-matched.
  5. Minicom is available in a binary, Slang-enabled version at ftp://sunsite.unc.edu. Color really makes this classic comm program more usable, especially in an rxvt window.
  6. The Mutt mail program is an interesting offshoot of Elm development which is well on its way toward becoming an alternative to Pine and Elm. Slang is listed as an alternative to ncurses in the pre-compilation configure script options, but I can't say how well it works as it will only successfully compile with ncurses on my system.
  7. Dosemu, though still dubbed an alpha version by the development team, is remarkably stable and useful. Recently I compiled the latest version (I had been using an old RPM version) and was surprised to see that the configure script looks for the Slang library. After the compilation I ran ldd against the dos binary and found that it is dynamically linked with the Slang library. Interesting! I looked through the source code and docs to see if there was any information on Dosemu's use of Slang, but finally gave up. You could spend days wandering around the Byzantine directory hierarchy of Dosemu!

I'm sure as the benefits of Slang become more widely known we shall see more text-mode applications with Slang support included. There very well be others than the above-listed out there; these are just the ones I've run across.


Precompiled binaries for slrn, lynx, and the Jed editor (with Slang statically linked, I assume) are available at ftp://sunsite.unc.edu and its mirrors . I used these for some time, but recently I obtained the source for Slang and compiled a shared library. The advantage of this approach is that you can compile binaries which dynamically link the Slang library at runtime. Your executables will be smaller, and one shared library can service any number of Slang-using applications. Another advantage to obtaining the source distributions is that you'll end up with more documentation.

John E. Davis's creations (slrn, Jed, and the Slang sources) are available at their MIT home site. The most recent versions, as well as beta versions, can be found there.

This Mexican site is the source for the most recent versions of the Midnight Commander, as well as rxvt.

Beta versions (which seem stable to me) of Michael Elkins' Mutt mail program are available from this FTP site. Maybe you can get it to compile with Slang!

Lynx binaries with Slang support can be found at sunsite and its mirrors.

The source for the latest and greatest of the Dosemu releases can be found at the tsx-11 FTP site. (Version 0.64.1 was released in November).

If you're like me and work at the console often, you'll find it's nice to have applications available which work well (and look good!) in an X session too. I think you will be pleased with the high quality and low memory usage of the above-listed apps.

Larry Ayers<layers@vax2.rain.gen.mo.us>
Last modified: Thu Nov 21 13:43:51 CST 1996