Add 1994/ldb/try.sh

This commit is contained in:
Cody Boone Ferguson committed 2024-01-16 09:09:19 -08:00
1 parent 3e2287f5ec
commit edbbfedacd
3 files changed
+51 -13

No files matched your search

+9 -8
View File
@@ -1903,7 +1903,7 @@ entries that actually did not work because of missing or incorrect prototypes).
## <a name="1994_ldb"></a>[1994/ldb](/1994/ldb/ldb.c) ([README.md](/1994/ldb/README.md]))
[Cody](#cody) fixed this so it would compile and work with modern compilers. The problem
was that `srand()` returns void but it was used in a `||` expression. Thus the
was that `srand()` returns `void` but it was used in a `||` expression. Thus the
comma operator was needed.
Cody also fixed it for clang under Linux which objected to incompatible pointer
@@ -1913,14 +1913,15 @@ but what was being passed to it is an `int`).
Cody also changed the entry to use `fgets(3)` instead of `gets(3)`. This one has
a minor annoyance in that it now prints a newline after the output but this
seems like a worthy compromise for preventing the interspersed output in macOS
and at the same time it's safer (fixing it to not have the extra newline is more
problematic than it's worth and in macOS another line of output would be shown
without the change anyway and the difference is that now it's just a blank line
rather than an annoying warning).
and at the same time it's safer and allows for parsing file with longer lines.
Fixing it it to not have the extra newline is more problematic than it's worth,
in macOS another line of output would be shown without the change anyway -
unless `2>/dev/null` - and the difference is that now it's just a blank line
rather than an annoying warning. A subtlety about this fix: if a line is greater
than 231 in length if the program chooses that line it might print the first 231
characters or it might print (up to) the next 231 characters and so on.
A subtlety about this fix: if a line is greater than 231 in length if the
program chooses that line it might print the first 231 characters or it might
print (up to) the next 231 characters and so on.
Cody also added the [try.sh](/1994/ldb/try.sh) script.
## <a name="1994_schnitzi"></a>[1994/schnitzi](/1994/schnitzi/schnitzi.c) ([README.md](/1994/schnitzi/README.md]))