Improve fgets() fix to 1992/lush

gets() is now defined as the right fgets() call.

This required the use of #line 1 as the entry uses compiler messages to
work right. That's also why clang will not work with this entry.
This commit is contained in:
Cody Boone Ferguson committed 2023-09-10 06:43:49 -07:00
1 parent 2173be58f2
commit aedc966d6d
2 files changed
+9 -2

No files matched your search

+4 -2
View File
@@ -1,3 +1,5 @@
#define gets(_) fgets((_),999,stdin)
#line 1
#define f 000: #define f 000:
char char
*s,* *s,*
@@ -63,8 +65,8 @@
;;;} ;;;}
;for ;for
( ; ( ;
fgets gets
(_,999,stdin); (_);
) { ) {
for( for(
#define f 301: #define f 301:
+5
View File
@@ -585,6 +585,11 @@ which can be confusing) and also added the `runme.sh` script to demonstrate it
(using make was problematic). Cody notes that unfortunately this does not work (using make was problematic). Cody notes that unfortunately this does not work
with clang due to different compiler messages. with clang due to different compiler messages.
Cody later improved the `fgets()` change to look more like the original i.e. it
now uses a redefined `gets()`. This did require modifying the line number with
`#line 1` under the macro `gets()`. Still this cannot work with clang due to
different compiler messages. See [bugs.md](/bugs.md) for details.
## [1992/westley](1992/westley/westley.c) ([README.md](1992/westley/README.md])) ## [1992/westley](1992/westley/westley.c) ([README.md](1992/westley/README.md]))