Add 2000/anderson/try.sh + format/typo checks
This commit is contained in:
1 parent
b11061198a
commit
6e482a5a44
3 files changed
+45
-3
No files matched your search
+12
-3
@@ -15,7 +15,7 @@ echo something | ./anderson
|
||||
### Try:
|
||||
|
||||
```sh
|
||||
echo Obfuscate | ./anderson
|
||||
./try.sh
|
||||
```
|
||||
|
||||
|
||||
@@ -30,6 +30,15 @@ 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 `#define`s 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:
|
||||
|
||||
@@ -59,7 +68,7 @@ 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.
|
||||
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
|
||||
@@ -75,7 +84,7 @@ 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
|
||||
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;
|
||||
|
||||
Reference in new issue
Block a user