Merge pull request #1584 from xexyl/vik2012

Add 2012/vik/try.sh + format/typo checks
This commit is contained in:
Landon Curt Noll authored and GitHub committed 2023-11-29 16:52:18 -07:00
commit 987fcca624
21 files changed
+452 -77

No files matched your search

+27 -24
View File
@@ -5,7 +5,7 @@ make
```
There is alternate code which fixes some German at the expense of other German.
See [Alternate code](#alternate-code) below.
See [Alternate code](#alternate-code) below for the (fun) rationale here.
## To use:
@@ -35,8 +35,8 @@ This alternate code fixes the program that would throw off those who know German
where the sound of 'V' is 'F' and so the program had the letter be 'F'. A
problem, however, with changing it is that it breaks other words including in
German. Thus there is the alternate version instead which fixes a problem for
Germans that causes other problems for Germans so if you're German you'll just
have to deal with it :-) It is, however, good as you can appreciate the entry
Germans that causes problems for Germans so if you're German you'll just have to
deal with it :-) It is, however, good as you might be able appreciate the entry
even more.
@@ -107,10 +107,10 @@ It accepts a variety of spelt numbers:
* It correctly handles `zero`.
* Hyphen does not make a difference: `forty-two` and `forty two` are same.
So does period or comma.
* Cases do not make a difference either: `TWO`, `Two`, `two` are same.
* `one` and `a` are interchangeable: `one hundred` and `a hundred` are same.
* Cases do not make a difference either: `TWO`, `Two`, `two` are the same.
* `one` and `a` are interchangeable: `one hundred` and `a hundred` are the same.
* `and` is optional: `one hundred twenty-three` and `one hundred and twenty-three`
are same.
are the same.
* It supports every non-negative integer less than 10<sup>15</sup>-1. It uses
the small scale (i.e. American): `billion` is 10<sup>9</sup> and `trillion` is
10<sup>12</sup>.
@@ -121,13 +121,14 @@ It does *not* accept some spelt numbers, which I found mostly irrelevant:
* A bare `hundred`, `thousand` etc. do not work.
* `one million million` does not work. Get used to `one trillion`!
### Requirements
This program is quite portable, only requiring the following:
* The signature `int main(int, int)` should be accepted by the linker. (Original
version only).
* `char` should be at least 8 bits long (as dictated by the standard), `int`
* `char` should be at least 1 byte long (as dictated by the standard), `int`
should be at least 32 bits long, `long long` should be at least 64 bits long.
* Both the compiler and execution environment should use an ASCII-compatible
character set and two's complement representation.
@@ -136,16 +137,18 @@ This program is quite portable, only requiring the following:
[trustingtrust]: http://cm.bell-labs.com/who/ken/trust.html
The design of the program explicitly allows for `EOF` which does not equal to -1
(it has to be negative per the standard) and both signed and unsigned `char`,
for example. Furthermore it is endian-independent.
The design of the program explicitly allows for `EOF` even if it does not equal
`-1` (it has to be negative per the standard but not necessarily `-1`) and both
`signed char` and `unsigned char`, for example. Furthermore it is
endian-independent.
### Obfuscations (SPOILERS!)
Many obfuscations used are typical for standard IOCCC entries:
* Two arguments from `main` function are reused as normal variables.
* Every conditional has been replaced with `?:` ternary operator and `||`
* Two arguments from `main()` function are reused as normal variables.
* Every conditional has been replaced with the `?:` ternary operator and `||`
short-circuiting operator.
* It has exactly three nested `for` loops and nothing else.
* Common two's complement tricks: `~-a` instead of `a-1`,
@@ -161,9 +164,9 @@ Many obfuscations used are typical for standard IOCCC entries:
Other obfuscations are more subtle:
* The string `"1+DIY/.K430x9G(kC["` is 18 bytes long, but actually 19 bytes
including the final null character are used.
including the final NUL character are used.
* It internally represents numbers as hexadecimal. When the input is `two
hundred and three`, it actually writes 0x203 as hexadecimal.
hundred and three`, it actually writes `0x203` as hexadecimal.
* Some variables (notably, `n`) have dual uses.
* The magic number [42][hhgg] makes an appearance.
* It has a long long numb-`main`-er within it!
@@ -174,24 +177,24 @@ But the most important obfuscation is the clever construction of lookup table.
The program uses 11 different characters required for recognizing 22 lexemes:
```
zero one tw- th(i)r- fo(u)r- fi- six-
seven- eigh- nin- ten eleven twelve
hundred(s) thousand(s) million(s) billion(s) trillion(s)
a and -teen -ty
zero one tw- th(i)r- fo(u)r- fi- six-
seven- eigh- nin- ten eleven twelve
hundred(s) thousand(s) million(s) billion(s) trillion(s)
a and -teen -ty
```
So that they are internally represented as like:
```
r n tw- tr- fr- f- s-
sn- g- nn- tn ln twl
nr(s) tsan(s) lln(s) blln(s) trlln(s)
a an -tn -ty
r n tw- tr- fr- f- s-
sn- g- nn- tn ln twl
nr(s) tsan(s) lln(s) blln(s) trlln(s)
a an -tn -ty
```
The stemmer recognizes the longest matching prefix, so every lexeme can be
recognized by at most three characters (e.g. `trl` instead of `trlln`). This is
also handy for ignoring plurals. But that would make that the table does not fit
also handy for ignoring plurals. But that would make it so that the table does not fit
in the printable byte---11<sup>2</sup> is already almost 2<sup>7</sup>!
The trick is to use octal; three characters (`a`, `b` and `g`) are interpreted
@@ -213,7 +216,7 @@ More spoilers can be found at <https://gist.github.com/lifthrasiir/3909337>
### Acknowledgement
The cleaner (size-optimized) version of this program was originally published
in my website in July 2011. Sun Park and others have reviewed it and let me
in my website in July 2011. Sun Park and others have reviewed it and made me
aware of possible improvements. I'd also like to thank Seo Sanghyeon for
proof-reading remarks.
+8 -5
View File
@@ -14,17 +14,20 @@ make CC="$CC" everything >/dev/null || exit 1
# clear screen after compilation so that only the entry is shown
clear
echo "$ echo Nineteen hundred and eighty-four | ./kang"
echo "$ echo Nineteen hundred and eighty-four | ./kang" 1>&2
echo Nineteen hundred and eighty-four | ./kang
echo "$ echo uno | ./kang"
echo "$ echo uno | ./kang" 1>&2
echo uno | ./kang
echo "$ echo trois | ./kang"
echo "$ echo trois | ./kang" 1>&2
echo trois | ./kang
echo "$ echo fier | ./kang # notice the issue here, see alternate code instead"
echo "$ echo fier | ./kang # notice the issue here, see alternate code instead" 1>&2
echo fier | ./kang # notice the issue here, see alternate code instead
echo "$ echo \"shest'\" | ./kang"
echo "$ echo \"shest'\" | ./kang" 1>&2
echo "shest'" | ./kang
echo "$ echo dos | ./kang" 1>&2
echo dos | ./kang
+15 -3
View File
@@ -4,6 +4,9 @@
make
```
There is an unobfuscated version of this entry. See [Alternate
code](#alternate-code) below.
## To use:
@@ -17,7 +20,7 @@ NOTE: N is an integer from 0 to 255.
### Try:
```sh
./konno 30
./try.sh
```
@@ -26,12 +29,17 @@ NOTE: N is an integer from 0 to 255.
An alternate version of this entry, [konno.alt.c](konno.alt.c), is provided.
This alternate code is an unobfuscated version of the winning code.
To compile this alternate version:
### Alternate build:
```sh
make alt
```
### Alternate use:
Use `konno.alt` as you would `konno` above.
@@ -47,7 +55,9 @@ For extra credit, what are the minimal changes to convert it to
### Remarks
This program outputs [elementary cellular automaton](http://mathworld.wolfram.com/ElementaryCellularAutomaton.html) patterns.
This program outputs [elementary cellular
automaton](http://mathworld.wolfram.com/ElementaryCellularAutomaton.html)
patterns.
Try:
@@ -61,6 +71,7 @@ Try:
There are 256 (from 0 through 255) possible rules.
### Obfuscation
This program uses bit operations. I think
@@ -77,6 +88,7 @@ is an interesting operation. This isn't equal to
operation. What is the operation doing?
### Limitation
This program assumes that the size of `int` is 4.
+61
View File
@@ -0,0 +1,61 @@
#!/usr/bin/env bash
#
# try.sh - demonstrate IOCCC winner 2012/konno
#
# make sure CC is set so that when we do make CC="$CC" it isn't empty. Doing it
# this way allows us to have the user specify a different compiler in an easy
# way.
if [[ -z "$CC" ]]; then
CC="cc"
fi
make CC="$CC" all >/dev/null || exit 1
# clear screen after compilation so that only the entry is shown
clear
echo "$ ./konno 30" 1>&2
./konno 30
echo 1>&2
read -r -n 1 -p "Press any key to continue: "
echo 1>&2
echo "$ ./konno 90" 1>&2
./konno 90
echo 1>&2
read -r -n 1 -p "Press any key to continue: "
echo 1>&2
echo "$ ./konno 102" 1>&2
./konno 102
echo 1>&2
read -r -n 1 -p "Press any key to continue: "
echo 1>&2
echo "$ ./konno 109" 1>&2
./konno 109
echo 1>&2
read -r -n 1 -p "Press any key to continue: "
echo 1>&2
echo "$ ./konno 165" 1>&2
./konno 165
echo 1>&2
read -r -n 1 -p "Press any key to continue: "
echo 1>&2
echo "$ ./konno 42" 1>&2
./konno 42
echo 1>&2
read -r -n 1 -p "Press any key to continue: "
echo 1>&2
echo "$ ./konno 37" 1>&2
./konno 37
echo 1>&2
read -r -n 1 -p "Press any key to continue: "
echo 1>&2
echo "$ ./konno 255" 1>&2
./konno 255
+1
View File
@@ -1,3 +1,4 @@
mmm-chocolate.png
chocolate-in-ioccc.png
encodedimg.png
ioccc-in-chocolate.png
+19 -23
View File
@@ -6,6 +6,9 @@ make
This entry requires [Zlib](https://www.zlib.net).
There is an alternate version which might work for Windows. See [Alternate
code](#alternate-code) section below.
### Bugs and (Mis)features:
@@ -50,40 +53,28 @@ To extract the embedded PNG:
./vik d encodedimg.png > restored.png
```
There is an alternate version which might work for Windows. See Alternate code
section below.
The author stated that the program will crash if no argument is passed to the
program or if invalid arguments or images of mismatching sizes or unsupported
pixel formats though we note that your computer might also [halt and catch
fire](https://en.wikipedia.org/wiki/Halt_and_Catch_Fire_(computing)) :-)
This is supposed to happen. As is written in the
[The Jargon File](http://catb.org/jargon/html/F/feature.html):
```
That's not a bug, that's a feature.
```
### Try:
```sh
./vik e ioccc.png chocolate.png > chocolate-in-ioccc.png
./vik e chocolate.png ioccc.png > ioccc-in-chocolate.png
./vik d chocolate-in-ioccc.png > restored-chocolate.png
./vik d ioccc-in-chocolate.png > restored-ioccc.png
./try.sh
```
## Alternate code:
For those few who might use Windows, To compile:
For those few who might use Windows this alternate code might work.
### Alternate build:
```sh
make alt
```
### Alternate use:
Use `vik.alt` as you would `vik` above.
@@ -114,6 +105,7 @@ one image into another, the width and height needs to be the same.
The program only updates the `IDAT` and `IHDR` chunks of the source image. Any
additional chunks are copied into the resulting image.
### Bonus Extractor:
For some reason the chocolate image seems to have some special properties.
@@ -146,15 +138,16 @@ or helper methods that can be confusing, I placed all functionality in the
gives the benefit that all invocations of the function have the same parameters,
`argv` and `argc`. This really helps readability, as a programmer doesn't need
to remember several variable or function names. I also tried to reduce the
number of keywords, and the program only has four for-loops followed by a single
return statement. There is a little bit of use of the ternary (`?:`) operator,
number of keywords, and the program only has four `for` loops followed by a single
`return` statement. There is a little bit of use of the ternary (`?:`) operator,
but this is really there to keep the program as simple as possible.
### Portability
The program is portable to most platforms that have [zlib](https://www.zlib.net)
available. The only system dependency is that the program relies on writing
binary data to stdout.
binary data to `stdout`.
By default, Microsoft compilers adds carriage returns to new lines, and to
compile the program on this platform, the following line can be added after
@@ -165,6 +158,9 @@ correctly:
_setmode(_fileno(stdout), 0x8000);
```
NOTE: this is what the [Alternate code](#alternate-code) does.
### Limitations
The program doesn't have many error checks so passing in invalid arguments
+63
View File
@@ -0,0 +1,63 @@
#!/usr/bin/env bash
#
# try.sh - demonstrate IOCCC winner 2012/vik
#
# make sure CC is set so that when we do make CC="$CC" it isn't empty. Doing it
# this way allows us to have the user specify a different compiler in an easy
# way.
if [[ -z "$CC" ]]; then
CC="cc"
fi
make CC="$CC" all >/dev/null || exit 1
# clear screen after compilation so that only the entry is shown
clear
read -r -n 1 -p "Press any key to embed chocolate in chocolate-in-ioccc.png: "
echo 1>&2
echo "$ ./vik e chocolate-in-ioccc.png \"Mmm... chocolate.\" > mmm-chocolate.png" 1>&2
./vik e chocolate-in-ioccc.png "Mmm... chocolate." > mmm-chocolate.png
echo 1>&2
read -r -n 1 -p "Press any key to extract chocolate from mmm-chocolate.png: "
echo 1>&2
echo "$ ./vik d mmm-chocolate.png" 1>&2
./vik d mmm-chocolate.png
echo 1>&2
read -r -n 1 -p "Press any key to embed chocolate.png in ioccc.png: "
echo 1>&2
echo "$ ./vik e ioccc.png chocolate.png > chocolate-in-ioccc.png" 1>&2
./vik e ioccc.png chocolate.png > chocolate-in-ioccc.png
echo 1>&2
read -r -n 1 -p "Press any key to embed ioccc.png in chocolate.png: "
echo 1>&2
echo "$ ./vik e chocolate.png ioccc.png > ioccc-in-chocolate.png"
./vik e chocolate.png ioccc.png > ioccc-in-chocolate.png
echo 1>&2
read -r -n 1 -p "Press any key to embed a brainfuck program as a text file and decode it: "
echo 1>&2
echo "$ ./vik e ioccc.png .+[.+] > encodedimg.png" 1>&2
./vik e ioccc.png .+[.+] > encodedimg.png
echo "$ ./vik b encodedimg.png" 1>&2
./vik b encodedimg.png
echo 1>&2
read -r -n 1 -p "Press any key to extract chocolate from chocolate-in-ioccc.png: "
echo 1>&2
echo "$ ./vik d chocolate-in-ioccc.png > restored-chocolate.png" 1>&2
./vik d chocolate-in-ioccc.png > restored-chocolate.png
echo 1>&2
echo "Make sure to open restored-chocolate.png in your graphics viewer of choice!" 1>&2
read -r -n 1 -p "Press any key to extract ioccc from ioccc-in-chocolate.png: "
echo 1>&2
echo "$ ./vik d ioccc-in-chocolate.png > restored-ioccc.png" 1>&2
./vik d ioccc-in-chocolate.png > restored-ioccc.png
echo "Now make sure to open restored-ioccc.png in your graphics viewer of choice!" 1>&2
exit 0
+5 -1
View File
@@ -113,7 +113,7 @@ ENTRY= zeitak
PROG= ${ENTRY}
#
OBJ= ${PROG}.o
DATA= incorrect.c
DATA= incorrect.paren.c incorrect.brace.c incorrect.bracket.c
TARGET= ${PROG}
#
ALT_OBJ= ${PROG}.alt.o
@@ -135,6 +135,10 @@ all: data ${TARGET}
${PROG}: ${PROG}.c
${CC} ${CFLAGS} $< -o $@ ${LDFLAGS}
test: test.sh
./$< || exit 1
# alternative executable
#
alt: data ${ALT_TARGET}
+22 -14
View File
@@ -4,6 +4,9 @@
make
```
There is an alternate version that is slightly deobfuscated. See [alternate
code](#alternate-code) below.
## To use:
@@ -18,8 +21,7 @@ try [incorrect.c](incorrect.c) and the program itself.
### Try:
```sh
./zeitak < zeitak.c
./zeitak < incorrect.c
make test
```
NOTE: it prints an error and exits on the first nesting error so it will not
@@ -28,17 +30,19 @@ detect multiple issues!
## Alternate code:
An alternate version of this entry, [zeitak.alt.c](zeitak.alt.c), is provided.
The file [zeitak.alt.c](zeitak.alt.c) provides a version that has been slightly
deobfuscated. You may find reading that file helpful in your attempt
to understand this extremely subtle entry.
This version, [zeitak.alt.c](zeitak.alt.c), is a version that has been slightly
deobfuscated. You may find reading it helpful in your attempt to understand
this extremely subtle entry.
To compile this alternate version:
### Alternate build:
```sh
make alt
```
### Alternate use:
Use `zeitak.alt` as you would `zeitak` above.
@@ -55,8 +59,10 @@ just to understand 18 key characters of this code.
## Author's remarks:
### Nesting Errors Detector
#### What does it do
As you have probably understood by looking at the source\*, this program has
@@ -69,7 +75,8 @@ If an error is detected, an error message will be printed. If the problem
is a superfluous closing bracket, it will even print a few characters
around it's position.
* Make sure you view the source with 4 spaces tab width.
\* Make sure you view the source with 4 spaces tab width.
#### Features
@@ -99,7 +106,7 @@ even more limited source, that is:
* Without any digits.
* Without any character constants.
* Without using functions from headers other than stdio.
* Without using functions from headers other than `stdio`.
* Without any control-flow keywords (not even the `?:` operator).
* Without any arithmetic or logic operators!
@@ -107,7 +114,8 @@ So, what's left? Parenthesis, and lots of them, as looking at the source will
reveal immediately. The main obfuscation is building the whole algorithm using
only function calls, typecasts, array lookups and pointer operators.
##### Additional obfuscations include:
#### Additional obfuscations include:
* Extensive reuse of identifiers: Macros share names with variables, inner
curly braces scopes contain variables with names identical to those in the
@@ -117,16 +125,16 @@ only function calls, typecasts, array lookups and pointer operators.
* Mostly one-letter identifiers.
* Complex recursion: A function might call itself once, twice, or not at all.
#### Compilation/Portability/Running Notes
* The program requires `char` to be one byte and pointers to be
at least two bytes long.
* The program was tested on the following platforms:
- Ubuntu 9.04 32-bit with GCC
- Windows 7 32-bit with GCC
- Windows 7 32-bit with OpenWatcom
- Ubuntu 9.04 32-bit with GCC
- Windows 7 32-bit with GCC
- Windows 7 32-bit with OpenWatcom
## Copyright and CC BY-SA 4.0 License:
+2
View File
@@ -0,0 +1,2 @@
int i;main(){for(;i["]<i;++i){--i;}"];read('-'-'-',i+++"hell\
o, world!\n",'/'/'/'));}read(j,i,p){write(j/p+p,i---j,i/i);}
+2
View File
@@ -0,0 +1,2 @@
int i;main(){for(;i["]<i;++i){--i;}"];read('-'-'-',i+++"hell\
o, world!\n",'/'/'/'));}read(j,i,p)void*i;{write(j/p+p,i---j,(int)i/(int)i);}
+7
View File
@@ -0,0 +1,7 @@
#include <stdio.h>
int main() {
int i=40;
printf(");
return 0;
}
+7
View File
@@ -0,0 +1,7 @@
#include <stdio.h>
int main() {
int i=40;
printf(""");
return 0;
}
+7
View File
@@ -0,0 +1,7 @@
#include <stdio.h>
int main() {}}
int i=40;
printf("%c",(char)(i)));
return 0;
}
+7
View File
@@ -0,0 +1,7 @@
#include <stdio.h>
int main() ]] }}
int i=40;
printf("%c",(char)(i)));
return 0;
}
@@ -1,7 +1,7 @@
#include <stdio.h>
int main() {
int i=40;
printf("%c",(char)(i)));
return 0;
}
#include <stdio.h>
int main() {
int i=40;
printf("%c",(char)(i)));
return 0;
}
+7
View File
@@ -0,0 +1,7 @@
#include <stdio.h>
int main() {
int i=40;
printf("\"");
return 0;
}
+7
View File
@@ -0,0 +1,7 @@
#include <stdio.h>
int main() {
int i=40;
printf(');
return 0;
}
+1
View File
@@ -0,0 +1 @@
"
+161
View File
@@ -0,0 +1,161 @@
#!/usr/bin/env bash
#
# try.sh - demonstrate IOCCC winner 2012/zeitak
#
# make sure CC is set so that when we do make CC="$CC" it isn't empty. Doing it
# this way allows us to have the user specify a different compiler in an easy
# way.
if [[ -z "$CC" ]]; then
CC="cc"
fi
make CC="$CC" all >/dev/null || exit 1
# clear screen after compilation so that only the entry is shown
clear
# assume no error: set ERROR to 0
ERROR=0
read -r -n 1 -p "Press any key to test zeitak.c for nesting errors: "
echo 1>&2
./zeitak < zeitak.c
EXIT_CODE="$?"
if [[ "$EXIT_CODE" -ne 3 ]]; then
echo "Error: did not get exit code 3: $EXIT_CODE" 1>&2
ERROR=1
fi
echo 1>&2
echo "$ cat anonymous.c" 1>&2
cat anonymous.c
echo 1>&2
read -r -n 1 -p "Press any key to test anonymous.c for nesting errors: "
echo 1>&2
./zeitak < anonymous.c
EXIT_CODE="$?"
if [[ "$EXIT_CODE" -ne 3 ]]; then
echo "Error: did not get exit code 3: $EXIT_CODE" 1>&2
ERROR=1
fi
echo 1>&2
echo "$ cat anonymous.alt.c" 1>&2
cat anonymous.alt.c
echo 1>&2
read -r -n 1 -p "Press any key to test anonymous.alt.c for nesting errors: "
echo 1>&2
./zeitak < anonymous.alt.c
EXIT_CODE="$?"
if [[ "$EXIT_CODE" -ne 3 ]]; then
echo "Error: did not get exit code 3: $EXIT_CODE" 1>&2
ERROR=1
fi
echo 1>&2
echo "$ cat incorrect.brace.c" 1>&2
cat incorrect.brace.c
echo 1>&2
read -r -n 1 -p "Press any key to test incorrect.brace.c: "
echo 1>&2
./zeitak < incorrect.brace.c
EXIT_CODE="$?"
if [[ "$EXIT_CODE" -ne 10 ]]; then
echo "Error: did not get exit code 10: $EXIT_CODE" 1>&2
ERROR=1
fi
echo 1>&2
echo "$ cat incorrect.bracket.c" 1>&2
cat incorrect.bracket.c
echo 1>&2
read -r -n 1 -p "Press any key to test incorrect.bracket.c: "
echo 1>&2
./zeitak < incorrect.bracket.c
EXIT_CODE="$?"
if [[ "$EXIT_CODE" -ne 10 ]]; then
echo "Error: did not get exit code 10: $EXIT_CODE" 1>&2
ERROR=1
fi
echo 1>&2
echo "$ cat incorrect.paren.c" 1>&2
cat incorrect.paren.c
echo 1>&2
read -r -n 1 -p "Press any key to test incorrect.paren.c: "
echo 1>&2
./zeitak < incorrect.paren.c
EXIT_CODE="$?"
if [[ "$EXIT_CODE" -ne 10 ]]; then
echo "Error: did not get exit code 10: $EXIT_CODE" 1>&2
ERROR=1
fi
echo 1>&2
echo "$ cat incorrect.quote-esc.c" 1>&2
cat incorrect.quote-esc.c
echo 1>&2
read -r -n 1 -p "Press any key to test incorrect.quote-esc.c: "
echo 1>&2
./zeitak < incorrect.quote-esc.c
EXIT_CODE="$?"
if [[ "$EXIT_CODE" -ne 10 ]]; then
echo "Error: did not get exit code 10: $EXIT_CODE" 1>&2
ERROR=1
fi
echo 1>&2
echo "$ cat incorrect.3.quotes.c" 1>&2
cat incorrect.3.quotes.c
echo 1>&2
read -r -n 1 -p "Press any key to test incorrect.3.quotes.c: "
echo 1>&2
./zeitak < incorrect.3.quotes.c
EXIT_CODE="$?"
if [[ "$EXIT_CODE" -ne 10 ]]; then
echo "Error: did not get exit code 10: $EXIT_CODE" 1>&2
ERROR=1
fi
echo 1>&2
echo "$ cat incorrect.single.quote.c" 1>&2
cat incorrect.single.quote.c
echo 1>&2
read -r -n 1 -p "Press any key to test incorrect.single.quote.c: "
echo 1>&2
./zeitak < incorrect.single.quote.c
EXIT_CODE="$?"
if [[ "$EXIT_CODE" -ne 10 ]]; then
echo "Error: did not get exit code 10: $EXIT_CODE" 1>&2
ERROR=1
fi
echo 1>&2
echo "$ cat incorrect.1.quote.c" 1>&2
cat incorrect.1.quote.c
echo 1>&2
read -r -n 1 -p "Press any key to test incorrect.1.quote.c: "
echo 1>&2
./zeitak < incorrect.1.quote.c
EXIT_CODE="$?"
if [[ "$EXIT_CODE" -ne 10 ]]; then
echo "Error: did not get exit code 10: $EXIT_CODE" 1>&2
ERROR=1
fi
echo 1>&2
echo "$ cat incorrect.txt" 1>&2
cat incorrect.txt
echo 1>&2
read -r -n 1 -p "Press any key to test incorrect.txt: "
echo 1>&2
./zeitak < incorrect.txt
EXIT_CODE="$?"
if [[ "$EXIT_CODE" -ne 10 ]]; then
echo "Error: did not get exit code 10: $EXIT_CODE" 1>&2
ERROR=1
fi
echo 1>&2
exit "$ERROR"
+16
View File
@@ -3372,6 +3372,11 @@ The fifth script, [try.sh](2012/kang/try.sh), runs a sequence of commands to
show different languages and numbers.
## [2012/konno](2012/konno/konno.c) ([README.md](2012/konno/README.md]))
Cody added the [try.sh](2012/konno/try.sh) script.
## [2012/vik](2012/vik/vik.c) ([README.md](2012/vik/README.md]))
Based on the author's description it should be able to get this entry to work
@@ -3381,6 +3386,17 @@ this for the few who might use Windows.
We're not sure whether we want to thank Cody or not for this :-) and he's not
sure if he wants to be thanked either :-) but we appreciate it nonetheless.
Cody also added the [try.sh](2012/vik/try.sh) script.
## [2012/zeitak](2012/zeitak/zeitak.c) ([README.md](2012/zeitak/README.md]))
Cody added the `make test` rule and the [test.sh](2012/zeitak/test.sh) along
with a number of files that will be correctly be flagged as incorrect (including
a text file to show that it's not that it parses C but rather just matching
pairs though that should be obvious) and also some that are correct including
1984/anonymous (as the author explicitly mentioned it).
# <a name="2013"></a>2013