Files
ioccc/2000/anderson
Landon Curt Noll ecabb73bf6 add tools to compare entry's manifest with its files
Added `bin/bin/tar-entry.sh` to build a compressed tarball for an
entry.  The compressed tarball is formed by gnu tar with options
so that the same entry file content will always produce the same
compressed tarball, byte for byte.

As some files are missing from some entries, one should
use the `-W` option as in:

```sh
bin/tar-entry.sh -v 5 -W 2020/ferguson1
```

Added `make form_entry_tarball` to the top level `Makefile`
to build entry tarballs even when files are still missing.

Added `make verify_entry_files` to verify that all entries have all
of their files listed in their manifest, plus the top level ioccc.css
and var.mk files.  As file entry files are still missing (due to
HTML files that need to be built), the overall `make quick_www` and
`make www` do **NOT** (yet) exit when the `make verify_entry_files`
fails.

Improved `bin/chk-entry.sh` by removing some variables
that were not needed.

TODO: Improve `bin/` tool exit codes as the current use is a bit silly.

TODO: Clean out some variables used in `bin/` tools as some of then
are only set printed in debug statements.

TODO: Clean up usage messages, some of the options listed to not
match the `getopts(1)` parsing.  In some cases the option needs to
be parsed but needs to be ignored by the tool because another tool
automatically passes along certain options that really have no
effect.  Such ignored options need to be show as "This option is
ignored" in the usage message.
2024-02-13 03:29:54 -08:00
..
2024-02-01 14:35:49 -08:00
2023-07-06 21:49:38 -07:00
2023-12-26 09:00:03 -08:00
2024-01-15 04:29:39 -08:00
2024-02-05 09:10:13 -08:00

To build:

make

To use:

echo something | ./anderson

Try:

./try.sh

Judges' remarks:

This small program might be a nice addition to a digital personal organizer; just in case you are stranded on a desert island and need to signal your distress to passing ships.

The obfuscation in this program is truly masterful. The program is very cleverly obscured without the use of a single #define! Reformatting this program by hand :-) is the easiest way to understand what is going on.

Note about #defines not being used:

In 2023 due to annoying warnings triggered at different times, sometimes interspersed with the output of the program (this happens in macOS), many entries were changed to use fgets(3) instead. However to make the entries more like the original we redefined gets to use fgets. Unfortunately it's not possible to do it through -Dfoo compiler options so there is a #define in the code now.

Author's remarks:

This program is a simple filter that translates ASCII text into semaphore code. It reads from standard input and converts all alphanumeric characters to their corresponding semaphore codes. Consecutive whitespace is translated as a single 'break' code. Newlines also cause the next code to be output on a new line. All other characters are ignored. The codes themselves are written to standard output as a depiction of a person holding two flags, using only ASCII characters (semaphore smileys, if you will). For example, given the input "Hello, world!", the output will be:

	      <>       <>       <>    <>                  <>     <>
  _()       ()/      ()/      ()/     _\)       ()       (/_     _\)
[] /^      |^^      /^^      /^^    [] ^^      |^^|      ^^ [] [] ^^
  <>[      [][     <>][     <>][       ][      [][]      ][       ][


	      <>    []
  _()_      ()/     |()       ()
[] ^^ []   /^^       ^^|     |^^|
   ][     <>][       ][]     [][]

The program is obfuscated without the use of the preprocessor or any special compilation parameters. In fact, the program doesn't even bother using any keywords, save the single char at the beginning. This program was crafted using only operator precedence rules, short-circuit evaluation and recursion. Each function contains a single, non-empty statement. (I did have to add a couple of empty statements to format the code properly.) There is a single string constant which encodes the flag positions and other data needed for drawing the semaphore codes.

The preprocessor will provide no help in de-obfuscating this code, and a C beautifier won't get you very far either. You just have to crunch through it.

An ANSI C compiler will generate several warnings when it compiles this program, as none of the functions declare their return type, nor do they return anything. This was necessary to keep the program free of keywords. It's valid in K&R C, and compiles in ANSI C. There are also warnings about conversion from int to char and the resulting loss of data. Again, if it's OK with K&R, it's OK with me.

This program is a great teaching tool for learning the semaphore code; and if you don't have any flags handy you can just use two copies of the source file.

This file is Copyright (c) 2023 by Landon Curt Noll. All Rights Reserved. You are free to share and adapt this file under the terms of this license:

Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)

For more information, see: https://creativecommons.org/licenses/by-sa/4.0/