Merge pull request #1409 from xexyl/bas198

This commit is contained in:
Landon Curt Noll authored and GitHub committed 2023-11-13 21:40:06 -07:00
commit 522f9d0c06
18 files changed
+323 -104

No files matched your search

+1
View File
@@ -1,3 +1,4 @@
bas1
bas1.orig
bemazing
prog.orig
+6 -2
View File
@@ -40,7 +40,7 @@ include ../../var.mk
#
CSILENCE= -Wno-bitwise-conditional-parentheses -Wno-bitwise-op-parentheses \
-Wno-empty-body -Wno-invalid-source-encoding -Wno-main -Wno-parentheses \
-Wno-shift-op-parentheses -Wno-deprecated-non-prototype
-Wno-shift-op-parentheses -Wno-deprecated-non-prototype -Wno-implicit-int
# Common C compiler warning flags
#
@@ -114,7 +114,7 @@ PROG= ${ENTRY}
#
OBJ= ${PROG}.o
DATA=
TARGET= ${PROG}
TARGET= ${PROG} bemazing
#
ALT_OBJ=
ALT_TARGET=
@@ -135,6 +135,10 @@ all: data ${TARGET}
${PROG}: ${PROG}.c
${CC} ${CFLAGS} $< -o $@ ${LDFLAGS}
bemazing: ${PROG}
${RM} -f $@
${CP} $< $@
# alternative executable
#
alt: data ${ALT_TARGET}
+10 -8
View File
@@ -10,19 +10,19 @@ make all
If `lpr` on your system can print PostScript:
```sh
./bas1 | gunzip | lpr
./bemazing | gunzip | lpr
```
else, while in X Window System,
```sh
./bas1 | gunzip | gv -
./bemazing | gunzip | gv -
```
or:
```sh
./bas1 | gunzip | gs -sDEVICE=pgmraw -sOutputFile='|xv -' -
./bemazing | gunzip | gs -sDEVICE=pgmraw -sOutputFile='|xv -' -
```
@@ -47,19 +47,21 @@ creates a 3D maze of beams. Try to go from the entrance (the
unfinished beam in one corner) to the exit (the unfinished beam in the
opposite corner) or vice versa.
For maximum portability, `Bemazing` is not tied to any window system,
but creates postscript. The picture it makes will fit on either A4 or
letter size paper.
For maximum portability, `Bemazing` is not tied to any window system, but
creates postscript output. The picture it makes will fit on either A4 or letter
size paper.
In addition, because postscript is rather verbose, `Bemazing` creates
the postscript in gzip format, in order to save precious bits on your
hard disk for the latest version of GNU Emacs (after all, you wouldn't
the postscript in `gzip(1)` format, in order to save precious bits on your
hard disk for the latest version of [GNU
Emacs](https://www.gnu.org/software/emacs/) (after all, you wouldn't
want to use an editor without a psychoanalyze-pinhead function, now
would you). Again for maximum portability, `Bemazing` will take special
care that the binary output will not contain any newline or return
characters that may get weird treatment on systems that do not use the
One True Line Separator.
### NOTES
Be sure to view the source with something that can display characters
+15 -3
View File
@@ -8,12 +8,23 @@ make all
## To use:
```sh
./bas2 < bas2.c
./bas2 < file
echo text | ./bas2
```
## Try:
```sh
./try.sh
./try.sh "foo bar" "baz" "IOCCC 1998/bas2" README.md
```
## Judges' remarks:
### Questions to ponder:
Can you determine the relationship between the input and the resulting numeric
@@ -22,6 +33,7 @@ output?
The program was not designed to process files with a certain octet value, what
value is that?
### Hint and Extra Credit:
This entry points out a minor flaw in the IOCCC rules that has
@@ -40,10 +52,10 @@ done by matching the bit patterns. Minor obfuscations are:
- Useless variable names.
- Recursive main() instead of 2 loops (over input characters and over bits in
- Recursive `main()` instead of 2 loops (over input characters and over bits in
the character).
- `?` and `||` instead of if statements.
- `?:` and `||` instead of if statements.
## Copyright and CC BY-SA 4.0 License:
+38
View File
@@ -0,0 +1,38 @@
#!/usr/bin/env bash
#
# try.sh - demonstrate 1998/bas2
#
# If any args are specified it checks if it's a readable file and if it is it
# feeds it to the program. If not it assumes it's a string and feeds that to the
# program.
#
make all || exit 1
echo "$ ./bas2 < bas2.c" 1>&2
./bas2 < bas2.c
echo "$ ./bas2 < README.md" 1>&2
./bas2 < README.md
echo "$ ./bas2 < Makefile" 1>&2
./bas2 < Makefile
echo "$ echo foo bar baz | ./bas2" 1>&2
echo foo bar baz | ./bas2
echo "$ cat README.md Makefile bas2.c | ./bas2" 1>&2
cat README.md Makefile bas2.c | ./bas2
# while we have an arg check if it's a file. If it is a regular file that is
# readable feed it to the program; otherwise act as if it's a string.
while [[ "$#" -gt 0 ]]; do
if [[ -f "$1" && -r "$1" ]]; then
echo "$ ./bas2 < $1" 1>&2
./bas2 < "$1"
else
echo "$ echo $1 | ./bas2" 1>&2
echo "$1" | ./bas2
fi
shift 1
done
+4 -4
View File
@@ -29,7 +29,7 @@ a nice example of a compact collection of obfuscations.
Can you figure out why, in some cases, it wants to read itself?
## Selected Author's Comments:
## Author's remarks:
### Usage
@@ -48,13 +48,13 @@ interrupted by user input.
### Features (aka Bugs):
Memory malloced is never freed. This shouldn't be a big deal,
Memory `malloc(3)`ed is never freed. This shouldn't be a big deal,
since only one block is ever allocated, and the OS should recover it.
My local flavor of lint doesn't seem to like the fact that I never
`return` from main. Feh, what does it know? Otherwise, ignoring
`return` from `main()`. Feh, what does it know? Otherwise, ignoring
lint's over protectiveness ("Of course I'm not using all of the
functions defined in curses.h!"), it's lint clean.
functions defined in `curses.h`!"), it's lint clean.
If the compiler happens to generate the byte sequence "AlWuzEre"
in the executable by chance, the program may be unable to locate
+1 -1
View File
@@ -40,7 +40,7 @@ include ../../var.mk
#
CSILENCE= -Wno-bitwise-op-parentheses -Wno-char-subscripts -Wno-pointer-to-int-cast \
-Wno-return-type -Wno-unused-parameter -Wno-unused-variable \
-Wno-typedef-redefinition -Wno-deprecated-non-prototype
-Wno-typedef-redefinition -Wno-deprecated-non-prototype -Wno-implicit-int
# Common C compiler warning flags
#
+9 -10
View File
@@ -23,7 +23,7 @@ the program are used.
Curiously, the program only works if its source is in the directory
it's run in. More curiously, the program would fail if the program's
name's second letter wasn't `r` (the source has been changed for your
convenience and this restriction does no longer exist).
convenience and this restriction no longer exist).
Modern design has come a long way since the unreadable, tightly-coupled
systems we used to have.
@@ -44,7 +44,7 @@ itself. You can guess a letter simply by typing it in. If your C
implementation requires it, you may have to hit Return before it
is recognized. In this case, you can also type multiple guesses
on the same line (completely solve it by entering
"abcdefghijklmnopqrstuvwxyz"). Execution stops when all underscores
`abcdefghijklmnopqrstuvwxyz`). Execution stops when all underscores
have been replaced.
The program offers a number of different words to guess, `time()` is
@@ -76,7 +76,7 @@ to `#define`. I have also included comments in the code, and vital
code in the comments. And of course there is code that doesn't do
anything but will crash the program if it is removed (just like
those comments I mentioned above). Additionally, since you said
you'd be preprocessing entries ignoring includes I figured I should
you'd be preprocessing entries ignoring `#include`s I figured I should
use some more of them instead of other obfuscation methods. Did
I mention that preprocessed or beautified sources will crash or
hang your system? The program will also crash on non-ASCII machines.
@@ -99,7 +99,7 @@ These restrictions have been removed for your convenience.
The following lines describe how this program works; if you don't
want to know it at this time, please skip them. If this entry would
by some mistake win the contest, please do not rot13 this - I hate
rot13'd spoilers since it is somewhat complicated on a Mac to
rot13 spoilers since it is somewhat complicated on a Mac to
reverse them. Anyone out there should have enough discipline and
rot13 shouldn't be required, really. After all, we are not children
anymore :-)
@@ -123,7 +123,7 @@ spread over six lines in the source; decoding starts on a line
after a tab and a whitespace have been found, and stops on a newline.
The grin after the "Demonic Smiley" actually is one encoded letter
while the string is completely ignored; and the `cut` in "cut here"
is required while "here" is not.
is required while `here` is not.
"For extra credit", explain why the words are sorted alphabetically
(because I extracted them from a dictionary :-) )
@@ -131,17 +131,16 @@ is required while "here" is not.
The file name had to fulfill the restrictions mentioned above
because `__FILE__+1` was used as a second parameter to `fopen()`. (It
essentially was `fopen(__FILE__,__FILE__+1)` ). This was an extra joke
that does no longer exist in the released version.
that doesn't exist in the released version.
You probably discovered that the `while(FILE)` in main is not a while loop
You probably discovered that the `while(FILE)` in `main()` is not a while loop
but the statement that opens the file and initializes the dictionary.
Similarly, int and signed have been redefined (to save space, of
course).
Similarly, `int` and `signed` have been redefined (to save space, of course).
The main function (the guessing part) is between the last `#else..#endif`,
but still is declared before `main()`. The `5[O]()` in `main()` calls
this function. Similarly, most indexing operations have been
changed to this form; and I tried to write each such operation
changed to this form and I tried to write each such operation
different.
+3 -3
View File
@@ -1,5 +1,5 @@
#ifndef int
typedef int lint;
typedef int _int;
#ifdef while
char s[234],d[56],*p=s,m='m';
#define int typedef (*define)();\
@@ -10,14 +10,14 @@ signed short n(short bz){
char o=1,i=1,l,pc=i,b=r+o/2,_f=6,m=7,s=8,g,q,od=o*rs+4^s,js=_f/*3-m*'c',bs='g';
return 1; }
#y FILE c[a]+s,p[c],r[m]+u[i+4*o|f]-r[wob][wad]+s*f-!w|o,L+x | cut
;}int main(lint i,char**love_unix){*/;}int main(lint i,char**love_unix){/*;}int main(lint i,char**love_unix){*\;}| here */
;}int main(i,love_unix)_int i;char**love_unix;{*/;}int main(i,love_unix)_int i;char**love_unix;{/*;}int main(i,love_unix)_int i;char**love_unix;{*\;}| here */
while(FILE)for(;9-(i=0[O](f)););
for(;32-(i=0[O](f));0&& 3[O]("-->%s<--", "gxdgbtgxsxpcctvpixktedhiedcte"));
for(;'\n'-(i=O[0](f));)(i>='a'&&i<'z')?*
#include __FILE__
"Demonic Smiley" );} /* <g> */
#else
#define while(int) short c=0;int*f=fopen(__##int##__,"r");for(i=0;i<25;i _)i[d]='A'+(13+i)%26;main:
#define while(int) short c=0;FILE*f=fopen(__##int##__,"r");for(i=0;i<25;i _)i[d]='A'+(13+i)%26;main:
#define y define
#define _ ++
#include <stdio.h>
+1
View File
@@ -3,3 +3,4 @@ dlowe.alt
README.poot.md
dlowe.orig
prog.orig
make.1
+39 -5
View File
@@ -33,6 +33,12 @@ For more detailed information see [1998 dlowe in bugs.md](/bugs.md#1998-dlowe).
Why is there different output?
Also try:
```sh
./try.sh
```
## Alternate code:
@@ -58,8 +64,10 @@ a CGI program: <https://web.archive.org/web/20001025182142/http://pootpoot.com/p
We are sure that you will find that new web page to make a much
more consistent level of quality. :-)
A CGI script such as:
### Historical remarks:
A CGI script such as:
```sh
#!/bin/sh
@@ -85,9 +93,35 @@ else
fi
```
can be used to pootify web pages.
could be used to pootify web pages. It was noticed in 2023, however, that
`lynx(1)` does not work well and `links(1)` does not have the same security
protections that `lynx(1)` does. Thus it might be unwise to use as a CGI script.
For further information see:
The [pootify.sh](pootify.sh) script has been added which is a modification to
the above which can be used to render html files locally with the added bonus
that one can use `file://` URLs. If one uses it as a CGI script (whether
modifying it to use `lynx(1)` or not) they might want to uncomment the check in
the script for `file://` based URLs. It has not been tested as a CGI script with
lynx(1) so it's maybe possible that it would work this way.
You can use this script, however, to download and generate html files that you
can look at locally in a browser or pipe through `less(1)`. For instance:
```sh
./pootify.sh URL=https://microsoft.com | less
./pootify.sh -r URL=https://microsoft.com > ms.html
```
where the first one would show the text as rendered but without links, images
etc. and the second one would write the html to ms.html so that you could open
it in a browser.
If one does use it as a CGI script you'll want to check out
[pootify.cgi.sh](pootify.cgi.sh) which forbids `file://` based URLs and which
uses `lynx(1)` with the option referred to above.
For an old example of it working as a CGI script see:
```sh
https://web.archive.org/web/20040326083431/http://www.pootpoot.com/poot/pootify/?URL=http%3A%2F%2Fwww.ioccc.org
@@ -96,8 +130,8 @@ https://web.archive.org/web/20040326083431/http://www.pootpoot.com/poot/pootify/
## Author's remarks:
This program is a text filter, it reads stdin and outputs the
"corrected" text to stdout.
This program is a text filter, it reads `stdin` and outputs the
"corrected" text to `stdout`.
It is obfuscated in that the code is painful to look at and
its purpose and mode of operation are not terribly obvious.
+2 -2
View File
@@ -2,7 +2,7 @@
#define PO(o,t)\
(((o>64)&&(o<91))?(((t>96)&&(t<123))?(t-32):(t)):(((t>64)&&(t<91))?(t+32):(t)))
void main() { char *poo="poot",
int main() { char *poo="poot",
*Poo="pootpoot" ,O[9],o;int t, T;(t=0)|| (*O='\0');while(
(o= getc( stdin ))!=( EOF))if (((o> 64)&&
(o< 91)) ||(( o>96 )&&(o <123 ))) (
@@ -14,5 +14,5 @@
("%c", PO(*(O
+T),*( poo+T)
) ); printf( "%c", o ) ; } else printf("%s%c", O, o); ( t =0) || (*O='\0'); } }
) ); printf( "%c", o ) ; } else printf("%s%c", O, o); ( t =0) || (*O='\0'); } return 0;}
+2 -2
View File
@@ -2,7 +2,7 @@
#define PO(o,t)\
(((o>64)&&(o<91))?(((t>96)&&(t<123))?(t-32):(t)):(((t>64)&&(t<91))?(t+32):(t)))
void main() { char *poo= "poot",
int main() { char *poo= "poot",
*Poo="pootpoot" ,O[9];int o,t,T,p;(t=p =0)||(*O='\0');while
((o= getc( stdin ))!=( EOF))if ((p== 0)&& (((o>64 )&& (
o<91 )) || ((o> 96 ) &&(o< 123) ))) (
@@ -15,4 +15,4 @@
+T),*( poo+T)
) ) ; printf( "%c" , o ) ; } else printf ( "%s%c" , O , o ) ; ( t = 0 ) || (
* O = '\0' ) ; ( o == 60 ) && ( ++p ) ; ( o == 62 ) && (p!=0) && ( --p ) ; } }
* O = '\0' ) ; ( o == 60 ) && ( ++p ) ; ( o == 62 ) && (p!=0) && ( --p ) ; } return 0;}
+25
View File
@@ -0,0 +1,25 @@
#!/usr/bin/env bash
#
# pootify.cgi.sh - a sample CGI pootifier
#
POOT="./dlowe"
LYNX="lynx"
ECHO="echo"
EXPR="expr"
${ECHO} "Content-type: text/html"
${ECHO}
QUERY_STRING="$1"
if [[ -z "${QUERY_STRING}" ]]; then
${ECHO} "QUERY_STRING not found"
else
URL="$(${EXPR} "$QUERY_STRING" : '[Uu][Rr][Ll]=\(.*\)')"
if [[ -z "${URL}" ]]; then
${ECHO} "No URL given in QUERY_STRING"
elif [[ X"$(${EXPR} "${URL}" : '[Ff][Ii][Ll][Ee]:')" != X0 ]]; then
${ECHO} "file: based URLs are not allowed"
else
${LYNX} -restrictions=all -source "${URL}" | ${POOT}
fi
fi
+53
View File
@@ -0,0 +1,53 @@
#!/usr/bin/env bash
#
# Script to download a page and pootify it. You can pipe it through less(1) to
# see the output or you can redirect it to a file and open it in your local
# browser (use the -r option for that).
#
# Note from 2023: this used to be a CGI script that used lynx(1) which has
# security features but lynx does not work with redirects, it would appear, and
# unfortunately links(1) does not have such restrictions. If you wanted to use
# it anyway you could change the -dump to -source and see how it goes. It might
# also be that if it was used as a CGI script it would work well but this has
# not been tested.
#
# Example uses:
#
# ./pootify.sh URL=https://microsoft.com | less
#
# ./pootify.sh -r URL=https://microsoft.com > ms.html
#
# and then open ms.html in your local browser. Neither are as nice as a rendered
# html page as a script from another page and certainly it's less convenient but
# you can at least enjoy the output somewhat, the latter one more so, perhaps.
#
POOT="./dlowe"
LINKS="links"
ECHO="echo"
EXPR="expr"
RAW=""
${ECHO} "Content-type: text/html"
${ECHO}
if [[ "$#" -eq 2 ]]; then
if [[ "$1" = "-r" ]]; then
RAW="-r"
fi
shift 1
fi
QUERY_STRING="$1"
if [[ -z "${QUERY_STRING}" ]]; then
${ECHO} "QUERY_STRING not found"
else
URL="$(${EXPR} "$QUERY_STRING" : '[Uu][Rr][Ll]=\(.*\)')"
if [[ -z "${URL}" ]]; then
${ECHO} "No URL given in QUERY_STRING"
# if used as a CGI script uncomment the below:
#elif [[ X"$(${EXPR} "${URL}" : '[Ff][Ii][Ll][Ee]:')" != X0 ]]; then
# ${ECHO} "file: based URLs are not allowed"
elif [[ -n "$RAW" ]]; then
${LINKS} -source "${URL}" | ${POOT}
else
${LINKS} -dump "${URL}" | ${POOT}
fi
fi
+3 -3
View File
@@ -53,7 +53,7 @@ make alt
### Alternate use:
```sh
./pootris.alt
./pootris.alt [X size of board] [Y size of board]
```
@@ -145,8 +145,8 @@ than one way simultaneously.
- Several different coordinate systems are used. There's the "real" X by Y
system used for curses, the "inside the box" X by Y system used for moving
things around and finding instances of `POOT` inside the box, and the position
of the current letter, which is a single value from 0 to `2 * xsize + 2 * ysize
- 1`.
of the current letter, which is a single value from `0` to
`2 * xsize + 2 * ysize - 1`.
- The fact that `x%3` is a perfect hash function for `x` values `P`, `O` and `T`
is used.
+78 -60
View File
@@ -1,60 +1,53 @@
# FAQ Table of Contents
## Section 0 - [History of the IOCCC](#faq0)
### FAQ 0.0 - [How did the IOCCC get started?](#faq0_0)
### FAQ 0.1 - [Why are some years missing IOCCC winners?](#faq0_1)
### FAQ 0.2 - [Why do some IOCCC winners receive the Grand Prize or Best of Show award?](#faq0_2)
- [0.0 - How did the IOCCC get started?](#faq0_0)
- [0.1 - Why are some years missing IOCCC winners?](#faq0_1)
- [0.2 - Why do some IOCCC winners receive the Grand Prize or Best of Show award?](#faq0_2)
## Section 1 - [Submitting entries to a new IOCCC](#faq1)
### FAQ 1.0 - [What types of entries have been over-submitted to the IOCCC?](#faq1_0)
### FAQ 1.1 - [What should I put in my entry's Makefile?](#faq1_1)
### FAQ 1.2 - [May I use a different source or compiled filename than prog.c or prog?](#faq1_2)
### FAQ 1.3 - [What platform should I assume for my entry?](#faq1_3)
- [1.0 - What types of entries have been over-submitted to the IOCCC?](#faq1_0)
- [1.1 - What should I put in my entry's Makefile?](#faq1_1)
- [1.2 - May I use a different source or compiled filename than prog.c or prog?](#faq1_2)
- [1.3 - What platform should I assume for my entry?](#faq1_3)
## Section 2 - [IOCCC Judging process](#faq2)
### FAQ 2.0 - [How many entries do the judges receive for a given IOCCC?](#faq2_0)
### FAQ 2.1 - [What should I put in the remarks.md file of my entry?](#faq2_1)
### FAQ 2.2 - [Why don't you publish non-winners?](#faq2_2)
### FAQ 2.3 - [How much time does it take to judge the contest?](#faq2_3)
### FAQ 2.4 - [How many judging rounds do you have?](#faq2_4)
- [2.0 - How many entries do the judges receive for a given IOCCC?](#faq2_0)
- [2.1 - What should I put in the remarks.md file of my entry?](#faq2_1)
- [2.2 - Why don't you publish non-winners?](#faq2_2)
- [2.3 - How much time does it take to judge the contest?](#faq2_3)
- [2.4 - How many judging rounds do you have?](#faq2_4)
## Section 3 - [Compiling and running IOCCC winners](#faq3)
### FAQ 3.0 - [What Makefile are available to build or clean up IOCCC winners?](#faq3_0)
### FAQ 3.1 - [Why doesn't this IOCCC winner compile?](#faq3_1)
### FAQ 3.2 - [Why does a IOCCC winner fail on my 64-bit system?](#faq3_2)
### FAQ 3.3 - [Why do some IOCCC winners fail to compile under macOS?](#faq3_3)
### FAQ 3.4 - [Why does clang or gcc fail to compile an IOCCC winner?](#faq3_4)
### FAQ 3.5 - [What is this cb tool that is mentioned in the IOCCC?](#faq3_5)
### FAQ 3.6 - [An IOCCC winner missed by my terminal application, how do I fix this?](#faq3_6)
### FAQ 3.7 - [How do I compile and use on macOS, an IOCCC winner that requires X11?](#faq3_7)
### FAQ 3.8 - [How do I compile an IOCCC winner that requires SDL1 or SDL2?](#faq3_8)
### FAQ 3.9 - [How do I compile and use on macOS, an IOCCC winner that requires sound?](#faq3_9)
### FAQ 3.10 - [Why do Makefiles use -Weverything with clang?](#faq3_10)
- [3.0 - What Makefile are available to build or clean up IOCCC winners?](#faq3_0)
- [3.1 - Why doesn't this IOCCC winner compile?](#faq3_1)
- [3.2 - Why does a IOCCC winner fail on my 64-bit system?](#faq3_2)
- [3.3 - Why do some IOCCC winners fail to compile under macOS?](#faq3_3)
- [3.4 - Why does clang or gcc fail to compile an IOCCC winner?](#faq3_4)
- [3.5 - What is this cb tool that is mentioned in the IOCCC?](#faq3_5)
- [3.6 - An IOCCC winner missed by my terminal application, how do I fix this?](#faq3_6)
- [3.7 - How do I compile and use on macOS, an IOCCC winner that requires X11?](#faq3_7)
- [3.8 - How do I compile an IOCCC winner that requires SDL1 or SDL2?](#faq3_8)
- [3.9 - How do I compile and use on macOS, an IOCCC winner that requires sound?](#faq3_9)
- [3.10 - Why do Makefiles use -Weverything with clang?](#faq3_10)
## Section 4 - [Changes made to IOCCC winners](#faq4)
### FAQ 4.0 - [Why are some winning author remarks incongruent with the winning IOCCC code?](#faq4_0)
### FAQ 4.1 - [Why were some calls to the libc function gets changed to use fgets?](#faq4_1)
### FAQ 4.2 - [What was changed in an IOCCC winner source code?](#faq4_2)
### FAQ 4.3 - [Why do author remarks sometimes not match the source?](#faq4_3)
### FAQ 4.4 - [What is the meaning of the file ending in .orig.c in IOCCC winners?](#faq4_4)
- [4.0 - Why are some winning author remarks incongruent with the winning IOCCC code?](#faq4_0)
- [4.1 - Why were some calls to the libc function gets changed to use fgets?](#faq4_1)
- [4.2 - What was changed in an IOCCC winner source code?](#faq4_2)
- [4.3 - Why do author remarks sometimes not match the source?](#faq4_3)
- [4.4 - What is the meaning of the file ending in .orig.c in IOCCC winners?](#faq4_4)
## Section 5 - [Updating or correcting IOCCC web site content](#faq5)
### FAQ 5.0 - [Why does an IOCCC winner fail to compile or or fail run?](#faq5_0)
### FAQ 5.1 - [How do I report a bug in an IOCCC winner?](#faq5_1)
- [5.0 - Why does an IOCCC winner fail to compile or or fail run?](#faq5_0)
- [5.1 - How do I report a bug in an IOCCC winner?](#faq5_1)
## Section 6 - [Miscellaneous IOCCC](#faq6)
### FAQ 6.0 - [How did an entry breaks the size rule 2, win the IOCCC?](#faq6_0)
### FAQ 6.1 - [Is there a list of known bugs and misfeatures of IOCCC winners?](#faq6_1)
### FAQ 6.2 - [May I mirror the IOCCC web site?](#faq6_2)
### FAQ 6.3 - [May I use parts of the IOCCC in an article, book, newsletter, or instructional material?](#faq6_3)
### FAQ 6.4 - [Why do you sometimes use the first person plural?](#faq6_4)
- [6.0 - How did an entry breaks the size rule 2, win the IOCCC?](#faq6_0)
- [6.1 - Is there a list of known bugs and (mis)features of IOCCC winners?](#faq6_1)
- [6.2 - May I mirror the IOCCC web site?](#faq6_2)
- [6.3 - May I use parts of the IOCCC in an article, book, newsletter, or instructional material?](#faq6_3)
- [6.4 - Why do you sometimes use the first person plural?](#faq6_4)
# The IOCCC FAQ
@@ -863,7 +856,7 @@ make clobber all 'CWARN+= -Weverything'
```
though it should be noted that if one tries `-Weverything` with compilers that
are not `clang` they might see something like:
are not `clang` they _might_ see something like:
```sh
echo 'int main(void) {}' > foo.c ; cc -Weverything foo.c -o foo
@@ -871,44 +864,68 @@ cc: error: unrecognized command-line option '-Weverything'
```
which means that it can't even be compiled. Thus the proper way to do it is the
first one.
first way, `make clobber all CC=clang`.
IOCCC authors who have access to a `clang` compiler might wish to try they their
IOCCC authors who have access to `clang` might wish to try their
hand at compiling with `-Weverything` while using a minimum of `-Wno-foo`
statements. Sometimes there is a technical or pedantic issue that
`-Weverything` warns about that would merit a change to your C code. Of course
`-Weverything` warns about that would merit a change to your C code; often,
however, it is not even possible to fix let alone is it worth it. Of course
if you're running out of bytes due to rule 2[ab] one might not have much choice.
Thus is something that obfuscators simply sometimes have to deal with!
This is something that obfuscators simply sometimes have to deal with!
If you to try to use minimize the number of `-Wno-foo` options needed with
If you try to minimize the number of `-Wno-foo` options needed with
`-Weverything`, please mention this in your remarks about the entry, as the
judges note you attempt to honor it (see also below). In some cases your
obfuscated code will issue warnings with `-Weverything` no matter what: the
`-Wno-poison-system-directories` is a common example of this but there are
others as well.
others as well, sometimes depending on the version of `clang`.
If you do try for a warning clean `-Weverything`, keep on mind that while _your_
If you do try for a compile with `clang -Weverything`, keep on mind that while _your_
compile environment might be warning free, a different clang version or a
different build environment might still have warnings. For instance the warning
set is different in macOS (which by default is `clang` even when run as `gcc`!)
than linux! Given that your entry *MUST* work as documented, you may be safer to
set is different in macOS (which by default is `clang`: even when run as `gcc`!)
than linux (due to versions and possibly other things)!
Given that your entry **MUST** work as documented, you may be safer to
say that your entry keeps the number of warnings and `-Wno-foo` options while
compiling with `clang -Weverything` at a minimum. Because if you claim zero
compiling with `clang -Weverything` at a minimum. You might want to say the
version number and platform too as an extra safety net. Because if you claim zero
warnings, and we find a warning situation, this may diminish the value of your
entry as it is not as documented. Thus it might be wise to point this out and
also if you can test it in multiple platforms (or versions of `clang`, see
if you can test it in multiple platforms (or versions of `clang`, see
below note) this would be advisable.
NOTE: different versions of `clang` have other differences as well. For instance
a defect of `clang` that required numerous entries to be fixed is that it
a defect of `clang` that required numerous entries to be fixed for clang is that it
requires that `main()`'s arguments to be of a specific type. However some
versions of `clang` are more strict in the number of args allowed. These reasons
are part of why numerous entries had to be modified so that `main()` calls
another function instead of doing it all in `main()`. Another reason was that
another function instead of doing it all in `main()` (another reason was that
some entries that recursively called `main()` caused a crash or otherwise broke
the entry in modern systems. Some entries do not work in `clang` (or at least do
the entry in modern systems). Some entries do not work in `clang` (or at least do
not work completely) due to these defects, for instance
[1989/westley](1989/westley/README.md).
[1989/westley](1989/westley/README.md); [Cody Boone
Ferguson](https://www.ioccc.org/winners.html#Cody_Boone_Ferguson) was able to
get much of it to work and looking at that entry might be of value to your
submissions, at least if you can figure the code out :-). To see the
differences, try from `1989/westley`:
```sh
make diff_orig_prog
```
If you have `colordiff` try:
```sh
make DIFF=colordiff diff_orig_prog
```
Alternatively you can try:
```sh
git diff d2a42f42e8f477f29e9d5ed09ce2bb349eaf7397..eb9e69fde657acc8c85a618a8a99af4c2f93b21d westley.c
```
As you can see, using `clang` has some additional problems to work out but if
you can get your entry to work well in `clang` it might very well be considered
@@ -918,7 +935,7 @@ better than other entries.
## <a name="faq4"></a>Section 4: Changes made to IOCCC winners
### <a name="faq4_0"></a>FAQ 4.0: Why are some winning author remarks incongruent with the winning IOCCC code?
### <a name="faq4_0"></a>FAQ 4.0: Why are some winning entry remarks incongruent with the winning IOCCC code?
It is very likely in this case that the code was fixed to work for modern
systems as part of the reworking of the website. If you have this problem in
@@ -926,7 +943,8 @@ some entries you should look at the original code as in `winner.orig.c` or
`prog.orig.c`. `winner` is the directory name. For instance, one of Landon's
favourite entries of all time is [1984/mullender](1984/mullender/README.md) and
the winner there would be `mullender`. Sometimes the original is in an alt
version like `winner.alt.c` or `prog.alt.c`.
version like `winner.alt.c` or `prog.alt.c`. In fact it is advisable to look at
the original code when reading the author's (and sometimes authors') remarks.
### <a name="faq4_1"></a>FAQ 4.1: Why were some calls to the libc function gets changed to use fgets?
+33 -1
View File
@@ -2042,10 +2042,42 @@ they do have page up and page down but this gives a default for those who don't
have them like with Macs.
## [1998/bas2](1998/bas2/bas2.c) ([README.md](1998/bas2/README.md]))
Cody added the [try.sh](1998/bas2/try.sh) script which runs some default actions
as well as allowing one to pass in different file names or strings.
## [1998/chaos](1998/chaos/chaos.c) ([README.md](1998/chaos/README.md]))
Cody added a call to `endwin()` to restore terminal sanity (echo etc.) when
exiting the program.
exiting the program (in both versions).
## [1998/df](1998/df/df.c) ([README.md](1998/df/README.md]))
Cody changed a `int *` used for `fopen(3)` to be a `FILE *` to be more correct
and prevent any possible problems in some systems (which has happened).
Cody also made the fixed version look more like the original version by using
the old style of `main()` args so that it read `i,love_unix` more naturally, and
by changing the typedef `lint` (to `int` - see the code for why this has to be
done in modern systems) to be `_int`.
## [1998/dlowe](1998/dlowe/dlowe.c) ([README.md](1998/dlowe/README.md]))
## [1998/dlowe](1998/dlowe/dlowe.c) ([README.md](1998/dlowe/README.md]))
Cody made the program more portable by changing the void return type of `main()`
to be `int` (in both versions).
Cody added the scripts [try.sh](1998/dlowe/try.sh),
[pootify.sh](1998/dlowe/pootify.sh) and
[pootify.cgi.sh](1998/dlowe/pootify.cgi.sh) for a fun example use of the
program, a local pootifier of web pages and a CGI pootifier. It should be noted
that the CGI version might have an issue with modern systems; see [historical
remarks](1998/dlowe/README.md#historical-remarks) for more details on the
pootify scripts.
## [1998/dloweneil](1998/dloweneil/dloweneil.c) ([README.md](1998/dloweneil/README.md]))