LowEndBox - Cheap VPS, Hosting and Dedicated Server Deals

While The King Lives: An Old C Programming Prank in GNU Hello From 1993

Elvis ProgrammingSometimes I wake up at at 1am thinking about problems in my life.  Sometimes I think about things I have to do the coming day.  And then there are nights when some almost-forgotten bit of code is just about to expire from my mental cache and decides it wants to take a stab at creating a new reference to itself in neural network.

Last night, it was this line:

while the king lives

This was a bit of C code, and I remember seeing it in college.  At the time, I was briefly confused about how and why it could compile.  That is not valid C.  Right?

Well, it can be.  For example:

#define the
#define king 1
#define lives

This turns the line into:

while 1

…which is perfectly valid.

But where had I seen it?  To save myself some time, I turned to one of our AI overlords and asked if it knew.  It rambled a bit about IOCCC (International Obfuscated C Code Contest) entries, or perhaps “old USENET examples showing how far the preprocessor can be pushed”.  After pausing for a moment of nostalgia over the lost glories of USENET, I recalled I’d seen it in green on black terminal glory, probably a vi session on SunOS 4.1.3 (a system I had a university account on).  So probably I had the actual source code in front of me.

Hmmm.

Obviously, this was some kind of joke program, and thinking further I remembered it was a joke program that could also read mail.  As an adage popular in those days went, every C program will eventually read mail.  Actually, this was not a joke, it was a LawZawinski’s Law – which states:

Every program attempts to expand until it can read mail. Those programs which cannot so expand are replaced by ones which can
– James Zawinksi, 1995

I continued googling and perusing.  GNU Hello popped into my mind, as I recall examining that program decades ago when I was first learning C, since it’s one of the simplest Gnu programs.  I downloaded the current version (2.12.3, which was released less than 2 months ago March of 2026), which did not have this line of code.  I went off an examined other code, but eventually came back to GNU Hello and looked at the oldest version still on the FSF’s FTP server, version 1.3 from 1993.  Bingo!

while the king lives {
    cc = read (mailfd, buf, st.st_blksize);

Hello, world!

So what does GNU Hello do?  It prints “Hello, world!”

The ChangeLog begins with quite an illustrious entry:

Sat Apr  1 00:27:19 1978  Brian Kernighan  (bwk at research)
* Initial version.

The next entry is:

Thu Nov 24 00:00:01 1983  Richard M. Stallman  (rms at prep)
* Begin GNU project; add copyleft.

The project achieved 1.0 in 1992, brought to this state by the King himself:

Fri Jun 26 02:55:44 1992  The King  (elvis@graceland.gnu.ai.mit.edu)
* Version 1.0 released.

That was the first appearance of the The King.  I enjoyed his comment about 1.1 changes:

Robustified and simplified argument test.

Only versions since 1.3 in 1993 are available on the FTP site, and diffs since 1.0.

Version 1.2 added the –mail flag:

GNU hello can now read your mail with the `-m’ (or `–mail’) option.

That persisted up to 2.5.  All it did was look at your mail spool file and dump your mail to the screen.

Version 1.2 also added the –traditional flag, which allows you to see “hello, world” instead “Hello, world!”  Worth noting that in The C Programming Language, the example text is indeed all lower-case.

Why was –traditional needed?

Under –traditional, retain compatibility with old implementations.

Of course – we wouldn’t want to break backwards compatibility with mission-critical software.

38K LOCs

The program demonstrates how simple programs become massively complex.  sloccount reports:

Total Physical Source Lines of Code (SLOC)                = 1,074

That was in 1993.  The current version (2.12.3) has dwarfed it:

Total Physical Source Lines of Code (SLOC)                = 38,798

Amazing.  38,798 lines of code to print “Hello, world!” to the terminal.  And that’s after the mail-reading code was removed.  This doesn’t include configure, m4, etc.  Yes, the full autoconf infrastructure there…for a program that is 3 lines in The C Programming Language.

Granted, it’s an illustrative package meant to show the simplest possible use of all the Gnu infrastructure, but…

hello.c itself is only 169 lines (raw count – includes comments and license).  It has 14 include files and fancy macros like these:

#define AUTHORS \
proper_name ("Karl Berry"), \
proper_name ("Sami Kerola"), \
proper_name ("Jim Meyering"), \
proper_name ("Reuben Thomas")

There’s quite a bit of work handling different locales, getopt, converting to multi-byte strings, and more.

There seems to be a more serious tone in the code starting with version 2.6 in 2010, which removed “while the king lives”.  Alas, no comments in the ChangeLog mention the dethroning of the King or removal of –mail.  I believe (based on ChangeLog.O) that it was Karl Berry of the FSF who excised the King’s code from GNU Hello.  I emailed karl@gnu.org but haven’t heard back.  I don’t think he’s been involved with GNU/FSF since the mid-2010s.  There’s an interview with him on the TeX users’ group website.

So Who Was the King?

The King is still listed in AUTHORS.  He also contributed to Gnu Tar.

Googling elvis@graceland.gnu.ai.mit.edu didn’t show up anything outside of GNU, and searching USENET archives only revealed an announcement for GNU Hello 1.2 and 1.3 (which note that “Most GNU software is packed using the new `gzip’ compression program”), and a rather amusing reply when someone cross-posted an alt.sex.stories post to comp.sys.prime (nsfw), which reveals that he signed his name as “M.”

Alas, the King has left MIT:

Elvis Email

Elvis, if you’re out there, drop us a line in the comments!

 

No Comments

    Leave a Reply

    Some notes on commenting on LowEndBox:

    • Do not use LowEndBox for support issues. Go to your hosting provider and issue a ticket there. Coming here saying "my VPS is down, what do I do?!" will only have your comments removed.
    • Akismet is used for spam detection. Some comments may be held temporarily for manual approval.
    • Use <pre>...</pre> to quote the output from your terminal/console, or consider using a pastebin service.

    Your email address will not be published. Required fields are marked *