Fix 2018/algmyr to not segfault on NULL file
Now it just exits 1 if a file cannot be opened. I do have a concern with
this type of fix which I will bring up on GitHub but it seems better
anyway to not crash with invalid input unless the entry should crash.
The fact the author noted that invalid paths as a limitation suggests in
this case that it is reasonable to fix. There are other limitations /
bugs the author mentions but perhaps those should not be fixed. That
remains to be seen I guess.
I can also now confirm that this entry does indeed work as expected; I
could not test it with commit ced8177ef9
but I had to test it here to make sure the changes did not affect the
functionality.
The original source, which has a really nice layout, can be found in
prog.alt.c and is referenced in the README.md. It can be built by make
alt.
This commit is contained in:
1 parent
70f08cc681
commit
0f52b84bc8
4 files changed
+91
-5
No files matched your search
+22
-2
@@ -17,6 +17,12 @@ cat prog.c | ./prog # Printing garbage might break your font
|
||||
./prog -d 2 0 out.raw # Decode the first (0th) channel out of two
|
||||
```
|
||||
|
||||
[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) made this entry not
|
||||
crash when a file cannot be opened. The original file, kept for the wonderful
|
||||
format, is in [prog.alt.c](prog.alt.c). See below for details. Thank you Cody
|
||||
for your assistance!
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
```sh
|
||||
@@ -25,15 +31,29 @@ cat prog.c | ./prog # Printing garbage might break your font
|
||||
# Who needs cat?
|
||||
./prog prog.c | ./prog -d 1 0
|
||||
|
||||
# Assuming ALSA
|
||||
# Assuming ALSA:
|
||||
echo '<<<<<< /\_/\_/\ _-_-_-_ !!!!! :.:.:.: >>>>>> ****** ~~~~~~~' |
|
||||
./prog | aplay -c1 -fFLOAT_LE -r44100
|
||||
|
||||
# Assuming sox
|
||||
# Assuming sox:
|
||||
echo -n ' MENE MENE TEKEL UPHARSIN ' | ./prog |
|
||||
sox -t raw -c 1 -r 44100 -L -e floating-point -b 32 - -n spectrogram -d 10 -X 300
|
||||
|
||||
# now open spectrogram.png with a graphics viewer or editor
|
||||
```
|
||||
|
||||
### Alternate code:
|
||||
|
||||
The original source which will crash if a file cannot be opened but which also
|
||||
has a nicer layout can be found in [prog.alt.c](prog.alt.c). Try:
|
||||
|
||||
|
||||
```sh
|
||||
make alt
|
||||
```
|
||||
|
||||
Use `prog.alt` as you would `prog`.
|
||||
|
||||
## Judges' comments:
|
||||
|
||||
Be warned, this is not your garden variety text-to-speech program! Earplugs are advised,
|
||||
|
||||
Reference in new issue
Block a user