Merge pull request #1044 from xexyl/2013-dlowe-updates
This commit is contained in:
4 files changed
+18
-26
No files matched your search
+7
-17
@@ -24,17 +24,9 @@ make
|
|||||||
./dlowe 16 32 64 128
|
./dlowe 16 32 64 128
|
||||||
./dlowe 16 32 64 128 256
|
./dlowe 16 32 64 128 256
|
||||||
./dlowe 16 32 64 128 256 512
|
./dlowe 16 32 64 128 256 512
|
||||||
|
|
||||||
echo "sparkline of file sizes: $(wc -c * | awk '{print $1}' | xargs ./dlowe)" # or ./slen.sh
|
|
||||||
|
|
||||||
./dlowe 0
|
./dlowe 0
|
||||||
|
|
||||||
echo "sparkline of file sizes: $(wc -c * | awk '{print $1}' | xargs ./dlowe)" # or ./slen.sh
|
echo "sparkline of file sizes: $(wc -c * | awk '{print $1}' | xargs ./dlowe)" # or ./sflen.sh
|
||||||
```
|
|
||||||
|
|
||||||
./dlowe 0
|
|
||||||
|
|
||||||
echo "sparkline of file sizes: $(wc -c * | awk '{print $1}' | xargs ./dlowe)" # or ./slen.sh
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Alternatively, for the lazy or those short on time, try:
|
Alternatively, for the lazy or those short on time, try:
|
||||||
@@ -51,10 +43,9 @@ echo 'IOCCC 2013' > ioccc.txt
|
|||||||
rm -f ioccc.txt
|
rm -f ioccc.txt
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
?
|
?
|
||||||
|
|
||||||
To make it simpler to see try showing just the last two lines:
|
To make it simpler to see try showing just the different line like:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
./demo.sh | tail -n 2 > 1.txt
|
./demo.sh | tail -n 2 > 1.txt
|
||||||
@@ -79,8 +70,8 @@ something funny (or will it ? :-) ) and when will it do nothing?
|
|||||||
|
|
||||||
We liked how this entry used Unicode, specifically UTF-8, in a somewhat obfuscated way.
|
We liked how this entry used Unicode, specifically UTF-8, in a somewhat obfuscated way.
|
||||||
|
|
||||||
Also, why doesn't it crash, and produces a correct output when called with one argument
|
Also, why doesn't it crash but instead produces a correct output when called
|
||||||
or when all arguments are equal?
|
with one argument or when all arguments are equal?
|
||||||
|
|
||||||
For extra fun, compile and run [fun.c](fun.c):
|
For extra fun, compile and run [fun.c](fun.c):
|
||||||
|
|
||||||
@@ -106,7 +97,7 @@ and with clang (3.3), we get
|
|||||||
-2147483648 0 2147483647
|
-2147483648 0 2147483647
|
||||||
```
|
```
|
||||||
|
|
||||||
and with Apple clang version 15.0.0 (clang-1500.0.40.1) we get:
|
and with Apple clang version 15.0.0 (clang-1500.0.40.1) in 2023, we get:
|
||||||
|
|
||||||
```
|
```
|
||||||
1840985120 -2033041452 35979112
|
1840985120 -2033041452 35979112
|
||||||
@@ -117,7 +108,6 @@ Which one is correct? :)
|
|||||||
NOTE: `make all` will compile [fun.c](fun.c) but to provide a different compiler
|
NOTE: `make all` will compile [fun.c](fun.c) but to provide a different compiler
|
||||||
you can do something like:
|
you can do something like:
|
||||||
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
make CC=clang fun
|
make CC=clang fun
|
||||||
```
|
```
|
||||||
@@ -140,10 +130,10 @@ $ echo "sparkline of file lengths: $(wc -c * | awk '{print $1}' | xargs ./sparkl
|
|||||||
sparkline of file sizes: ▁▁▁▃▃▂▁▂▁▁▉
|
sparkline of file sizes: ▁▁▁▃▃▂▁▂▁▁▉
|
||||||
```
|
```
|
||||||
|
|
||||||
NOTE: this has been provided in [slen.sh](slen.sh) so you can try:
|
NOTE: this has been provided in [sflen.sh](sflen.sh) so you can try:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
./slen.sh
|
./sflen.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
instead.
|
instead.
|
||||||
|
|||||||
+3
-4
@@ -1,7 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
make clobber all || exit 1
|
make all || exit 1
|
||||||
|
|
||||||
echo "$ ./dlowe 0 1 2 3 4 5 6 7"
|
echo "$ ./dlowe 0 1 2 3 4 5 6 7"
|
||||||
./dlowe 0 1 2 3 4 5 6 7
|
./dlowe 0 1 2 3 4 5 6 7
|
||||||
echo
|
echo
|
||||||
@@ -17,5 +16,5 @@ echo
|
|||||||
echo "$ ./dlowe 0"
|
echo "$ ./dlowe 0"
|
||||||
./dlowe 0
|
./dlowe 0
|
||||||
echo
|
echo
|
||||||
echo "$ ./slen.sh"
|
echo "$ ./sflen.sh"
|
||||||
./slen.sh
|
./sflen.sh
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
make all || exit 1
|
||||||
|
ln -sf dlowe sparkl
|
||||||
echo "sparkline of file lengths: $(wc -c ./* | awk '{print $1}' | xargs ./sparkl)"
|
echo "sparkline of file lengths: $(wc -c ./* | awk '{print $1}' | xargs ./sparkl)"
|
||||||
+6
-5
@@ -1641,15 +1641,16 @@ Cody added the source code that we suggested one should compile and run with
|
|||||||
different compilers as [fun.c](2013/dlowe/fun.c). He modified the Makefile so
|
different compilers as [fun.c](2013/dlowe/fun.c). He modified the Makefile so
|
||||||
that running `make all` will compile it, saving you the effort.
|
that running `make all` will compile it, saving you the effort.
|
||||||
|
|
||||||
He also provided the script [slen.sh](2013/dlowe/slen.sh) which is based on the
|
He also provided the script [sflen.sh](2013/dlowe/sflen.sh), fixing it for
|
||||||
author's remarks, giving a script that shows the spark line of the file lengths
|
shellcheck, which is based on the author's remarks, giving a script that shows
|
||||||
(as in `wc -c`), fixing it for shellcheck. These fixes were applied in the
|
the spark line of the file lengths (as in `wc -c`). These fixes were applied in
|
||||||
author's remarks as well.
|
the author's remarks as well.
|
||||||
|
|
||||||
Since the author called the program `sparkl` Cody modified the Makefile so that
|
Since the author called the program `sparkl` Cody modified the Makefile so that
|
||||||
running `make all` will create a symlink to `dlowe` as `sparkl`. Running `make
|
running `make all` will create a symlink to `dlowe` as `sparkl`. Running `make
|
||||||
clobber` will delete both and running `make clobber all` will ensure that the
|
clobber` will delete both and running `make clobber all` will ensure that the
|
||||||
symlink is created.
|
symlink is created. The `sflen.sh` script also explicitly makes sure to create
|
||||||
|
the symlink as it uses it, even though it runs `make clobber all`.
|
||||||
|
|
||||||
Cody also added the [demo.sh](2013/dlowe/demo.sh) script to more easily try the
|
Cody also added the [demo.sh](2013/dlowe/demo.sh) script to more easily try the
|
||||||
program.
|
program.
|
||||||
|
|||||||
Reference in new issue
Block a user