alexfru / SmallerC

Simple C compiler
BSD 2-Clause "Simplified" License
1.35k stars 155 forks source link

smlrc.c MAX_FILE_NAME_LEN is too small for Linux compile #46

Closed severach closed 3 months ago

severach commented 3 months ago

Compiling produces this error

./smlrcc -SI /tmp/makepkg-chris/smallerc/src/SmallerC-1.0.1-dos.win.1ab15c7/v0100/include -I /tmp/makepkg-chris/smallerc/src/SmallerC-1.0.1-dos.win.1ab15c7/v0100/srclib @lcw.op
Error in "/tmp/makepkg-chris/smallerc/src/SmallerC-1.0.1-dos.win.1ab15c7/v0100/srclib/kernel32/closehan.c" (9:109)
Invalid or too long file name or path name

Failed command 'smlrc -seg32 -winstack -Wall -nopp /tmp/makepkg-chris/smallerc/src/SmallerC-1.0.1-dos.win.1ab15c7/v0100/srclib/kernel32/closehan.i /tmp/makepkg-chris/smallerc/src/SmallerC-1.0.1-dos.win.1ab15c7/v0100/srclib/kernel32/closehan.asm'
make: *** [/tmp/makepkg-chris/smallerc/src/SmallerC-1.0.1-dos.win.1ab15c7/v0100/../common.mk:41: lcw.a] Error 255

This patch fixes the problem.

diff -pNaru5 a/v0100/smlrc.c b/v0100/smlrc.c
--- a/v0100/smlrc.c>2021-09-11 17:34:07.000000000 -0400
+++ b/v0100/smlrc.c>2024-03-25 17:25:33.162558811 -0400
@@ -194,11 +194,11 @@ int fsetpos(FILE*, fpos_t*);
 #ifndef SYNTAX_STACK_MAX
 #define SYNTAX_STACK_MAX (2048+1024)
 #endif
.
 #ifndef MAX_FILE_NAME_LEN
-#define MAX_FILE_NAME_LEN    95
+#define MAX_FILE_NAME_LEN    254
 #endif
.
 #ifndef NO_PREPROCESSOR
 #define MAX_INCLUDES         8
 #define PREP_STACK_SIZE      8