aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2011-12-31 21:05:39 +0200
committerArnold D. Robbins <arnold@skeeve.com>2011-12-31 21:05:39 +0200
commitdc5f240cf358edaf8191f5a36f9066b0f0817462 (patch)
treea185cb4126077dc8cd843cdba77d8a5bba1d9fdc
parentccb220159bbbc45aac0572c7ca1d3f0f2247d1f5 (diff)
parenta89bd16ff78c74513461af3f676d87d4eb9cfd3c (diff)
downloadegawk-dc5f240cf358edaf8191f5a36f9066b0f0817462.tar.gz
egawk-dc5f240cf358edaf8191f5a36f9066b0f0817462.tar.bz2
egawk-dc5f240cf358edaf8191f5a36f9066b0f0817462.zip
Merge branch 'gawk-4.0-stable', minor fixes after exe merge.
-rw-r--r--ChangeLog11
-rw-r--r--awk.h5
-rw-r--r--awkgram.c8
-rw-r--r--awkgram.y8
-rw-r--r--builtin.c4
-rw-r--r--cint_array.c2
-rw-r--r--command.c597
-rw-r--r--command.y2
-rw-r--r--debug.c25
-rw-r--r--int_array.c2
-rw-r--r--interpret.h2
-rw-r--r--io.c31
-rw-r--r--msg.c2
-rw-r--r--str_array.c4
-rw-r--r--vms/ChangeLog5
-rw-r--r--vms/vms_misc.c6
16 files changed, 384 insertions, 330 deletions
diff --git a/ChangeLog b/ChangeLog
index f904f7f0..292a03ca 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2011-12-31 Arnold D. Robbins <arnold@skeeve.com>
+
+ * profile_p.c: Remove the file.
+ * msg.c (err): Remove check for name being dgawk.
+
+2011-12-31 Arnold D. Robbins <arnold@skeeve.com>
+
+ * awk.h [STREQ, STREQN]: Remove macros.
+ * awkgram.y, builtin.c, command.y, debug.c, eval.c,
+ io.c, msg.c: Change all uses to call strcmp, strncmp.
+
2011-12-28 Arnold D. Robbins <arnold@skeeve.com>
* int_array.c, str_array.c: Fix some compiler warnings 32/64
diff --git a/awk.h b/awk.h
index a7747b9c..c06e2931 100644
--- a/awk.h
+++ b/awk.h
@@ -1233,13 +1233,8 @@ extern NODE *r_force_string(NODE *s);
#endif /* __GNUC__ */
#endif /* GAWKDEBUG */
-#define STREQ(a,b) (*(a) == *(b) && strcmp((a), (b)) == 0)
-#define STREQN(a,b,n) ((n) && *(a)== *(b) && \
- strncmp((a), (b), (size_t) (n)) == 0)
-
#define fatal set_loc(__FILE__, __LINE__), r_fatal
-
extern jmp_buf fatal_tag;
extern int fatal_tag_valid;
diff --git a/awkgram.c b/awkgram.c
index 5eff6e3f..24c102d4 100644
--- a/awkgram.c
+++ b/awkgram.c
@@ -2855,7 +2855,7 @@ regular_loop:
} else {
if (do_optimize > 1
&& (yyvsp[(3) - (4)])->lasti->opcode == Op_func_call
- && STREQ((yyvsp[(3) - (4)])->lasti->func_name, in_function)
+ && strcmp((yyvsp[(3) - (4)])->lasti->func_name, in_function) == 0
) {
/* Do tail recursion optimization. Tail
* call without a return value is recognized
@@ -6528,7 +6528,6 @@ parms_shadow(INSTRUCTION *pc, int *shadow)
return 0;
}
-
/* valinfo --- dump var info */
void
@@ -6628,8 +6627,7 @@ mk_function(INSTRUCTION *fi, INSTRUCTION *def)
for (t = def->nexti; t->nexti != def->lasti; t = t->nexti)
;
if (t->opcode == Op_func_call
- && STREQ(t->func_name, thisfunc->vname)
- )
+ && strcmp(t->func_name, thisfunc->vname) == 0)
(t + 1)->tail_call = TRUE;
}
@@ -6912,7 +6910,7 @@ variable(int location, char *name, NODETYPE type)
*/
return install_symbol(name, type);
}
- if (STREQ(name, dv->name)) {
+ if (strcmp(name, dv->name) == 0) {
r = (*dv->load_func)();
break;
}
diff --git a/awkgram.y b/awkgram.y
index 968bf533..a64fff01 100644
--- a/awkgram.y
+++ b/awkgram.y
@@ -828,7 +828,7 @@ non_compound_stmt
} else {
if (do_optimize > 1
&& $3->lasti->opcode == Op_func_call
- && STREQ($3->lasti->func_name, in_function)
+ && strcmp($3->lasti->func_name, in_function) == 0
) {
/* Do tail recursion optimization. Tail
* call without a return value is recognized
@@ -3831,7 +3831,6 @@ parms_shadow(INSTRUCTION *pc, int *shadow)
return 0;
}
-
/* valinfo --- dump var info */
void
@@ -3931,8 +3930,7 @@ mk_function(INSTRUCTION *fi, INSTRUCTION *def)
for (t = def->nexti; t->nexti != def->lasti; t = t->nexti)
;
if (t->opcode == Op_func_call
- && STREQ(t->func_name, thisfunc->vname)
- )
+ && strcmp(t->func_name, thisfunc->vname) == 0)
(t + 1)->tail_call = TRUE;
}
@@ -4215,7 +4213,7 @@ variable(int location, char *name, NODETYPE type)
*/
return install_symbol(name, type);
}
- if (STREQ(name, dv->name)) {
+ if (strcmp(name, dv->name) == 0) {
r = (*dv->load_func)();
break;
}
diff --git a/builtin.c b/builtin.c
index 5bc1c023..1da8a4f5 100644
--- a/builtin.c
+++ b/builtin.c
@@ -156,9 +156,9 @@ static FILE *
stdfile(const char *name, size_t len)
{
if (len == 11) {
- if (STREQN(name, "/dev/stderr", 11))
+ if (strncmp(name, "/dev/stderr", 11) == 0)
return stderr;
- else if (STREQN(name, "/dev/stdout", 11))
+ else if (strncmp(name, "/dev/stdout", 11) == 0)
return stdout;
}
diff --git a/cint_array.c b/cint_array.c
index 400e91d2..8ec09239 100644
--- a/cint_array.c
+++ b/cint_array.c
@@ -632,7 +632,7 @@ cint_option(NODE *opt, NODE *val)
tmp = force_string(opt);
(void) force_number(val);
- if (STREQ(tmp->stptr, "NHAT"))
+ if (strcmp(tmp->stptr, "NHAT") == 0)
NHAT = (int) val->numbr;
else
ret = NULL;
diff --git a/command.c b/command.c
index 8b41b6c4..17ba0476 100644
--- a/command.c
+++ b/command.c
@@ -1,10 +1,8 @@
+/* A Bison parser, made by GNU Bison 2.5. */
-/* A Bison parser, made by GNU Bison 2.4.1. */
-
-/* Skeleton implementation for Bison's Yacc-like parsers in C
+/* Bison implementation for Yacc-like parsers in C
- Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
- Free Software Foundation, Inc.
+ Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -46,7 +44,7 @@
#define YYBISON 1
/* Bison version. */
-#define YYBISON_VERSION "2.4.1"
+#define YYBISON_VERSION "2.5"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
@@ -75,7 +73,7 @@
/* Copy the first part of user declarations. */
-/* Line 189 of yacc.c */
+/* Line 268 of yacc.c */
#line 26 "command.y"
#include "awk.h"
@@ -144,8 +142,8 @@ static int find_argument(CMDARG *arg);
#define YYSTYPE CMDARG *
-/* Line 189 of yacc.c */
-#line 149 "command.c"
+/* Line 268 of yacc.c */
+#line 147 "command.c"
/* Enabling traces. */
#ifndef YYDEBUG
@@ -282,8 +280,8 @@ typedef int YYSTYPE;
/* Copy the second part of user declarations. */
-/* Line 264 of yacc.c */
-#line 287 "command.c"
+/* Line 343 of yacc.c */
+#line 285 "command.c"
#ifdef short
# undef short
@@ -333,7 +331,7 @@ typedef short int yytype_int16;
#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
#ifndef YY_
-# if YYENABLE_NLS
+# if defined YYENABLE_NLS && YYENABLE_NLS
# if ENABLE_NLS
# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
# define YY_(msgid) dgettext ("bison-runtime", msgid)
@@ -385,11 +383,11 @@ YYID (yyi)
# define alloca _alloca
# else
# define YYSTACK_ALLOC alloca
-# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
+# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-# ifndef _STDLIB_H
-# define _STDLIB_H 1
+# ifndef EXIT_SUCCESS
+# define EXIT_SUCCESS 0
# endif
# endif
# endif
@@ -412,24 +410,24 @@ YYID (yyi)
# ifndef YYSTACK_ALLOC_MAXIMUM
# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
# endif
-# if (defined __cplusplus && ! defined _STDLIB_H \
+# if (defined __cplusplus && ! defined EXIT_SUCCESS \
&& ! ((defined YYMALLOC || defined malloc) \
&& (defined YYFREE || defined free)))
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-# ifndef _STDLIB_H
-# define _STDLIB_H 1
+# ifndef EXIT_SUCCESS
+# define EXIT_SUCCESS 0
# endif
# endif
# ifndef YYMALLOC
# define YYMALLOC malloc
-# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
+# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
# endif
# endif
# ifndef YYFREE
# define YYFREE free
-# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
+# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
void free (void *); /* INFRINGES ON USER NAME SPACE */
# endif
@@ -456,23 +454,7 @@ union yyalloc
((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
+ YYSTACK_GAP_MAXIMUM)
-/* Copy COUNT objects from FROM to TO. The source and destination do
- not overlap. */
-# ifndef YYCOPY
-# if defined __GNUC__ && 1 < __GNUC__
-# define YYCOPY(To, From, Count) \
- __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
-# else
-# define YYCOPY(To, From, Count) \
- do \
- { \
- YYSIZE_T yyi; \
- for (yyi = 0; yyi < (Count); yyi++) \
- (To)[yyi] = (From)[yyi]; \
- } \
- while (YYID (0))
-# endif
-# endif
+# define YYCOPY_NEEDED 1
/* Relocate STACK from its old location to the new one. The
local variables YYSIZE and YYSTACKSIZE give the old and new number of
@@ -492,6 +474,26 @@ union yyalloc
#endif
+#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
+/* Copy COUNT objects from FROM to TO. The source and destination do
+ not overlap. */
+# ifndef YYCOPY
+# if defined __GNUC__ && 1 < __GNUC__
+# define YYCOPY(To, From, Count) \
+ __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
+# else
+# define YYCOPY(To, From, Count) \
+ do \
+ { \
+ YYSIZE_T yyi; \
+ for (yyi = 0; yyi < (Count); yyi++) \
+ (To)[yyi] = (From)[yyi]; \
+ } \
+ while (YYID (0))
+# endif
+# endif
+#endif /* !YYCOPY_NEEDED */
+
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 2
/* YYLAST -- Last index in YYTABLE. */
@@ -722,8 +724,8 @@ static const yytype_uint8 yyr2[] =
1, 1, 2, 1, 2, 2, 1
};
-/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
- STATE-NUM when YYTABLE doesn't specify something else to do. Zero
+/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
+ Performed when YYTABLE doesn't specify something else to do. Zero
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
@@ -802,8 +804,7 @@ static const yytype_int16 yypgoto[] =
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
positive, shift that token. If negative, reduce the rule which
- number is the opposite. If zero, do what YYDEFACT says.
- If YYTABLE_NINF, syntax error. */
+ number is the opposite. If YYTABLE_NINF, syntax error. */
#define YYTABLE_NINF -148
static const yytype_int16 yytable[] =
{
@@ -830,6 +831,12 @@ static const yytype_int16 yytable[] =
0, 0, 0, 45
};
+#define yypact_value_is_default(yystate) \
+ ((yystate) == (-151))
+
+#define yytable_value_is_error(yytable_value) \
+ YYID (0)
+
static const yytype_int16 yycheck[] =
{
3, 6, 17, 17, 81, 1, 83, 1, 85, 86,
@@ -894,9 +901,18 @@ static const yytype_uint8 yystos[] =
/* Like YYERROR except do call yyerror. This remains here temporarily
to ease the transition to the new meaning of YYERROR, for GCC.
- Once GCC version 2 has supplanted version 1, this can go. */
+ Once GCC version 2 has supplanted version 1, this can go. However,
+ YYFAIL appears to be in use. Nevertheless, it is formally deprecated
+ in Bison 2.4.2's NEWS entry, where a plan to phase it out is
+ discussed. */
#define YYFAIL goto yyerrlab
+#if defined YYFAIL
+ /* This is here to suppress warnings from the GCC cpp's
+ -Wunused-macros. Normally we don't worry about that warning, but
+ some users do, and we want to make it easy for users to remove
+ YYFAIL uses, which will produce warnings from Bison 2.5. */
+#endif
#define YYRECOVERING() (!!yyerrstatus)
@@ -906,7 +922,6 @@ do \
{ \
yychar = (Token); \
yylval = (Value); \
- yytoken = YYTRANSLATE (yychar); \
YYPOPSTACK (1); \
goto yybackup; \
} \
@@ -948,19 +963,10 @@ while (YYID (0))
#endif
-/* YY_LOCATION_PRINT -- Print the location on the stream.
- This macro was not mandated originally: define only if we know
- we won't break user code: when these are the locations we know. */
+/* This macro is provided for backward compatibility. */
#ifndef YY_LOCATION_PRINT
-# if YYLTYPE_IS_TRIVIAL
-# define YY_LOCATION_PRINT(File, Loc) \
- fprintf (File, "%d.%d-%d.%d", \
- (Loc).first_line, (Loc).first_column, \
- (Loc).last_line, (Loc).last_column)
-# else
-# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
-# endif
+# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
#endif
@@ -1148,7 +1154,6 @@ int yydebug;
# define YYMAXDEPTH 10000
#endif
-
#if YYERROR_VERBOSE
@@ -1249,115 +1254,142 @@ yytnamerr (char *yyres, const char *yystr)
}
# endif
-/* Copy into YYRESULT an error message about the unexpected token
- YYCHAR while in state YYSTATE. Return the number of bytes copied,
- including the terminating null byte. If YYRESULT is null, do not
- copy anything; just return the number of bytes that would be
- copied. As a special case, return 0 if an ordinary "syntax error"
- message will do. Return YYSIZE_MAXIMUM if overflow occurs during
- size calculation. */
-static YYSIZE_T
-yysyntax_error (char *yyresult, int yystate, int yychar)
-{
- int yyn = yypact[yystate];
+/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
+ about the unexpected token YYTOKEN for the state stack whose top is
+ YYSSP.
- if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
- return 0;
- else
+ Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
+ not large enough to hold the message. In that case, also set
+ *YYMSG_ALLOC to the required number of bytes. Return 2 if the
+ required number of bytes is too large to store. */
+static int
+yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
+ yytype_int16 *yyssp, int yytoken)
+{
+ YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]);
+ YYSIZE_T yysize = yysize0;
+ YYSIZE_T yysize1;
+ enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
+ /* Internationalized format string. */
+ const char *yyformat = 0;
+ /* Arguments of yyformat. */
+ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
+ /* Number of reported tokens (one for the "unexpected", one per
+ "expected"). */
+ int yycount = 0;
+
+ /* There are many possibilities here to consider:
+ - Assume YYFAIL is not used. It's too flawed to consider. See
+ <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
+ for details. YYERROR is fine as it does not invoke this
+ function.
+ - If this state is a consistent state with a default action, then
+ the only way this function was invoked is if the default action
+ is an error action. In that case, don't check for expected
+ tokens because there are none.
+ - The only way there can be no lookahead present (in yychar) is if
+ this state is a consistent state with a default action. Thus,
+ detecting the absence of a lookahead is sufficient to determine
+ that there is no unexpected or expected token to report. In that
+ case, just report a simple "syntax error".
+ - Don't assume there isn't a lookahead just because this state is a
+ consistent state with a default action. There might have been a
+ previous inconsistent state, consistent state with a non-default
+ action, or user semantic action that manipulated yychar.
+ - Of course, the expected token list depends on states to have
+ correct lookahead information, and it depends on the parser not
+ to perform extra reductions after fetching a lookahead from the
+ scanner and before detecting a syntax error. Thus, state merging
+ (from LALR or IELR) and default reductions corrupt the expected
+ token list. However, the list is correct for canonical LR with
+ one exception: it will still contain any token that will not be
+ accepted due to an error action in a later state.
+ */
+ if (yytoken != YYEMPTY)
{
- int yytype = YYTRANSLATE (yychar);
- YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
- YYSIZE_T yysize = yysize0;
- YYSIZE_T yysize1;
- int yysize_overflow = 0;
- enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
- char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
- int yyx;
-
-# if 0
- /* This is so xgettext sees the translatable formats that are
- constructed on the fly. */
- YY_("syntax error, unexpected %s");
- YY_("syntax error, unexpected %s, expecting %s");
- YY_("syntax error, unexpected %s, expecting %s or %s");
- YY_("syntax error, unexpected %s, expecting %s or %s or %s");
- YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
-# endif
- char *yyfmt;
- char const *yyf;
- static char const yyunexpected[] = "syntax error, unexpected %s";
- static char const yyexpecting[] = ", expecting %s";
- static char const yyor[] = " or %s";
- char yyformat[sizeof yyunexpected
- + sizeof yyexpecting - 1
- + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
- * (sizeof yyor - 1))];
- char const *yyprefix = yyexpecting;
-
- /* Start YYX at -YYN if negative to avoid negative indexes in
- YYCHECK. */
- int yyxbegin = yyn < 0 ? -yyn : 0;
-
- /* Stay within bounds of both yycheck and yytname. */
- int yychecklim = YYLAST - yyn + 1;
- int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
- int yycount = 1;
-
- yyarg[0] = yytname[yytype];
- yyfmt = yystpcpy (yyformat, yyunexpected);
-
- for (yyx = yyxbegin; yyx < yyxend; ++yyx)
- if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
- {
- if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
- {
- yycount = 1;
- yysize = yysize0;
- yyformat[sizeof yyunexpected - 1] = '\0';
- break;
- }
- yyarg[yycount++] = yytname[yyx];
- yysize1 = yysize + yytnamerr (0, yytname[yyx]);
- yysize_overflow |= (yysize1 < yysize);
- yysize = yysize1;
- yyfmt = yystpcpy (yyfmt, yyprefix);
- yyprefix = yyor;
- }
+ int yyn = yypact[*yyssp];
+ yyarg[yycount++] = yytname[yytoken];
+ if (!yypact_value_is_default (yyn))
+ {
+ /* Start YYX at -YYN if negative to avoid negative indexes in
+ YYCHECK. In other words, skip the first -YYN actions for
+ this state because they are default actions. */
+ int yyxbegin = yyn < 0 ? -yyn : 0;
+ /* Stay within bounds of both yycheck and yytname. */
+ int yychecklim = YYLAST - yyn + 1;
+ int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
+ int yyx;
+
+ for (yyx = yyxbegin; yyx < yyxend; ++yyx)
+ if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
+ && !yytable_value_is_error (yytable[yyx + yyn]))
+ {
+ if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
+ {
+ yycount = 1;
+ yysize = yysize0;
+ break;
+ }
+ yyarg[yycount++] = yytname[yyx];
+ yysize1 = yysize + yytnamerr (0, yytname[yyx]);
+ if (! (yysize <= yysize1
+ && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+ return 2;
+ yysize = yysize1;
+ }
+ }
+ }
- yyf = YY_(yyformat);
- yysize1 = yysize + yystrlen (yyf);
- yysize_overflow |= (yysize1 < yysize);
- yysize = yysize1;
+ switch (yycount)
+ {
+# define YYCASE_(N, S) \
+ case N: \
+ yyformat = S; \
+ break
+ YYCASE_(0, YY_("syntax error"));
+ YYCASE_(1, YY_("syntax error, unexpected %s"));
+ YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
+ YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
+ YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
+ YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
+# undef YYCASE_
+ }
- if (yysize_overflow)
- return YYSIZE_MAXIMUM;
+ yysize1 = yysize + yystrlen (yyformat);
+ if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+ return 2;
+ yysize = yysize1;
- if (yyresult)
- {
- /* Avoid sprintf, as that infringes on the user's name space.
- Don't have undefined behavior even if the translation
- produced a string with the wrong number of "%s"s. */
- char *yyp = yyresult;
- int yyi = 0;
- while ((*yyp = *yyf) != '\0')
- {
- if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
- {
- yyp += yytnamerr (yyp, yyarg[yyi++]);
- yyf += 2;
- }
- else
- {
- yyp++;
- yyf++;
- }
- }
- }
- return yysize;
+ if (*yymsg_alloc < yysize)
+ {
+ *yymsg_alloc = 2 * yysize;
+ if (! (yysize <= *yymsg_alloc
+ && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
+ *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
+ return 1;
}
+
+ /* Avoid sprintf, as that infringes on the user's name space.
+ Don't have undefined behavior even if the translation
+ produced a string with the wrong number of "%s"s. */
+ {
+ char *yyp = *yymsg;
+ int yyi = 0;
+ while ((*yyp = *yyformat) != '\0')
+ if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
+ {
+ yyp += yytnamerr (yyp, yyarg[yyi++]);
+ yyformat += 2;
+ }
+ else
+ {
+ yyp++;
+ yyformat++;
+ }
+ }
+ return 0;
}
#endif /* YYERROR_VERBOSE */
-
/*-----------------------------------------------.
| Release the memory associated to this symbol. |
@@ -1389,6 +1421,7 @@ yydestruct (yymsg, yytype, yyvaluep)
}
}
+
/* Prevent warnings from -Wmissing-prototypes. */
#ifdef YYPARSE_PARAM
#if defined __STDC__ || defined __cplusplus
@@ -1415,10 +1448,9 @@ YYSTYPE yylval;
int yynerrs;
-
-/*-------------------------.
-| yyparse or yypush_parse. |
-`-------------------------*/
+/*----------.
+| yyparse. |
+`----------*/
#ifdef YYPARSE_PARAM
#if (defined __STDC__ || defined __C99__FUNC__ || defined __cplusplus || defined _MSC_VER)
@@ -1440,8 +1472,6 @@ yyparse ()
#endif
#endif
{
-
-
int yystate;
/* Number of tokens to shift before error messages enabled. */
int yyerrstatus;
@@ -1596,7 +1626,7 @@ yybackup:
/* First try to decide what to do without reference to lookahead token. */
yyn = yypact[yystate];
- if (yyn == YYPACT_NINF)
+ if (yypact_value_is_default (yyn))
goto yydefault;
/* Not known => get a lookahead token if don't already have one. */
@@ -1627,8 +1657,8 @@ yybackup:
yyn = yytable[yyn];
if (yyn <= 0)
{
- if (yyn == 0 || yyn == YYTABLE_NINF)
- goto yyerrlab;
+ if (yytable_value_is_error (yyn))
+ goto yyerrlab;
yyn = -yyn;
goto yyreduce;
}
@@ -1683,7 +1713,7 @@ yyreduce:
{
case 3:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 109 "command.y"
{
cmd_idx = -1;
@@ -1703,7 +1733,7 @@ yyreduce:
case 5:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 128 "command.y"
{
if (errcount == 0 && cmd_idx >= 0) {
@@ -1758,7 +1788,7 @@ yyreduce:
case 6:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 178 "command.y"
{
yyerrok;
@@ -1767,14 +1797,14 @@ yyreduce:
case 22:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 212 "command.y"
{ want_nodeval = TRUE; }
break;
case 23:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 217 "command.y"
{
if (errcount == 0) {
@@ -1794,7 +1824,7 @@ yyreduce:
case 24:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 235 "command.y"
{
(yyval) = append_statement(arg_list, (char *) start_EVAL);
@@ -1807,14 +1837,14 @@ yyreduce:
case 25:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 242 "command.y"
{ (yyval) = append_statement((yyvsp[(1) - (2)]), lexptr_begin); }
break;
case 26:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 243 "command.y"
{
(yyval) = (yyvsp[(3) - (4)]);
@@ -1823,7 +1853,7 @@ yyreduce:
case 27:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 250 "command.y"
{
arg_list = append_statement((yyvsp[(2) - (3)]), (char *) end_EVAL);
@@ -1844,7 +1874,7 @@ yyreduce:
case 28:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 266 "command.y"
{
NODE *n;
@@ -1860,7 +1890,7 @@ yyreduce:
case 34:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 285 "command.y"
{
if (cmdtab[cmd_idx].class == D_FRAME
@@ -1871,7 +1901,7 @@ yyreduce:
case 35:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 291 "command.y"
{
int idx = find_argument((yyvsp[(2) - (2)]));
@@ -1888,49 +1918,49 @@ yyreduce:
case 38:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 304 "command.y"
{ want_nodeval = TRUE; }
break;
case 40:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 305 "command.y"
{ want_nodeval = TRUE; }
break;
case 46:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 310 "command.y"
{ want_nodeval = TRUE; }
break;
case 49:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 312 "command.y"
{ want_nodeval = TRUE; }
break;
case 51:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 313 "command.y"
{ want_nodeval = TRUE; }
break;
case 53:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 314 "command.y"
{ want_nodeval = TRUE; }
break;
case 57:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 318 "command.y"
{
if (in_cmd_src((yyvsp[(2) - (2)])->a_string))
@@ -1940,7 +1970,7 @@ yyreduce:
case 58:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 323 "command.y"
{
if (! input_from_tty)
@@ -1950,7 +1980,7 @@ yyreduce:
case 59:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 328 "command.y"
{
int type = 0;
@@ -1981,7 +2011,7 @@ yyreduce:
case 60:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 354 "command.y"
{
if (! in_commands)
@@ -1996,7 +2026,7 @@ yyreduce:
case 61:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 364 "command.y"
{
if (! in_commands)
@@ -2006,7 +2036,7 @@ yyreduce:
case 62:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 369 "command.y"
{
int idx = find_argument((yyvsp[(2) - (2)]));
@@ -2023,14 +2053,14 @@ yyreduce:
case 63:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 380 "command.y"
{ want_nodeval = TRUE; }
break;
case 64:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 381 "command.y"
{
int type;
@@ -2043,7 +2073,7 @@ yyreduce:
case 65:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 389 "command.y"
{
if (in_commands) {
@@ -2059,7 +2089,7 @@ yyreduce:
case 66:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 403 "command.y"
{
if ((yyvsp[(1) - (1)]) != NULL) {
@@ -2074,42 +2104,42 @@ yyreduce:
case 68:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 417 "command.y"
{ (yyval) = NULL; }
break;
case 69:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 422 "command.y"
{ (yyval) = NULL; }
break;
case 74:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 431 "command.y"
{ (yyval) = NULL; }
break;
case 75:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 436 "command.y"
{ (yyval) = NULL; }
break;
case 77:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 439 "command.y"
{ (yyval) = NULL; }
break;
case 78:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 444 "command.y"
{
NODE *n;
@@ -2121,14 +2151,14 @@ yyreduce:
case 79:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 454 "command.y"
{ (yyval) = NULL; }
break;
case 80:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 456 "command.y"
{
if (find_option((yyvsp[(1) - (1)])->a_string) < 0)
@@ -2138,7 +2168,7 @@ yyreduce:
case 81:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 461 "command.y"
{
if (find_option((yyvsp[(1) - (3)])->a_string) < 0)
@@ -2148,7 +2178,7 @@ yyreduce:
case 82:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 469 "command.y"
{
NODE *n;
@@ -2166,56 +2196,56 @@ yyreduce:
case 83:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 485 "command.y"
{ (yyval) = NULL; }
break;
case 88:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 494 "command.y"
{ (yyval) = NULL; }
break;
case 89:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 495 "command.y"
{ want_nodeval = TRUE; }
break;
case 92:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 497 "command.y"
{ want_nodeval = TRUE; }
break;
case 95:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 503 "command.y"
{ (yyval) = NULL; }
break;
case 97:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 509 "command.y"
{ (yyval) = NULL; }
break;
case 99:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 515 "command.y"
{ (yyval) = NULL; }
break;
case 104:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 527 "command.y"
{
int idx = find_argument((yyvsp[(1) - (2)]));
@@ -2232,7 +2262,7 @@ yyreduce:
case 106:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 543 "command.y"
{
(yyvsp[(2) - (2)])->type = D_array; /* dump all items */
@@ -2242,7 +2272,7 @@ yyreduce:
case 107:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 548 "command.y"
{
(yyvsp[(2) - (3)])->type = D_array;
@@ -2252,21 +2282,21 @@ yyreduce:
case 117:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 574 "command.y"
{ (yyval) = NULL; }
break;
case 118:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 576 "command.y"
{ (yyval) = NULL; }
break;
case 119:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 578 "command.y"
{
CMDARG *a;
@@ -2278,7 +2308,7 @@ yyreduce:
case 126:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 594 "command.y"
{
if ((yyvsp[(1) - (3)])->a_int > (yyvsp[(3) - (3)])->a_int)
@@ -2292,28 +2322,28 @@ yyreduce:
case 127:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 606 "command.y"
{ (yyval) = NULL; }
break;
case 134:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 620 "command.y"
{ (yyval) = (yyvsp[(1) - (1)]); }
break;
case 135:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 622 "command.y"
{ (yyval) = (yyvsp[(1) - (3)]); }
break;
case 137:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 628 "command.y"
{
CMDARG *a;
@@ -2333,21 +2363,21 @@ yyreduce:
case 139:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 647 "command.y"
{ (yyval) = (yyvsp[(1) - (1)]); num_dim = 1; }
break;
case 140:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 649 "command.y"
{ (yyval) = (yyvsp[(1) - (2)]); num_dim++; }
break;
case 142:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 655 "command.y"
{
NODE *n = (yyvsp[(2) - (2)])->a_node;
@@ -2361,7 +2391,7 @@ yyreduce:
case 143:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 664 "command.y"
{
/* a_string is array name, a_count is dimension count */
@@ -2373,14 +2403,14 @@ yyreduce:
case 144:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 674 "command.y"
{ (yyval) = (yyvsp[(1) - (1)]); }
break;
case 145:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 676 "command.y"
{
NODE *n = (yyvsp[(2) - (2)])->a_node;
@@ -2392,7 +2422,7 @@ yyreduce:
case 146:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 683 "command.y"
{
NODE *n = (yyvsp[(2) - (2)])->a_node;
@@ -2406,35 +2436,35 @@ yyreduce:
case 147:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 695 "command.y"
{ (yyval) = NULL; }
break;
case 148:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 697 "command.y"
{ (yyval) = (yyvsp[(1) - (1)]); }
break;
case 149:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 702 "command.y"
{ (yyval) = NULL; }
break;
case 150:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 704 "command.y"
{ (yyval) = (yyvsp[(1) - (1)]); }
break;
case 151:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 709 "command.y"
{
if ((yyvsp[(1) - (1)])->a_int == 0)
@@ -2445,7 +2475,7 @@ yyreduce:
case 152:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 715 "command.y"
{
if ((yyvsp[(2) - (2)])->a_int == 0)
@@ -2456,21 +2486,21 @@ yyreduce:
case 153:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 724 "command.y"
{ (yyval) = (yyvsp[(1) - (1)]); }
break;
case 154:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 726 "command.y"
{ (yyval) = (yyvsp[(2) - (2)]); }
break;
case 155:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 728 "command.y"
{
(yyvsp[(2) - (2)])->a_int = - (yyvsp[(2) - (2)])->a_int;
@@ -2480,7 +2510,7 @@ yyreduce:
case 156:
-/* Line 1455 of yacc.c */
+/* Line 1806 of yacc.c */
#line 736 "command.y"
{
if (lexptr_begin != NULL) {
@@ -2494,10 +2524,21 @@ yyreduce:
-/* Line 1455 of yacc.c */
-#line 2511 "command.c"
+/* Line 1806 of yacc.c */
+#line 2541 "command.c"
default: break;
}
+ /* User semantic actions sometimes alter yychar, and that requires
+ that yytoken be updated with the new translation. We take the
+ approach of translating immediately before every use of yytoken.
+ One alternative is translating here after every semantic action,
+ but that translation would be missed if the semantic action invokes
+ YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
+ if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
+ incorrect destructor might then be invoked immediately. In the
+ case of YYERROR or YYBACKUP, subsequent parser actions might lead
+ to an incorrect destructor call or verbose syntax error message
+ before the lookahead is translated. */
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
YYPOPSTACK (yylen);
@@ -2525,6 +2566,10 @@ yyreduce:
| yyerrlab -- here on detecting error |
`------------------------------------*/
yyerrlab:
+ /* Make sure we have latest lookahead translation. See comments at
+ user semantic actions for why this is necessary. */
+ yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
+
/* If not already recovering from an error, report this error. */
if (!yyerrstatus)
{
@@ -2532,37 +2577,36 @@ yyerrlab:
#if ! YYERROR_VERBOSE
yyerror (YY_("syntax error"));
#else
+# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
+ yyssp, yytoken)
{
- YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
- if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
- {
- YYSIZE_T yyalloc = 2 * yysize;
- if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
- yyalloc = YYSTACK_ALLOC_MAXIMUM;
- if (yymsg != yymsgbuf)
- YYSTACK_FREE (yymsg);
- yymsg = (char *) YYSTACK_ALLOC (yyalloc);
- if (yymsg)
- yymsg_alloc = yyalloc;
- else
- {
- yymsg = yymsgbuf;
- yymsg_alloc = sizeof yymsgbuf;
- }
- }
-
- if (0 < yysize && yysize <= yymsg_alloc)
- {
- (void) yysyntax_error (yymsg, yystate, yychar);
- yyerror (yymsg);
- }
- else
- {
- yyerror (YY_("syntax error"));
- if (yysize != 0)
- goto yyexhaustedlab;
- }
+ char const *yymsgp = YY_("syntax error");
+ int yysyntax_error_status;
+ yysyntax_error_status = YYSYNTAX_ERROR;
+ if (yysyntax_error_status == 0)
+ yymsgp = yymsg;
+ else if (yysyntax_error_status == 1)
+ {
+ if (yymsg != yymsgbuf)
+ YYSTACK_FREE (yymsg);
+ yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
+ if (!yymsg)
+ {
+ yymsg = yymsgbuf;
+ yymsg_alloc = sizeof yymsgbuf;
+ yysyntax_error_status = 2;
+ }
+ else
+ {
+ yysyntax_error_status = YYSYNTAX_ERROR;
+ yymsgp = yymsg;
+ }
+ }
+ yyerror (yymsgp);
+ if (yysyntax_error_status == 2)
+ goto yyexhaustedlab;
}
+# undef YYSYNTAX_ERROR
#endif
}
@@ -2621,7 +2665,7 @@ yyerrlab1:
for (;;)
{
yyn = yypact[yystate];
- if (yyn != YYPACT_NINF)
+ if (!yypact_value_is_default (yyn))
{
yyn += YYTERROR;
if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
@@ -2680,8 +2724,13 @@ yyexhaustedlab:
yyreturn:
if (yychar != YYEMPTY)
- yydestruct ("Cleanup: discarding lookahead",
- yytoken, &yylval);
+ {
+ /* Make sure we have latest lookahead translation. See comments at
+ user semantic actions for why this is necessary. */
+ yytoken = YYTRANSLATE (yychar);
+ yydestruct ("Cleanup: discarding lookahead",
+ yytoken, &yylval);
+ }
/* Do not reclaim the symbols of the rule which action triggered
this YYABORT or YYACCEPT. */
YYPOPSTACK (yylen);
@@ -2706,7 +2755,7 @@ yyreturn:
-/* Line 1675 of yacc.c */
+/* Line 2067 of yacc.c */
#line 746 "command.y"
@@ -3398,7 +3447,7 @@ do_help(CMDARG *arg, int cmd)
i = find_command(name, strlen(name));
if (i >= 0) {
fprintf(out_fp, "%s\n", cmdtab[i].help_txt);
- if (STREQ(cmdtab[i].name, "option"))
+ if (strcmp(cmdtab[i].name, "option") == 0)
option_help();
} else
fprintf(out_fp, _("undefined command: %s\n"), name);
diff --git a/command.y b/command.y
index 18ef0613..64066a02 100644
--- a/command.y
+++ b/command.y
@@ -1433,7 +1433,7 @@ do_help(CMDARG *arg, int cmd)
i = find_command(name, strlen(name));
if (i >= 0) {
fprintf(out_fp, "%s\n", cmdtab[i].help_txt);
- if (STREQ(cmdtab[i].name, "option"))
+ if (strcmp(cmdtab[i].name, "option") == 0)
option_help();
} else
fprintf(out_fp, _("undefined command: %s\n"), name);
diff --git a/debug.c b/debug.c
index 76c2dcb9..5fb8d9e2 100644
--- a/debug.c
+++ b/debug.c
@@ -990,7 +990,7 @@ find_param(const char *name, long num, char **pname)
pcount = func->param_cnt;
for (i = 0; i < pcount; i++) {
fparam = func->fparms[i].param;
- if (STREQ(name, fparam)) {
+ if (strcmp(name, fparam) == 0) {
r = f->stack[i];
if (r->type == Node_array_ref)
r = r->orig_array;
@@ -4052,7 +4052,7 @@ do_save(CMDARG *arg, int cmd ATTRIBUTE_UNUSED)
*/
if (strlen(line) > 1
- && STREQN(line, "sa", 2))
+ && strncmp(line, "sa", 2) == 0)
continue;
fprintf(fp, "%s\n", line);
@@ -4086,7 +4086,7 @@ do_option(CMDARG *arg, int cmd ATTRIBUTE_UNUSED)
value = arg ? arg->a_string : NULL;
for (opt = option_list; opt->name; opt++) { /* linear search */
- if (STREQ(name, opt->name))
+ if (strcmp(name, opt->name) == 0)
break;
}
if (! opt->name)
@@ -4635,8 +4635,9 @@ unserialize_option(char **pstr, int *pstr_len, int field_cnt ATTRIBUTE_UNUSED)
const struct dbg_option *opt;
for (opt = option_list; opt->name; opt++) {
- if (STREQN(pstr[0], opt->name, pstr_len[0])) {
+ if (strncmp(pstr[0], opt->name, pstr_len[0]) == 0) {
char *value;
+
value = estrdup(pstr[1], pstr_len[1]);
(*(opt->assign))(value);
efree(value);
@@ -5047,7 +5048,7 @@ find_option(char *name)
int idx;
for (idx = 0; (p = option_list[idx].name); idx++) {
- if (STREQ(p, name))
+ if (strcmp(p, name) == 0)
return idx;
}
return -1;
@@ -5116,19 +5117,19 @@ set_gawk_output(const char *file)
if (fp == NULL)
close(fd);
- } else if (STREQN(file, "/dev/", 5)) {
+ } else if (strncmp(file, "/dev/", 5) == 0) {
char *cp = (char *) file + 5;
- if (STREQ(cp, "stdout"))
+ if (strcmp(cp, "stdout") == 0)
return;
- if (STREQ(cp, "stderr")) {
+ if (strcmp(cp, "stderr") == 0) {
output_fp = stderr;
output_file = "/dev/stderr";
output_is_tty = os_isatty(fileno(stderr));
return;
}
- if (STREQN(cp, "fd/", 3)) {
+ if (strncmp(cp, "fd/", 3) == 0) {
cp += 3;
fd = (int) strtoul(cp, NULL, 10);
if (errno == 0 && fd > INVALID_HANDLE) {
@@ -5182,9 +5183,9 @@ static int
set_option_flag(const char *value)
{
long n;
- if (STREQ(value, "on"))
+ if (strcmp(value, "on") == 0)
return TRUE;
- if (STREQ(value, "off"))
+ if (strcmp(value, "off") == 0)
return FALSE;
errno = 0;
n = strtol(value, NULL, 0);
@@ -5657,7 +5658,7 @@ in_cmd_src(const char *filename)
{
struct command_source *cs;
for (cs = cmd_src; cs != NULL; cs = cs->next) {
- if (cs->str != NULL && STREQ(cs->str, filename))
+ if (cs->str != NULL && strcmp(cs->str, filename) == 0)
return TRUE;
}
return FALSE;
diff --git a/int_array.c b/int_array.c
index 6adb7633..9dd20bea 100644
--- a/int_array.c
+++ b/int_array.c
@@ -817,7 +817,7 @@ int_option(NODE *opt, NODE *val)
tmp = force_string(opt);
(void) force_number(val);
- if (STREQ(tmp->stptr, "INT_CHAIN_MAX")) {
+ if (strcmp(tmp->stptr, "INT_CHAIN_MAX") == 0) {
newval = (int) val->numbr;
if (newval > 0)
INT_CHAIN_MAX = newval;
diff --git a/interpret.h b/interpret.h
index 66f5b0de..67a702e3 100644
--- a/interpret.h
+++ b/interpret.h
@@ -852,7 +852,7 @@ match_re:
if (t1->stlen > 0) {
/* retrieve function definition node */
f = pc->func_body;
- if (f != NULL && STREQ(f->vname, t1->stptr)) {
+ if (f != NULL && strcmp(f->vname, t1->stptr) == 0) {
/* indirect var hasn't been reassigned */
goto func_call;
diff --git a/io.c b/io.c
index e8c6d872..b6076eba 100644
--- a/io.c
+++ b/io.c
@@ -618,9 +618,8 @@ redirect(NODE *redir_exp, int redirtype, int *errflg)
fatal(_("expression for `%s' redirection has null string value"),
what);
- if (do_lint && (STREQN(str, "0", redir_exp->stlen)
- || STREQN(str, "1", redir_exp->stlen))
- )
+ if (do_lint && (strncmp(str, "0", redir_exp->stlen) == 0
+ || strncmp(str, "1", redir_exp->stlen) == 0))
lintwarn(_("filename `%s' for `%s' redirection may be result of logical expression"),
str, what);
@@ -631,7 +630,7 @@ redirect(NODE *redir_exp, int redirtype, int *errflg)
#ifdef HAVE_SOCKETS
if (inetfile(str, & len, NULL)) {
tflag |= RED_SOCKET;
- if (STREQN(str + len, "tcp/", 4))
+ if (strncmp(str + len, "tcp/", 4) == 0)
tflag |= RED_TCP; /* use shutdown when closing */
}
#endif /* HAVE_SOCKETS */
@@ -1378,7 +1377,7 @@ devopen(const char *name, const char *mode)
flag = str2mode(mode);
- if (STREQ(name, "-"))
+ if (strcmp(name, "-") == 0)
return fileno(stdin);
openfd = INVALID_HANDLE;
@@ -1391,16 +1390,16 @@ devopen(const char *name, const char *mode)
return openfd;
}
- if (STREQN(name, "/dev/", 5)) {
+ if (strncmp(name, "/dev/", 5) == 0) {
cp = (char *) name + 5;
- if (STREQ(cp, "stdin") && (flag & O_ACCMODE) == O_RDONLY)
+ if (strcmp(cp, "stdin") == 0 && (flag & O_ACCMODE) == O_RDONLY)
openfd = fileno(stdin);
- else if (STREQ(cp, "stdout") && (flag & O_ACCMODE) == O_WRONLY)
+ else if (strcmp(cp, "stdout") == 0 && (flag & O_ACCMODE) == O_WRONLY)
openfd = fileno(stdout);
- else if (STREQ(cp, "stderr") && (flag & O_ACCMODE) == O_WRONLY)
+ else if (strcmp(cp, "stderr") == 0 && (flag & O_ACCMODE) == O_WRONLY)
openfd = fileno(stderr);
- else if (STREQN(cp, "fd/", 3)) {
+ else if (strncmp(cp, "fd/", 3) == 0) {
struct stat sbuf;
cp += 3;
@@ -1423,9 +1422,9 @@ devopen(const char *name, const char *mode)
cp = (char *) name + len;
/* which protocol? */
- if (STREQN(cp, "tcp/", 4))
+ if (strncmp(cp, "tcp/", 4) == 0)
protocol = SOCK_STREAM;
- else if (STREQN(cp, "udp/", 4))
+ else if (strncmp(cp, "udp/", 4) == 0)
protocol = SOCK_DGRAM;
else {
protocol = SOCK_STREAM; /* shut up the compiler */
@@ -2404,7 +2403,7 @@ do_find_source(const char *src, struct stat *stb, int *errcode)
emalloc(path, char *, max_pathlen + strlen(src) + 1, "do_find_source");
for (i = 0; awkpath[i] != NULL; i++) {
- if (STREQ(awkpath[i], "./") || STREQ(awkpath[i], ".")) {
+ if (strcmp(awkpath[i], "./") == 0 || strcmp(awkpath[i], ".") == 0) {
/* FIXME: already tried CWD above; Why do it again ? */
*path = '\0';
} else
@@ -3268,19 +3267,19 @@ inetfile(const char *str, int *length, int *family)
{
int ret = FALSE;
- if (STREQN(str, "/inet/", 6)) {
+ if (strncmp(str, "/inet/", 6) == 0) {
ret = TRUE;
if (length != NULL)
*length = 6;
if (family != NULL)
*family = AF_UNSPEC;
- } else if (STREQN(str, "/inet4/", 7)) {
+ } else if (strncmp(str, "/inet4/", 7) == 0) {
ret = TRUE;
if (length != NULL)
*length = 7;
if (family != NULL)
*family = AF_INET;
- } else if (STREQN(str, "/inet6/", 7)) {
+ } else if (strncmp(str, "/inet6/", 7) == 0) {
ret = TRUE;
if (length != NULL)
*length = 7;
diff --git a/msg.c b/msg.c
index 84a4e5cd..10f3837a 100644
--- a/msg.c
+++ b/msg.c
@@ -46,8 +46,6 @@ err(const char *s, const char *emsg, va_list argp)
(void) fflush(output_fp);
me = myname;
- if (STREQN(me, "dgawk", 5))
- me = &myname[1];
(void) fprintf(stderr, "%s: ", me);
#ifdef GAWKDEBUG
if (srcfile != NULL) {
diff --git a/str_array.c b/str_array.c
index 0b17796c..7ce617ed 100644
--- a/str_array.c
+++ b/str_array.c
@@ -684,9 +684,9 @@ str_option(NODE *opt, NODE *val)
tmp = force_string(opt);
(void) force_number(val);
- if (STREQ(tmp->stptr, "STR_CHAIN_MAX")) {
+ if (strcmp(tmp->stptr, "STR_CHAIN_MAX") == 0) {
newval = (int) val->numbr;
- if (newval > 0)
+ if (newval > 0)
STR_CHAIN_MAX = newval;
} else
ret = NULL;
diff --git a/vms/ChangeLog b/vms/ChangeLog
index 62db87e1..a39f1125 100644
--- a/vms/ChangeLog
+++ b/vms/ChangeLog
@@ -1,3 +1,8 @@
+2011-12-31 Arnold D. Robbins <arnold@skeeve.com>
+
+ * vms_misc.c: [STREQ, STREQN]: Change use of macros to call
+ strcmp, strncmp, directly.
+
2011-11-02 Pat Rankin <r.pat.rankin@gmail.com>
* vms-conf.h (HAVE_SETSID, HAVE_SYS_IOCTL): Add but leave undef'd.
diff --git a/vms/vms_misc.c b/vms/vms_misc.c
index f3650ef4..cd92d7ef 100644
--- a/vms/vms_misc.c
+++ b/vms/vms_misc.c
@@ -98,7 +98,7 @@ vms_open( const char *name, int mode, ... )
{
int result;
- if (STREQN(name, "/dev/", 5)) {
+ if (strncmp(name, "/dev/", 5) == 0) {
/* (this used to be handled in vms_devopen(), but that is only
called when opening files for output; we want it for input too) */
if (strcmp(name + 5, "null") == 0) /* /dev/null -> NL: */
@@ -307,7 +307,7 @@ VMS_fstat (fd, statbuf)
if (result == 0 /* GAWK addition; fixup /dev/null flags */
&& (statbuf->st_mode & S_IFREG)
- && STREQ(statbuf->st_dev, "_NLA0:"))
+ && strcmp(statbuf->st_dev, "_NLA0:") == 0)
{
statbuf->st_mode &= ~S_IFREG;
statbuf->st_mode |= S_IFCHR;
@@ -354,7 +354,7 @@ VMS_stat (name, statbuf)
if (result == 0 /* GAWK addition; fixup /dev/null flags */
&& (statbuf->st_mode & S_IFREG)
- && STREQ(statbuf->st_dev, "_NLA0:"))
+ && strcmp(statbuf->st_dev, "_NLA0:") == 0)
{
statbuf->st_mode &= ~S_IFREG;
statbuf->st_mode |= S_IFCHR;