]> granicus.if.org Git - flex/commitdiff
Added action_define()
authorVern Paxson <vern@ee.lbl.gov>
Mon, 27 Dec 1993 14:40:05 +0000 (14:40 +0000)
committerVern Paxson <vern@ee.lbl.gov>
Mon, 27 Dec 1993 14:40:05 +0000 (14:40 +0000)
misc.c

diff --git a/misc.c b/misc.c
index 12e4cf13077e9b57777faa9d545288d84842e687..744cdfbc92e49ba647f895b450d31c03ad19a554 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -38,6 +38,24 @@ void dataflush PROTO((void));
 int otoi PROTO((Char []));
 
 
+void action_define( defname, value )
+char *defname;
+int value;
+       {
+       char buf[MAXLINE];
+
+       if ( strlen( defname ) > MAXLINE / 2 )
+               {
+               format_pinpoint_message( "name \"%s\" ridiculously long", 
+                       defname );
+               return;
+               }
+
+       sprintf( buf, "#define %s %d\n", defname, value );
+       add_action( buf );
+       }
+
+
 void add_action( new_text )
 char *new_text;
        {
@@ -149,7 +167,7 @@ int c;
                        readable_form( c ) );
 
        if ( c >= csize )
-               lerrsf( "scanner requires -8 flag to use the character '%s'",
+               lerrsf( "scanner requires -8 flag to use the character %s",
                        readable_form( c ) );
        }