Add 2001/cheong/try.sh + format/typo check
This commit is contained in:
1 parent
6707d601b6
commit
3c17eac008
3 files changed
+40
-5
No files matched your search
@@ -15,9 +15,7 @@ make
|
|||||||
### Try:
|
### Try:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
./cheong 1024
|
./try.sh
|
||||||
./cheong 12345678901234567890
|
|
||||||
./cheong 05305265226926441255040573044986873789
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@@ -40,9 +38,9 @@ For example,
|
|||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ cc -o cheong cheong.c
|
$ cc -o cheong cheong.c
|
||||||
$ cheong 1234567890
|
$ ./cheong 1234567890
|
||||||
35136
|
35136
|
||||||
$ cheong 0200000000000000000000000000
|
$ ./cheong 0200000000000000000000000000
|
||||||
14142135623730
|
14142135623730
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Executable
+35
@@ -0,0 +1,35 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
# try.sh - demonstrate IOCCC winner 2001/cheong
|
||||||
|
#
|
||||||
|
|
||||||
|
# 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 "$ ./cheong 1024" 1>&2
|
||||||
|
./cheong 1024
|
||||||
|
|
||||||
|
echo "$ ./cheong 0512" 1>&2
|
||||||
|
./cheong 0512
|
||||||
|
|
||||||
|
echo "$ ./cheong 12345678901234567890" 1>&2
|
||||||
|
./cheong 12345678901234567890
|
||||||
|
|
||||||
|
echo "$ ./cheong 05305265226926441255040573044986873789" 1>&2
|
||||||
|
./cheong 05305265226926441255040573044986873789
|
||||||
|
|
||||||
|
echo "$ ./cheong 1234567890" 1>&2
|
||||||
|
./cheong 1234567890
|
||||||
|
|
||||||
|
echo "$ ./cheong 0200000000000000000000000000" 1>&2
|
||||||
|
./cheong 0200000000000000000000000000
|
||||||
|
|
||||||
@@ -2493,6 +2493,8 @@ letter word that would match the format and because it's pain that clang forces
|
|||||||
this. :-) This fix makes a point of the author's notes on portability no longer
|
this. :-) This fix makes a point of the author's notes on portability no longer
|
||||||
valid, btw.
|
valid, btw.
|
||||||
|
|
||||||
|
Cody also added the [try.sh](2001/cheong/try.sh) script.
|
||||||
|
|
||||||
He also fixed it to check the number of args.
|
He also fixed it to check the number of args.
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user