diff --git a/1991/ant/.entry.json b/1991/ant/.entry.json
index 4291db44e..0925e9583 100644
--- a/1991/ant/.entry.json
+++ b/1991/ant/.entry.json
@@ -41,6 +41,30 @@
"display_via_github" : true,
"entry_text" : "original source code"
},
+ {
+ "file_path" : "deobfuscated/ant-c89.c",
+ "inventory_order" : 140,
+ "OK_to_edit" : true,
+ "display_as" : "c",
+ "display_via_github" : true,
+ "entry_text" : "author provided deobfuscated code converted from K&R"
+ },
+ {
+ "file_path" : "deobfuscated/ant.c",
+ "inventory_order" : 140,
+ "OK_to_edit" : true,
+ "display_as" : "c",
+ "display_via_github" : true,
+ "entry_text" : "author provided deobfuscated code"
+ },
+ {
+ "file_path" : "deobfuscated/Makefile",
+ "inventory_order" : 150,
+ "OK_to_edit" : true,
+ "display_as" : "c",
+ "display_via_github" : true,
+ "entry_text" : "author provided Makefile for deobfuscated code"
+ },
{
"file_path" : "1991_ant.tar.bz2",
"inventory_order" : 1415926535,
diff --git a/1991/ant/.gitignore b/1991/ant/.gitignore
index 587fcf92c..209eb3816 100644
--- a/1991/ant/.gitignore
+++ b/1991/ant/.gitignore
@@ -3,6 +3,8 @@
*.dSYM
ant
ant.alt
+ant.alt2
+ant.alt2-c89
ant.orig
hill
indent
diff --git a/1991/ant/Makefile b/1991/ant/Makefile
index 162b91643..b8612e1e5 100644
--- a/1991/ant/Makefile
+++ b/1991/ant/Makefile
@@ -119,8 +119,8 @@ OBJ= ${PROG}.o
DATA= README.md
TARGET= ${PROG} hill mole
#
-ALT_OBJ= ${PROG}.alt.o
-ALT_TARGET= ${PROG}.alt
+ALT_OBJ= ${PROG}.alt.o deobfuscated/${PROG}.o
+ALT_TARGET= ${PROG}.alt deobfuscated/${PROG}
#################
@@ -151,6 +151,29 @@ mole: ${PROG}.c hill
alt: data ${ALT_TARGET}
@${TRUE}
+${PROG}.alt: ${PROG}.alt.c hill
+ ${CC} ${CFLAGS} $< -o $@ ${LDFLAGS}
+
+# We keep the deobfuscated source code and Makefile in deobfuscated/, and use
+# that Makefile but then move the compiled programs to the entry's directory to
+# keep both directories clean and to allow the deobfuscated Makefile and code to
+# be used but not require the user to do:
+#
+# ./deobfuscated/ant
+# ./deobfuscated/ant-c89
+#
+# but rather simply:
+#
+# ./ant.alt2
+# ./ant.alt2-c89
+#
+# The alt2 is because this is the secondary alt.
+deobfuscated/${PROG}: deobfuscated/${PROG}.c deobfuscated/${PROG}-c89.c
+ ${MAKE} -C deobfuscated ant
+ ${MV} -vf deobfuscated/ant ant.alt2
+ ${MAKE} -C deobfuscated ant-c89
+ ${MV} -vf deobfuscated/ant-c89 ant.alt2-c89
+
# data files
#
data: ${DATA}
@@ -217,7 +240,7 @@ clean:
clobber: clean
${RM} -f ${TARGET} ${ALT_TARGET}
- ${RM} -rf *.dSYM
+ ${RM} -rf *.dSYM ant.alt ant.alt2 ant.alt2-c89
@-if [ -e sandwich ]; then \
${RM} -f sandwich; \
echo 'ate sandwich'; \
diff --git a/1991/ant/README.md b/1991/ant/README.md
index 04cce98b2..ca830f3fb 100644
--- a/1991/ant/README.md
+++ b/1991/ant/README.md
@@ -4,8 +4,9 @@
make all
```
-There is an [alternate version](#alternate-code) that might feel a bit more
-familiar to vi(m) users.
+There is an alternate version that might feel a bit more familiar to vi(m)
+users. Additionally, the author provided deobfuscated versions including one for
+C89. See [Alternate code](#alternate-code) below.
## To use:
@@ -33,12 +34,20 @@ program exit without doing anything.
## Alternate code:
-This version changes the commands slightly so that to go to the first column you
-should enter `0`, to go to the last column you should enter `$`, to quit you
-should enter `q`, to go back a word you should enter `b` and to go forwards a
-word you should enter `w`. Also, and perhaps most useful, rather than having to
-hit ctrl-L (form-feed, `\f`) to get back to command mode you can use the usual
-ESC (`\x1b`).
+The author provided us with deobfuscated versions including one for C89. The two
+C files in `deobfuscated`,
+[deobfuscated/ant.c](%%REPO_URL%%/1991/ant/deobfuscated/ant.c) and
+[deobfuscated/ant-c89.c](%%REPO_URL%%/1991/ant/deobfuscated/ant-c89.c) and the
+[deobfuscated/Makefile](%%REPO_URL%%/1991/ant/deobfuscated/Makefile) will allow
+you to look at them and compile them if you wish. These are exactly like the
+original in every way, including in use, except they are deobfuscated.
+
+The other version, [ant.alt.c](%%REPO_URL%%/1991/ant/ant.alt.c) changes the
+commands slightly so that to go to the first column you should enter `0`, to go
+to the last column you should enter `$`, to quit you should enter `q`, to go
+back a word you should enter `b` and to go forwards a word you should enter `w`.
+Also, and perhaps most useful, rather than having to hit ctrl-L (form-feed,
+`\f`) to get back to command mode you can use the usual ESC (`\x1b`).
These will make it slightly less unwieldy for those familiar with vi(m); the
rest was unchanged.
@@ -53,8 +62,10 @@ rest was unchanged.
### Alternate use:
-Use `ant.alt` as you would `ant` above with the changes in the input keys. See
-the author's remarks for the remaining keys.
+For the deobfuscated versions, use `ant.alt2` and `ant.alt2-c89` as you would
+`ant` above; for the other one, `ant.alt`, use it as you would `ant` above but
+with the changes in the input keys described above. See the author's remarks for
+the remaining commands.
## Judges' remarks:
diff --git a/1991/ant/deobfuscated/Makefile b/1991/ant/deobfuscated/Makefile
new file mode 100644
index 000000000..e99ba8050
--- /dev/null
+++ b/1991/ant/deobfuscated/Makefile
@@ -0,0 +1,34 @@
+#
+# Anthony's Editor
+#
+# IOCCC 1991
+#
+# Winner Best Utility
+#
+
+CFLAGS = -Os -Wno-deprecated-non-prototype
+
+all: build
+
+build: ant ant-c89
+
+clean:
+ -rm -f ant ant-c89
+
+# NOTE: some systems may need:
+#
+# old SYS V:
+# cc ${CFLAGS} -DMODE=0600 -DBUF=32767 -o ant ant.c -lcurses
+# ATARI ST:
+# cc -DMODE=0 -DBUF=32767 -o ant.ttp ant.c curses.a
+# PC class:
+# wcl -mc -DMODE=0 -DBUF=32767 ant.c curses.lib
+#
+# This older version may generate lots of warnings with newer compilers.
+#
+ant: ant.c
+ ${CC} ${CFLAGS} -DMODE=0600 -DBUF=32767 ant.c -o $@ -lcurses -ltermcap
+
+# Mostly cosmetic changes to read like ANSI C 89.
+ant-c89: ant-c89.c
+ ${CC} ${CFLAGS} -DMODE=0600 ant-c89.c -o $@ -lcurses -ltermcap
diff --git a/1991/ant/deobfuscated/ant-c89.c b/1991/ant/deobfuscated/ant-c89.c
new file mode 100644
index 000000000..142c5f425
--- /dev/null
+++ b/1991/ant/deobfuscated/ant-c89.c
@@ -0,0 +1,371 @@
+/*
+ * Anthony's Editor
+ *
+ * Public Domain 1991, 2023 by Anthony Howe. All rights released.
+ */
+
+#include There is an alternate version that might feel a bit more
-familiar to vi(m) users. There is an alternate version that might feel a bit more familiar to vi(m)
+users. Additionally, the author provided deobfuscated versions including one for
+C89. See Alternate code below. NOTE: the file must already exist and not specifying any arg will make the
@@ -415,19 +416,28 @@ program exit without doing anything. This version changes the commands slightly so that to go to the first column you
-should enter The author provided us with deobfuscated versions including one for C89. The two
+C files in The other version, ant.alt.c changes the
+commands slightly so that to go to the first column you should enter These will make it slightly less unwieldy for those familiar with vi(m); the
rest was unchanged. Use For the deobfuscated versions, use The author was kind enough to supply a list of references below,
in case you are still confused after read the source! :-)To build:
- make allTo use:
./ant some_file make mole
./ant moleAlternate code:
-0, to go to the last column you should enter $, to quit you
-should enter q, to go back a word you should enter b and to go forwards a
-word you should enter w. Also, and perhaps most useful, rather than having to
-hit ctrl-L (form-feed, \f) to get back to command mode you can use the usual
-ESC (\x1b).deobfuscated,
+deobfuscated/ant.c and
+deobfuscated/ant-c89.c and the
+deobfuscated/Makefile will allow
+you to look at them and compile them if you wish. These are exactly like the
+original in every way, including in use, except they are deobfuscated.0, to go
+to the last column you should enter $, to quit you should enter q, to go
+back a word you should enter b and to go forwards a word you should enter w.
+Also, and perhaps most useful, rather than having to hit ctrl-L (form-feed,
+\f) to get back to command mode you can use the usual ESC (\x1b).Alternate build:
make altAlternate use:
-ant.alt as you would ant above with the changes in the input keys. See
-the author’s remarks for the remaining keys.ant.alt2 and ant.alt2-c89 as you would
+ant above; for the other one, ant.alt, use it as you would ant above but
+with the changes in the input keys described above. See the author’s remarks for
+the remaining commands.Judges’ remarks:
make all
+The author provided us with an unobfuscated version. See Alternate +code below.
./ant Makefile
@@ -410,6 +412,15 @@ Location: CA - Canada
where Makefile is a Makefile to use and rule is an optional rule to use.
Try:
./try.sh
+Alternate code:
+This version, ant.c in deobfuscated/, was provided by the
+author in 2024, and is a deobfuscated version.
+Alternate build:
+ make alt
+Alternate use:
+Use ant.alt as you would ant above.
+Try:
+ ./try.alt.sh
Judges’ remarks:
Like much of POSIX, obfuscation has its place. Your task is to
figure out where.
@@ -447,8 +458,13 @@ P1003 subcommittee.
- Makefile - entry Makefile
- ant.orig.c - original source code
- try.sh - script to try entry
+- deobfuscated/ant.c - author provided deobfuscated code
+- deobfuscated/sleep.c - author provided code for those who need a nap
- ant.README.txt - am man page
- ant.test.mk - Makefile to demonstrate entry
+- deobfuscated/Makefile - author provided Makefile for deobfuscated code
+- try.alt.sh - script to try deobfuscated code
+- ant.test.alt.mk - Makefile to demonstrate deobfuscated code
make all
+The author provided a deobfuscated version. See Alternate +code below.
The current status of this entry is:
STATUS: INABIAF - please DO NOT fix
@@ -412,6 +414,17 @@ Location: CA - Canada
./ant 'ERE' [file ...]
Try:
./try.sh
+Alternate code:
+The ant.c in deobfuscated/ is a
+deobfuscated version provided by the author. You can look at this code if you
+want some clues in how it works.
+Alternate build:
+If you wish to build this deobfuscated version, you can do so like:
+ make alt
+Alternate use:
+Use ant.alt like you would ant above.
+Alternate try:
+ ./try.alt.sh
Judges’ remarks:
See the author’s POSIX P1003.2-like documentation file ant.txt for
more information.
@@ -459,8 +472,14 @@ more information.
- ant.orig.c - original source code
- ant.txt - ag man page
- try.sh - script to try entry
+- deobfuscated/ant-c89.c - author provided deobfuscated code converted from K&R
+- deobfuscated/ant.c - author provided deobfuscated code
+- try.alt.sh - script to try deobfuscated code
+- deobfuscated/Makefile - author provided Makefile for deobfuscated code
+- deobfuscated/test.mk - author provided test suite Makefile for deobfuscated code
- ants.txt - lyrics of the Ants Go Marching song
- ant.test.mk - test suite Makefile
+- ant.alt.test.mk - test suite Makefile for deobfuscated code
Cody added alternate code that will be a bit easier to use for -those familiar with vim in the following ways (we don’t want vi users to also -not be able to use it or exit it, now do we ? :-) ):
+The author, Anthony C Howe, provided a
+deobfuscated version which was put in by Cody with thanks to Anthony!
+The deobfuscated directory has the code and Makefile. The entry’s Makefile was
+updated to compile the alt code, if make alt is used, but in a way that keeps
+both directories clean (the deobfuscated version will not be in the entry’s
+directory and vice versa) but also allowing one to just do ./ant.alt2 (see
+below for why alt2). There are two versions here,
+deobfuscated/ant.c and
+deobfuscated/ant-c89.c along
+with the Makefile. The latter C file was converted from K&R by Anthony (the
+other one did not compile without a few fixes made by Cody).
Cody also added alternate code that +will be a bit easier to use for those familiar with vim in the following ways +(we don’t want vi users to also not be able to use it or exit it, now do we ? +:-) ):
0 to go to first column.$ to go to last column.q to exit.The other keys were left unchanged.
+(As this was done first it was left as alt and not changed to alt2.)
\ but should have been.
necessary to include time.h so Cody did this as well as this exists in other
systems too.
Cody also added the try.sh script.
+The author, Anthony C Howe, provided a
+deobfuscated version that Cody added in, with thanks to Anthony! The source code
+and the Makefile as well as sleep.c are in the deobfuscated/ directory.
+The entry’s Makefile was updated in a way that keeps the deobfuscated code
+separate from the entry’s code but which allows one to use the deobfuscated
+Makefile when compiling the alt code (via make alt). For this version,
+try.alt.sh was added and an alternate test
+Makefile (along the lines of the author’s provided test Makefile) was added,
+updated to use ant.alt.
Cody added the try.sh script and a data file, ants.txt, full of ants for the script.
+The author, Anthony C Howe, provided a
+deobfuscated version that Cody added in, with thanks to Anthony! The source code
+(which might have had to be fixed to compile with modern compilers whereas the
+-c89 version was converted from K&R and worked without any fixes) and its
+Makefile was put in the deobfuscated subdirectory to keep them separate. The
+entry’s Makefile was updated so that it uses the deobfuscated version’s Makefile
+but allowing one to run ./ant.alt.