Improve 2018/hou/try.sh + update bugs.md
This commit is contained in:
1 parent
c907667f3a
commit
cf4b113f56
3 files changed
+27
-17
No files matched your search
+6
-2
@@ -31,9 +31,13 @@ View `output.html` in a browser.
|
||||
./try.sh
|
||||
```
|
||||
|
||||
As the script says, open `output.html` in a browser.
|
||||
The script will generate a JSON file called `ioccc.json`, showing it via
|
||||
`tee(1)` and then run the program on that. Can you find any problem with the
|
||||
JSON file? What happens if you try and fix it?
|
||||
|
||||
What's not right with the output? How can one fix it?
|
||||
As the script says, open `ioccc.html` in a browser.
|
||||
|
||||
Is anything wrong with the output? How can you fix it if so?
|
||||
|
||||
|
||||
## Judges' remarks:
|
||||
|
||||
+14
-13
@@ -17,25 +17,26 @@ clear
|
||||
|
||||
read -r -n 1 -p "Press any key to run: grep -e '[-?+*/^&|.<>=]' prog.c (space = next page, q = quit): "
|
||||
echo 1>&2
|
||||
grep -e '[-?+*/^&|.<>=]' prog.c | less -EXF
|
||||
grep -e '[-?+*/^&|.<>=]' prog.c | less -rEXFK
|
||||
echo 1>&2
|
||||
|
||||
# ^-- SC2140 (warning): Word is of the form "A"B"C" (B indicated). Did you mean "ABC" or "A\"B\"C"?
|
||||
# ^-- SC1083 (warning): This { is literal. Check expression (missing ;/\n?) or quote it.
|
||||
# ^-- SC1083 (warning): This } is literal. Check expression (missing ;/\n?) or quote it.
|
||||
# ^-- SC2140 (warning): Word is of the form "A"B"C" (B indicated). Did you mean "ABC" or "A\"B\"C"?
|
||||
# shellcheck disable=SC2140
|
||||
# shellcheck disable=SC1083
|
||||
echo "(cd ..; ls -lS -- */prog.c) | \
|
||||
awk 'BEGIN { print "["; } { print "{\"winner\":\"",\$9,"\", \"size\":",\$5,"},"} END { print "]"}' \
|
||||
> ioccc.json"
|
||||
# remove temp files
|
||||
rm -f ioccc.html ioccc.json
|
||||
|
||||
echo "$ (cd ..; ls -lS -- */prog.c) | \
|
||||
awk 'BEGIN { print \"[\"; } { print \"{\"winner\":\"\",\$9,\"\", \"size\":\",\$5,\"},\"} END { print \"]\"}' \
|
||||
| tee ioccc.json"
|
||||
read -r -n 1 -p "Press any key to continue: "
|
||||
echo 1>&2
|
||||
|
||||
(cd ..; ls -lS -- */prog.c) | \
|
||||
awk 'BEGIN { print "["; } { print "{\"winner\":\"",$9,"\", \"size\":",$5,"},"} END { print "]"}' \
|
||||
> ioccc.json
|
||||
| tee ioccc.json
|
||||
|
||||
echo "NOTE: for the next step you should get an assertion failure" 1>&2
|
||||
read -r -n 1 -p "Press any key to run: ./prog < ioccc.json > ioccc.html: "
|
||||
echo 1>&2
|
||||
./prog < ioccc.json > ioccc.html
|
||||
|
||||
echo 1>&2
|
||||
echo "Now open ioccc.html in your browser." 1>&2
|
||||
|
||||
exit 0
|
||||
@@ -3353,7 +3353,7 @@ loop printing whitespace.
|
||||
### Source code: [2018/hou/prog.c](2018/hou/prog.c)
|
||||
### Information: [2018/hou/README.md](2018/hou/README.md)
|
||||
|
||||
When you run it you will see something like:
|
||||
When you run it on a JSON file you will see something like:
|
||||
|
||||
```sh
|
||||
$ ./prog < ioccc.json > ioccc.html
|
||||
@@ -3361,7 +3361,12 @@ Assertion failed: (rulez), function C, file prog.c, line 124.
|
||||
Abort trap: 6
|
||||
```
|
||||
|
||||
but this is expected and the file `ioccc.html` will be generated properly.
|
||||
(from say running `./try.sh) but this is expected and the file `ioccc.html` will
|
||||
be generated properly.
|
||||
|
||||
Some JSON files might cause the program to continue to run and seemingly
|
||||
infinitely increase the size of the output file. This can happen if you try
|
||||
fixing the syntax error in the generated `ioccc.json` file.
|
||||
|
||||
|
||||
## 2018 mills
|
||||
|
||||
Reference in new issue
Block a user