As requested on GitHub: a tool that will be written, readme2index, will,
as explained:
'... will take the converted HTML from the README.md markdown and
inject it into an HTML template. Things such title, award one and
author information will be injected into the HTML page ahead of the
HTML that was converted from the README.md markdown. Without going
into details of HOW at this time, the result will be a coherent HTML
index.html page with the winner title / award, winning author
information, and important file links come from other sources and
NOT from the README.md file.
The text from the 1st award line, thru the authorship information,
and up to but not including the "## To build:" line in the README.md
file will just get in the way. Moreover authors might be tempted to
try and maintain that top of README.md text instead of working with
the author/_author_handle_.json and winner .winner.json files.
This was done with my[0] sgit(1) (https://github.com/xexyl/sgit) tool like:
sgit -o -n -e '/^## To build:/,$p' '[12][0-9][0-9][0-9]/*/README.md'
[0] Is that shameless self-promotion? I don't know but I don't care: it
is generally a very useful tool and has been used in other repos too.
Besides, I've done it many times before and it's a great example that I
will be adding to the README.md file of the tool, one I hadn't thought
of doing.
3.5 KiB
To build:
make
To use:
./tomx
Try:
rm -f ./tomx
chmod +x ./tomx.c
./tomx.c
./tomx
as well as:
rm -f ./tomx
make -f tomx.c
./tomx
Judges' remarks:
Polyglots have come and gone, but this was the first one we'd seen where one language used another to perform its tasks. An interesting approach. Admittedly, it's not all that obfuscated - but there's more to it than you might think, since you have to make sure that your changes don't change the shell code or the Makefile.
Author's remarks:
Summary
This program works as a C source file, a Makefile and also as a shell
(/bin/sh) script. But unlike some other multi-language programs, this one is
NOT meant to print "Hello, world" in all 3 cases (At least in the true sense
;-)). The C, make and shell code build upon each other to create a C program (?)
which when executed as a shell script will compile itself through the C compiler
using a Makefile! - Pretty useful, Eh?
Probably, this is the first entry ever to fully satisfy Rule #1 ("Your entry must be a complete program") in the strictest sense;-)
Top 5 reasons (IMHO) why this code is an entry for IOCCC
-
A glance at the source itself will tell you that most of the Obfuscation is NOT in the C code per se, but in the comments to the C code. (But sadly, I could not find an "International Obfuscated C COMMENT contest". So I HAD to send this entry here to the IOCCC itself).
-
Of the 3 languages in the source, the least obfuscated is C (But again, there was NO obfuscated make/shscript contest) (Does this hint for a rule in IOCCC-2001 that the major obfuscation should be in C and not elsewhere???. Mmmmm...).
-
Extending Argument #2... Obfuscation done in the C code (comments?) create obfuscated code for the other 2 languages. This opens new possibilities to be explored in depth in future
IOCCCs. -
LOOKS like a Makefile, WORKS like a shell script and COMPILES like a C program.
-
Does something useful (See Notes #1 and #2 below).
Notes
- The program could have been something other than the simple "Hello, world"
program that it is. It is possible to do
#include "prog2.c"in the place of themain(), leaving the complexities of the C file elsewhere and making this source still acceptable tomakeandsh. The following modification to the last few lines will compile the IOCCC's famous mkentry.c.
.PHONY: /* true clean */
#undef true
#include "mkentry.c"
Ain't that useful?
-
By extending this program's idea, It is possible to do some very interesting things like generating C code on execution by adding additional code in make/sh (open up a loop????). This opens the possibilities of generating & compiling some (obfuscated?) C code. (Maybe should try this if this program fails at IOCCC 2000)
-
Changing the
%:%.cdependency to a$(PROG):$(PROG).cform can compile this program with some othermakes (I got it to work in Windows using nmake and Gnuwin32's sh ;-) ) -
Interesting things to do: try
./tomx.c clean. This will do the same asmake clean:-)). Also:./tomx.c all -
Be careful about the tabs in the source code. Removing them or converting tabs to spaces can be disastrous.
Copyright and CC BY-SA 4.0 License:
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/