james@bigtex.cactus.org (James Van Artsdalen) (10/19/88)
flex uses mktemp in such a way as to dump core when compiled with pure
strings. I made some other changes:
Makefile Uses $(CC) and $(YACC) rather than cc and yacc.
It's easier to generate optimized vs. debugging versions from
the make command line.
Uses $(CLIB) to make it easier to use SysV shared libraries.
flex.h Made sprintf() SV dependent: SysV sprintf() returns int.
Went ahead and added a full prototype, since my include files
on bigtex already had the prototype and GNU C is unhappy
without it in flex.
flexmain.c Changed usage of mktemp(3) call.
*** /tmp/,RCSt1a01265 Tue Oct 18 18:57:51 1988
--- Makefile Tue Oct 18 18:57:35 1988
***************
*** 8,17 ****
SKELETON_FILE = \"/usr/local/lib/flex.skel\"
F_SKELETON_FILE = \"/usr/local/lib/flex.fastskel\"
- CFLAGS = -O -DDEFAULT_SKELETON_FILE=$(SKELETON_FILE) \
- -DFAST_SKELETON_FILE=$(F_SKELETON_FILE)
- LDFLAGS = -s
FLEX_FLAGS = -ist
FLEX = flex
--- 8,20 ----
SKELETON_FILE = \"/usr/local/lib/flex.skel\"
F_SKELETON_FILE = \"/usr/local/lib/flex.fastskel\"
+ CFLAGS= -DDEFAULT_SKELETON_FILE=$(SKELETON_FILE) \
+ -DFAST_SKELETON_FILE=$(F_SKELETON_FILE) $(DEBUG)
+ DEBUG = -g
+ LDFLAGS =
+ YACC=yacc
+
FLEX_FLAGS = -ist
FLEX = flex
***************
*** 42,51 ****
yylex.c
flex : $(FLEXOBJS)
! cc $(CFLAGS) -o flex $(LDFLAGS) $(FLEXOBJS)
y.tab.h y.tab.c : flexparse.y
! yacc -d flexparse.y
# comment-out the next two lines after a successful "make test" and
# comment-in the following two lines.
--- 45,54 ----
yylex.c
flex : $(FLEXOBJS)
! $(CC) -o flex $(LDFLAGS) $(FLEXOBJS) $(CLIB)
y.tab.h y.tab.c : flexparse.y
! $(YACC) -d flexparse.y
# comment-out the next two lines after a successful "make test" and
# comment-in the following two lines.
*** /tmp/,RCSt1a01265 Tue Oct 18 18:57:54 1988
--- flexdef.h Tue Oct 18 18:57:36 1988
***************
*** 24,34 ****
#ifdef SV
#include <string.h>
#define bzero(s, n) memset((char *)(s), '\000', (unsigned)(n))
#else
#include <strings.h>
#endif
-
- char *sprintf(); /* keep lint happy */
/* maximum line length we'll have to deal with */
--- 24,38 ----
#ifdef SV
#include <string.h>
#define bzero(s, n) memset((char *)(s), '\000', (unsigned)(n))
+ #ifdef __GNUC__
+ int sprintf(char *s, char *format, ...);
#else
+ int sprintf();
+ #endif
+ #else /* SV */
#include <strings.h>
+ char *sprintf();
#endif
/* maximum line length we'll have to deal with */
*** /tmp/,RCSt1a01265 Tue Oct 18 18:57:55 1988
--- flexmain.c Tue Oct 18 18:57:36 1988
***************
*** 54,60 ****
int tmpuses, totnst, peakpairs, numuniq, numdup, hshsave;
FILE *temp_action_file;
int end_of_buffer_state;
! char *action_file_name = "/tmp/flexXXXXXX";
/* flex - main program
--- 54,60 ----
int tmpuses, totnst, peakpairs, numuniq, numdup, hshsave;
FILE *temp_action_file;
int end_of_buffer_state;
! char *action_file_name;
/* flex - main program
***************
*** 376,381 ****
--- 376,382 ----
if ( (skelfile = fopen( skelname, "r" )) == NULL )
lerrsf( "can't open skeleton file %s", skelname );
+ action_file_name = strdup("/tmp/flexXXXXXX");
(void) mktemp( action_file_name );
if ( (temp_action_file = fopen( action_file_name, "w" )) == NULL )
--
James R. Van Artsdalen james@bigtex.cactus.org "Live Free or Die"
Home: 512-346-2444 Work: 338-8789 9505 Arboretum Blvd Austin TX 78759