summaryrefslogtreecommitdiff
path: root/usr.bin/lex
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/lex')
-rw-r--r--usr.bin/lex/gen.c15
-rw-r--r--usr.bin/lex/initscan.c18
-rw-r--r--usr.bin/lex/main.c10
-rw-r--r--usr.bin/lex/misc.c20
-rw-r--r--usr.bin/lex/nfa.c14
-rw-r--r--usr.bin/lex/parse.y15
-rw-r--r--usr.bin/lex/scan.l17
7 files changed, 52 insertions, 57 deletions
diff --git a/usr.bin/lex/gen.c b/usr.bin/lex/gen.c
index 0acd0718db5..b3710592710 100644
--- a/usr.bin/lex/gen.c
+++ b/usr.bin/lex/gen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: gen.c,v 1.7 2002/05/30 10:53:44 deraadt Exp $ */
+/* $OpenBSD: gen.c,v 1.8 2002/05/31 00:56:21 deraadt Exp $ */
/* gen - actual generation (writing) of flex scanners */
@@ -28,7 +28,7 @@
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-/* $Header: /cvs/OpenBSD/src/usr.bin/lex/gen.c,v 1.7 2002/05/30 10:53:44 deraadt Exp $ */
+/* $Header: /cvs/OpenBSD/src/usr.bin/lex/gen.c,v 1.8 2002/05/31 00:56:21 deraadt Exp $ */
#include "flexdef.h"
@@ -605,18 +605,17 @@ int worry_about_NULs;
if ( worry_about_NULs && ! nultrans )
{
if ( useecs )
- (void) snprintf( char_map, sizeof char_map,
+ (void) sprintf( char_map,
"(*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : %d)",
NUL_ec );
else
- (void) snprintf( char_map, sizeof char_map,
+ (void) sprintf( char_map,
"(*yy_cp ? YY_SC_TO_UI(*yy_cp) : %d)", NUL_ec );
}
else
- strlcpy( char_map, useecs ?
- "yy_ec[YY_SC_TO_UI(*yy_cp)]" : "YY_SC_TO_UI(*yy_cp)",
- sizeof char_map );
+ strcpy( char_map, useecs ?
+ "yy_ec[YY_SC_TO_UI(*yy_cp)]" : "YY_SC_TO_UI(*yy_cp)" );
if ( worry_about_NULs && nultrans )
{
@@ -713,7 +712,7 @@ void gen_NUL_trans()
{
char NUL_ec_str[20];
- (void) snprintf( NUL_ec_str, sizeof NUL_ec_str, "%d", NUL_ec );
+ (void) sprintf( NUL_ec_str, "%d", NUL_ec );
gen_next_compressed_state( NUL_ec_str );
do_indent();
diff --git a/usr.bin/lex/initscan.c b/usr.bin/lex/initscan.c
index 47a25c0d6b4..80fe2171fde 100644
--- a/usr.bin/lex/initscan.c
+++ b/usr.bin/lex/initscan.c
@@ -1,10 +1,10 @@
-/* $OpenBSD: initscan.c,v 1.7 2002/05/30 10:53:44 deraadt Exp $ */
+/* $OpenBSD: initscan.c,v 1.8 2002/05/31 00:56:21 deraadt Exp $ */
#line 2 "scan.c"
/* A lexical scanner generated by flex */
/* Scanner skeleton version:
- * $Header: /cvs/OpenBSD/src/usr.bin/lex/initscan.c,v 1.7 2002/05/30 10:53:44 deraadt Exp $
+ * $Header: /cvs/OpenBSD/src/usr.bin/lex/initscan.c,v 1.8 2002/05/31 00:56:21 deraadt Exp $
*/
#define FLEX_SCANNER
@@ -1272,7 +1272,7 @@ char *yytext;
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-/* $Header: /cvs/OpenBSD/src/usr.bin/lex/initscan.c,v 1.7 2002/05/30 10:53:44 deraadt Exp $ */
+/* $Header: /cvs/OpenBSD/src/usr.bin/lex/initscan.c,v 1.8 2002/05/31 00:56:21 deraadt Exp $ */
#include "flexdef.h"
#include "parse.h"
@@ -1294,7 +1294,7 @@ char *yytext;
return CHAR;
#define RETURNNAME \
- strlcpy( nmstr, yytext, sizeof nmstr ); \
+ strcpy( nmstr, yytext ); \
return NAME;
#define PUT_BACK_STRING(str, start) \
@@ -1667,7 +1667,7 @@ case 15:
YY_RULE_SETUP
#line 138 "scan.l"
{
- strlcpy( nmstr, yytext, sizeof nmstr );
+ strcpy( nmstr, yytext );
didadef = false;
BEGIN(PICKUPDEF);
}
@@ -1768,7 +1768,7 @@ case 31:
YY_RULE_SETUP
#line 186 "scan.l"
{
- strlcpy( (char *) nmdef, yytext, sizeof nmdef );
+ strcpy( (char *) nmdef, yytext );
/* Skip trailing whitespace. */
for ( i = strlen( (char *) nmdef ) - 1;
@@ -2046,7 +2046,7 @@ case 80:
YY_RULE_SETUP
#line 279 "scan.l"
{
- strlcpy( nmstr, yytext + 1, sizeof nmstr );
+ strcpy( nmstr, yytext + 1 );
nmstr[strlen( nmstr ) - 1] = '\0';
return NAME;
}
@@ -2257,7 +2257,7 @@ YY_RULE_SETUP
{
int cclval;
- strlcpy( nmstr, yytext, sizeof nmstr );
+ strcpy( nmstr, yytext );
/* Check to see if we've already encountered this
* ccl.
@@ -2295,7 +2295,7 @@ YY_RULE_SETUP
Char *nmdefptr;
Char *ndlookup();
- strlcpy( nmstr, yytext + 1, sizeof nmstr );
+ strcpy( nmstr, yytext + 1 );
nmstr[yyleng - 2] = '\0'; /* chop trailing brace */
if ( (nmdefptr = ndlookup( nmstr )) == 0 )
diff --git a/usr.bin/lex/main.c b/usr.bin/lex/main.c
index d174b03b947..438be7e2cea 100644
--- a/usr.bin/lex/main.c
+++ b/usr.bin/lex/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.6 2002/05/30 10:53:44 deraadt Exp $ */
+/* $OpenBSD: main.c,v 1.7 2002/05/31 00:56:21 deraadt Exp $ */
/* flex - tool to generate fast lexical analyzers */
@@ -34,7 +34,7 @@ char copyright[] =
All rights reserved.\n";
#endif /* not lint */
-/* $Header: /cvs/OpenBSD/src/usr.bin/lex/main.c,v 1.6 2002/05/30 10:53:44 deraadt Exp $ */
+/* $Header: /cvs/OpenBSD/src/usr.bin/lex/main.c,v 1.7 2002/05/31 00:56:21 deraadt Exp $ */
#include "flexdef.h"
@@ -286,8 +286,8 @@ void check_options()
else
suffix = "c";
- snprintf( outfile_path, sizeof outfile_path,
- outfile_template, prefix, suffix );
+ sprintf( outfile_path, outfile_template,
+ prefix, suffix );
outfilename = outfile_path;
}
@@ -1135,7 +1135,7 @@ _( "%s [-bcdfhilnpstvwBFILTV78+? -C[aefFmr] -ooutput -Pprefix -Sskeleton]\n" ),
if ( ! did_outfilename )
{
- snprintf( outfile_path, sizeof outfile_path, outfile_template,
+ sprintf( outfile_path, outfile_template,
prefix, C_plus_plus ? "cc" : "c" );
outfilename = outfile_path;
}
diff --git a/usr.bin/lex/misc.c b/usr.bin/lex/misc.c
index 51667103ae2..146ff823212 100644
--- a/usr.bin/lex/misc.c
+++ b/usr.bin/lex/misc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: misc.c,v 1.7 2002/05/30 10:53:44 deraadt Exp $ */
+/* $OpenBSD: misc.c,v 1.8 2002/05/31 00:56:21 deraadt Exp $ */
/* misc - miscellaneous flex routines */
@@ -28,7 +28,7 @@
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-/* $Header: /cvs/OpenBSD/src/usr.bin/lex/misc.c,v 1.7 2002/05/30 10:53:44 deraadt Exp $ */
+/* $Header: /cvs/OpenBSD/src/usr.bin/lex/misc.c,v 1.8 2002/05/31 00:56:21 deraadt Exp $ */
#include "flexdef.h"
@@ -46,7 +46,7 @@ int value;
return;
}
- snprintf( buf, sizeof buf, "#define %s %d\n", defname, value );
+ sprintf( buf, "#define %s %d\n", defname, value );
add_action( buf );
}
@@ -364,7 +364,7 @@ const char msg[];
int arg;
{
char errmsg[MAXLINE];
- (void) snprintf( errmsg, sizeof errmsg, msg, arg );
+ (void) sprintf( errmsg, msg, arg );
flexerror( errmsg );
}
@@ -376,7 +376,7 @@ const char msg[], arg[];
{
char errmsg[MAXLINE];
- (void) snprintf( errmsg, sizeof errmsg, msg, arg );
+ (void) sprintf( errmsg, msg, arg );
flexerror( errmsg );
}
@@ -414,16 +414,14 @@ int do_infile;
*s2 = '\0';
if ( do_infile )
- snprintf( directive, sizeof directive, line_fmt,
- linenum, filename );
+ sprintf( directive, line_fmt, linenum, filename );
else
{
if ( output_file == stdout )
/* Account for the line directive itself. */
++out_linenum;
- snprintf( directive, sizeof directive, line_fmt,
- out_linenum, filename );
+ sprintf( directive, line_fmt, out_linenum, filename );
}
/* If output_file is nil then we should put the directive in
@@ -735,8 +733,8 @@ int c;
#endif
default:
- (void) snprintf( rform, sizeof rform,
- "\\%.3o", (unsigned int) c );
+ (void) sprintf( rform, "\\%.3o",
+ (unsigned int) c );
return rform;
}
}
diff --git a/usr.bin/lex/nfa.c b/usr.bin/lex/nfa.c
index c92256da3ad..b36fd774236 100644
--- a/usr.bin/lex/nfa.c
+++ b/usr.bin/lex/nfa.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfa.c,v 1.6 2002/05/30 10:53:44 deraadt Exp $ */
+/* $OpenBSD: nfa.c,v 1.7 2002/05/31 00:56:21 deraadt Exp $ */
/* nfa - NFA construction routines */
@@ -28,7 +28,7 @@
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-/* $Header: /cvs/OpenBSD/src/usr.bin/lex/nfa.c,v 1.6 2002/05/30 10:53:44 deraadt Exp $ */
+/* $Header: /cvs/OpenBSD/src/usr.bin/lex/nfa.c,v 1.7 2002/05/31 00:56:21 deraadt Exp $ */
#include "flexdef.h"
@@ -215,7 +215,7 @@ int mach, variable_trail_rule, headcnt, trailcnt;
if ( continued_action )
--rule_linenum[num_rules];
- snprintf( action_text, sizeof action_text, "case %d:\n", num_rules );
+ sprintf( action_text, "case %d:\n", num_rules );
add_action( action_text );
if ( variable_trail_rule )
@@ -247,16 +247,14 @@ int mach, variable_trail_rule, headcnt, trailcnt;
if ( headcnt > 0 )
{
- snprintf( action_text, sizeof action_text,
- "%s = %s + %d;\n",
- scanner_cp, scanner_bp, headcnt );
+ sprintf( action_text, "%s = %s + %d;\n",
+ scanner_cp, scanner_bp, headcnt );
add_action( action_text );
}
else
{
- snprintf( action_text, sizeof action_text,
- "%s -= %d;\n",
+ sprintf( action_text, "%s -= %d;\n",
scanner_cp, trailcnt );
add_action( action_text );
}
diff --git a/usr.bin/lex/parse.y b/usr.bin/lex/parse.y
index ffebdf06c19..e8775a085c1 100644
--- a/usr.bin/lex/parse.y
+++ b/usr.bin/lex/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.5 2002/05/30 10:53:45 deraadt Exp $ */
+/* $OpenBSD: parse.y,v 1.6 2002/05/31 00:56:21 deraadt Exp $ */
/* parse.y - parser for flex input */
@@ -35,7 +35,7 @@
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-/* $Header: /cvs/OpenBSD/src/usr.bin/lex/parse.y,v 1.5 2002/05/30 10:53:45 deraadt Exp $ */
+/* $Header: /cvs/OpenBSD/src/usr.bin/lex/parse.y,v 1.6 2002/05/31 00:56:21 deraadt Exp $ */
/* Some versions of bison are broken in that they use alloca() but don't
@@ -796,8 +796,7 @@ void build_eof_action()
else
{
sceof[scon_stk[i]] = true;
- snprintf( action_text, sizeof action_text,
- "case YY_STATE_EOF(%s):\n",
+ sprintf( action_text, "case YY_STATE_EOF(%s):\n",
scname[scon_stk[i]] );
add_action( action_text );
}
@@ -822,7 +821,7 @@ char msg[], arg[];
{
char errmsg[MAXLINE];
- (void) snprintf( errmsg, sizeof errmsg, msg, arg );
+ (void) sprintf( errmsg, msg, arg );
synerr( errmsg );
}
@@ -844,7 +843,7 @@ char msg[], arg[];
{
char warn_msg[MAXLINE];
- (void) snprintf( warn_msg, sizeof warn_msg, msg, arg );
+ (void) sprintf( warn_msg, msg, arg );
warn( warn_msg );
}
@@ -866,7 +865,7 @@ char msg[], arg[];
{
char errmsg[MAXLINE];
- (void) snprintf( errmsg, sizeof errmsg, msg, arg );
+ (void) sprintf( errmsg, msg, arg );
pinpoint_message( errmsg );
}
@@ -890,7 +889,7 @@ int line;
if ( ! nowarn )
{
- snprintf( warning, sizeof warning, "warning, %s", str );
+ sprintf( warning, "warning, %s", str );
line_pinpoint( warning, line );
}
}
diff --git a/usr.bin/lex/scan.l b/usr.bin/lex/scan.l
index e692e2f0204..a626301b9e7 100644
--- a/usr.bin/lex/scan.l
+++ b/usr.bin/lex/scan.l
@@ -1,4 +1,4 @@
-/* $OpenBSD: scan.l,v 1.5 2002/05/30 10:53:45 deraadt Exp $ */
+/* $OpenBSD: scan.l,v 1.6 2002/05/31 00:56:21 deraadt Exp $ */
/* scan.l - scanner for flex input */
@@ -29,7 +29,7 @@
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-/* $Header: /cvs/OpenBSD/src/usr.bin/lex/scan.l,v 1.5 2002/05/30 10:53:45 deraadt Exp $ */
+/* $Header: /cvs/OpenBSD/src/usr.bin/lex/scan.l,v 1.6 2002/05/31 00:56:21 deraadt Exp $ */
#include "flexdef.h"
#include "parse.h"
@@ -51,7 +51,7 @@
return CHAR;
#define RETURNNAME \
- strlcpy( nmstr, yytext, sizeof nmstr); \
+ strcpy( nmstr, yytext ); \
return NAME;
#define PUT_BACK_STRING(str, start) \
@@ -138,7 +138,7 @@ LEXOPT [aceknopr]
^"%"[^sxaceknopr{}].* synerr( _( "unrecognized '%' directive" ) );
^{NAME} {
- strlcpy( nmstr, yytext, sizeof nmstr );
+ strcpy( nmstr, yytext );
didadef = false;
BEGIN(PICKUPDEF);
}
@@ -186,7 +186,7 @@ LEXOPT [aceknopr]
{WS} /* separates name and definition */
{NOT_WS}.* {
- strlcpy( (char *) nmdef, yytext, sizeof nmdef);
+ strcpy( (char *) nmdef, yytext );
/* Skip trailing whitespace. */
for ( i = strlen( (char *) nmdef ) - 1;
@@ -279,7 +279,8 @@ LEXOPT [aceknopr]
yyclass return OPT_YYCLASS;
\"[^"\n]*\" {
- strlcpy( nmstr, yytext + 1, sizeof nmstr);
+ strcpy( nmstr, yytext + 1 );
+ nmstr[strlen( nmstr ) - 1] = '\0';
return NAME;
}
@@ -402,7 +403,7 @@ LEXOPT [aceknopr]
"["({FIRST_CCL_CHAR}|{CCL_EXPR})({CCL_CHAR}|{CCL_EXPR})* {
int cclval;
- strlcpy( nmstr, yytext, sizeof nmstr);
+ strcpy( nmstr, yytext );
/* Check to see if we've already encountered this
* ccl.
@@ -437,7 +438,7 @@ LEXOPT [aceknopr]
register Char *nmdefptr;
Char *ndlookup();
- strlcpy( nmstr, yytext + 1, sizeof nmstr );
+ strcpy( nmstr, yytext + 1 );
nmstr[yyleng - 2] = '\0'; /* chop trailing brace */
if ( (nmdefptr = ndlookup( nmstr )) == 0 )