IOCCC image by Matt Zucker

The International Obfuscated C Code Contest

1998/dorssel - Obsolescent feature

ASCII / Morse code translator

Author:

To build:

    make all

To use:

    ./dorssel
    # input some text

    echo text | ./dorssel

Try:

    ./try.sh

Judges’ remarks:

How does the program decide which way to convert?

What obsolescent feature are we talking about? (No, it’s not a C language feature.)

The author suggests that you try to answer the following questions:

Extra credit:

Try doing what the last part of the last command in try.sh suggests. As in, do the following:

    echo ". -..- . .-. -.-. .. ... .
    -.-. .... .- -. --. .  - .... .  .--. .-. --- --. .-. .- --  ... ---  .. -  -.. --- . ...  -. --- -  ... .... --- ..- -" | ./dorssel

and make the necessary adjustments.

You might also want to read the dorssel.html file.

Author’s remarks:

Usage

This program converts ASCII to Morse code, and vice versa.

The program reads in lines from standard input and writes its result to standard output. The direction of conversion is determined on a per line basis. Each line must consist of a maximum of 952 characters followed by a new line character and they must not contain any NUL characters. Otherwise, some characters may be lost in the conversion.

Notes

The program assumes both source and execution character sets to be ASCII. As far as I can tell, the program is conforming and does not invoke undefined behavior.

Hints

Try:

    ./dorssel < dorssel.c | ./dorssel

to see what variables, numbers, and functions are used. (Does a better job than most C beautifiers).

    ./dorssel < dorssel.c | ./dorssel | ./dorssel | ./dorssel

is the same as

    ./dorssel < dorssel.c | ./dorssel

NOTICE to those who wish for a greater challenge:

If you want a greater challenge, don’t read any further: just try to understand the program without running the command below. If you get stuck, come back and read the below.

The file dorssel.html contains all the information needed to understand this program.

For more information you might also try:

    ./dorssel < dorssel.md

Inventory for 1998/dorssel

Primary files

Secondary files


Jump to: top