diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2016-10-23 12:14:15 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2016-10-23 12:14:15 +0300 |
commit | e56b6eabe183ed5fa1352ef0f5f49fb6d894578c (patch) | |
tree | 881ac0a12d947a50e41d2e3e80a0f350aec1d2d3 | |
parent | 2c6c33741890ab08659b7c7ef5b8bc91d487f300 (diff) | |
parent | 3055361c2a022c9ac9ae42ac88c00e3055498a0d (diff) | |
download | egawk-e56b6eabe183ed5fa1352ef0f5f49fb6d894578c.tar.gz egawk-e56b6eabe183ed5fa1352ef0f5f49fb6d894578c.tar.bz2 egawk-e56b6eabe183ed5fa1352ef0f5f49fb6d894578c.zip |
Merge branch 'master' into feature/nocopy
72 files changed, 1703 insertions, 2258 deletions
@@ -1,3 +1,9 @@ +2016-10-23 Arnold D. Robbins <arnold@skeeve.com> + + * General: Remove trailing whitespace from all relevant files. + * mpfr.c: Replace Unicode sequences with ASCII. + * cint_array.c: Ditto. + 2016-10-16 Arnold D. Robbins <arnold@skeeve.com> * awkgram.y: Typo fix in call to add_sign_to_num. @@ -2,23 +2,23 @@ * array.c - routines for awk arrays. */ -/* +/* * Copyright (C) 1986, 1988, 1989, 1991-2014, 2016, * the Free Software Foundation, Inc. - * + * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. - * + * * GAWK is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. - * + * * GAWK is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA @@ -102,7 +102,7 @@ make_array() /* vname, flags, and parent_array not set here */ return array; -} +} /* null_array --- force symbol to be an empty typeless array */ @@ -150,7 +150,7 @@ null_lookup(NODE *symbol, NODE *subs) return symbol->alookup(symbol, subs); } -/* null_length --- default function for array length interface */ +/* null_length --- default function for array length interface */ NODE ** null_length(NODE *symbol, NODE *subs ATTRIBUTE_UNUSED) @@ -198,7 +198,7 @@ assoc_copy(NODE *symbol, NODE *newsymb) void assoc_dump(NODE *symbol, NODE *ndump) { - if (symbol->adump) + if (symbol->adump) (void) symbol->adump(symbol, ndump); } @@ -229,7 +229,7 @@ make_aname(const NODE *symbol) max_alen = alen + SLEN; emalloc(aname, char *, (max_alen + 1) * sizeof(char *), "make_aname"); } else if (alen > max_alen) { - max_alen = alen + SLEN; + max_alen = alen + SLEN; erealloc(aname, char *, (max_alen + 1) * sizeof(char *), "make_aname"); } memcpy(aname, symbol->vname, alen + 1); @@ -258,11 +258,11 @@ array_vname(const NODE *symbol) const NODE *save_symbol = symbol; const char *from = _("from %s"); const char *aname; - + if (symbol->type != Node_array_ref || symbol->orig_array->type != Node_var_array ) { - if (symbol->type != Node_var_array || symbol->parent_array == NULL) + if (symbol->type != Node_var_array || symbol->parent_array == NULL) return symbol->vname; return make_aname(symbol); } @@ -373,7 +373,7 @@ force_array(NODE *symbol, bool canfatal) /* set_SUBSEP --- update SUBSEP related variables when SUBSEP assigned to */ - + void set_SUBSEP() { @@ -396,7 +396,7 @@ concat_exp(int nargs, bool do_subsep) size_t subseplen = 0; int i; extern NODE **args_array; - + if (nargs == 1) return POP_STRING(); @@ -498,13 +498,13 @@ adjust_fcall_stack(NODE *symbol, int nsubs) * But excludes cases like (nsubs = 0): * * function f(c, d) { delete c; ..} - * BEGIN { a[0][0] = 1; f(a[0], a[0]); ...} + * BEGIN { a[0][0] = 1; f(a[0], a[0]); ...} */ null_array(r); r->parent_array = NULL; continue; - } + } /* Case 2 */ for (n = n->parent_array; n != NULL; n = n->parent_array) { @@ -648,7 +648,7 @@ do_delete_loop(NODE *symbol, NODE **lhs) efree(list); /* blast the array in one shot */ - adjust_fcall_stack(symbol, 0); + adjust_fcall_stack(symbol, 0); assoc_clear(symbol); } @@ -703,7 +703,7 @@ value_info(NODE *n) if ((n->flags & (STRING|STRCUR)) == STRCUR) { fprintf(output_fp, "]["); - fprintf(output_fp, "stfmt=%d, ", n->stfmt); + fprintf(output_fp, "stfmt=%d, ", n->stfmt); /* * If not STFMT_UNUSED, could be CONVFMT or OFMT if last * used in a print statement. If immutable, could be that it @@ -1054,7 +1054,7 @@ sort_up_index_number(const void *p1, const void *p2) ret = cmp_numbers(t1, t2); if (ret != 0) - return ret; + return ret; /* break a tie with the index string itself */ t1 = force_string((NODE *) t1); @@ -1241,7 +1241,7 @@ sort_user_func(const void *p1, const void *p2) } -/* assoc_list -- construct, and optionally sort, a list of array elements */ +/* assoc_list -- construct, and optionally sort, a list of array elements */ NODE ** assoc_list(NODE *symbol, const char *sort_str, sort_context_t sort_ctxt) @@ -1280,7 +1280,7 @@ assoc_list(NODE *symbol, const char *sort_str, sort_context_t sort_ctxt) extern int currule; int save_rule = 0; assoc_kind_t assoc_kind = ANONE; - + elem_size = 1; for (qi = 0, j = sizeof(sort_funcs)/sizeof(sort_funcs[0]); qi < j; qi++) { @@ -1304,7 +1304,7 @@ assoc_list(NODE *symbol, const char *sort_str, sort_context_t sort_ctxt) } else { /* unrecognized */ NODE *f; - const char *sp; + const char *sp; for (sp = sort_str; *sp != '\0' && ! isspace((unsigned char) *sp); sp++) continue; @@ -1328,7 +1328,7 @@ assoc_list(NODE *symbol, const char *sort_str, sort_context_t sort_ctxt) code->func_body = f; code->func_name = NULL; /* not needed, func_body already assigned */ (code + 1)->expr_count = 4; /* function takes 4 arguments */ - code->nexti = bcalloc(Op_stop, 1, 0); + code->nexti = bcalloc(Op_stop, 1, 0); /* * make non-redirected getline, exit, `next' and `nextfile' fatal in @@ -1355,7 +1355,7 @@ assoc_list(NODE *symbol, const char *sort_str, sort_context_t sort_ctxt) if (cmp_func == sort_user_func) { code = POP_CODE(); - currule = save_rule; /* restore current rule */ + currule = save_rule; /* restore current rule */ bcfree(code->nexti); /* Op_stop */ bcfree(code); /* Op_func_call */ } @@ -1,23 +1,23 @@ /* - * awk.h -- Definitions for gawk. + * awk.h -- Definitions for gawk. */ -/* +/* * Copyright (C) 1986, 1988, 1989, 1991-2016 the Free Software Foundation, Inc. - * + * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. - * + * * GAWK is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. - * + * * GAWK is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA @@ -546,7 +546,7 @@ typedef struct exp_node { #define array_size sub.nodep.cnt #define array_capacity sub.nodep.reserved #define xarray sub.nodep.rn -#define parent_array sub.nodep.x.extra +#define parent_array sub.nodep.x.extra #define ainit array_funcs[0] #define ainit_ind 0 @@ -663,7 +663,7 @@ typedef enum opcodeval { Op_nomatch, Op_rule, - + /* keywords */ Op_K_case, Op_K_default, @@ -728,13 +728,13 @@ typedef enum opcodeval { Op_stop, /* parsing (yylex and yyparse), should never appear in valid compiled code */ - Op_token, + Op_token, Op_symbol, Op_list, /* program structures -- for use in the profiler/pretty printer */ Op_K_do, - Op_K_for, + Op_K_for, Op_K_arrayfor, Op_K_while, Op_K_switch, @@ -803,7 +803,7 @@ typedef struct exp_instruction { /* Op_K_exit */ #define target_end d.di -#define target_atexit x.xi +#define target_atexit x.xi /* Op_newfile, Op_K_getline, Op_nextfile */ #define target_endfile x.xi @@ -892,7 +892,7 @@ typedef struct exp_instruction { #define field_assign x.aptr /* Op_field_assign, Op_var_assign */ -#define assign_ctxt d.dl +#define assign_ctxt d.dl /* Op_concat */ #define concat_flag d.dl @@ -925,7 +925,7 @@ typedef struct exp_instruction { /* Op_line_range */ #define condpair_left d.di -#define condpair_right x.xi +#define condpair_right x.xi /* Op_store_var */ #define initval x.xn @@ -1015,7 +1015,7 @@ typedef struct srcfile { int fd; int maxlen; /* size of the longest line */ - void (*fini_func)(); /* dynamic extension of type SRC_EXTLIB */ + void (*fini_func)(); /* dynamic extension of type SRC_EXTLIB */ char *lexptr; char *lexend; @@ -1053,7 +1053,7 @@ enum block_id { BLOCK_NODE, BLOCK_BUCKET, BLOCK_MAX /* count */ -}; +}; typedef int (*Func_pre_exec)(INSTRUCTION **); typedef void (*Func_post_exec)(INSTRUCTION *); @@ -1067,7 +1067,7 @@ typedef void (*Func_post_exec)(INSTRUCTION *); #ifndef LONG_MIN #define LONG_MIN ((long)(-LONG_MAX - 1L)) #endif -#define UNLIMITED LONG_MAX +#define UNLIMITED LONG_MAX /* -------------------------- External variables -------------------------- */ /* gawk builtin variables */ @@ -1212,7 +1212,7 @@ extern STACK_ITEM *stack_top; #define POP_ADDRESS() (decr_sp()->lptr) #define PEEK(n) ((stack_ptr - (n))->rptr) #define TOP() (stack_ptr->rptr) /* same as PEEK(0) */ -#define TOP_ADDRESS() (stack_ptr->lptr) +#define TOP_ADDRESS() (stack_ptr->lptr) #define PUSH(r) (void) (incr_sp()->rptr = (r)) #define PUSH_ADDRESS(l) (void) (incr_sp()->lptr = (l)) #define REPLACE(r) (void) (stack_ptr->rptr = (r)) @@ -1338,7 +1338,7 @@ if (--val) \ typedef enum { SORTED_IN = 1, ASORT, ASORTI } sort_context_t; typedef enum { ANONE = 0x00, /* "unused" value */ - AINDEX = 0x001, /* list of indices */ + AINDEX = 0x001, /* list of indices */ AVALUE = 0x002, /* list of values */ AINUM = 0x004, /* numeric index */ AISTR = 0x008, /* string index */ @@ -1762,7 +1762,7 @@ POP_SCALAR() if (t->type == Node_var_array) fatal(_("attempt to use array `%s' in a scalar context"), array_vname(t)); - + return t; } @@ -1775,7 +1775,7 @@ TOP_SCALAR() if (t->type == Node_var_array) fatal(_("attempt to use array `%s' in a scalar context"), array_vname(t)); - + return t; } @@ -1793,7 +1793,7 @@ in_array(NODE *a, NODE *s) NODE **ret; ret = a->aexists(a, s); - + return ret ? *ret : NULL; } @@ -80,7 +80,7 @@ static void lintwarn_ln(int line, const char *m, ...) ATTRIBUTE_PRINTF_2; static void warning_ln(int line, const char *m, ...) ATTRIBUTE_PRINTF_2; static char *get_src_buf(void); static int yylex(void); -int yyparse(void); +int yyparse(void); static INSTRUCTION *snode(INSTRUCTION *subn, INSTRUCTION *op); static char **check_params(char *fname, int pcount, INSTRUCTION *list); static int install_function(char *fname, INSTRUCTION *fi, INSTRUCTION *plist); @@ -155,7 +155,7 @@ static char *lexptr; /* pointer to next char during parsing */ static char *lexend; /* end of buffer */ static char *lexptr_begin; /* keep track of where we were for error msgs */ static char *lexeme; /* beginning of lexeme for debugging */ -static bool lexeof; /* seen EOF for current source? */ +static bool lexeof; /* seen EOF for current source? */ static char *thisline = NULL; static int in_braces = 0; /* count braces for firstline, lastline in an 'action' */ static int lastline = 0; @@ -2358,7 +2358,7 @@ yyreduce: int case_count = 0; int i; - tbreak = instruction(Op_no_op); + tbreak = instruction(Op_no_op); cstmt = list_create(tbreak); cexp = list_create(instruction(Op_pop)); dflt = instruction(Op_jmp); @@ -2385,7 +2385,7 @@ yyreduce: error_ln(curr->source_line, _("duplicate case values in switch body: %s"), caseval); } - + if (case_values == NULL) emalloc(case_values, const char **, sizeof(char *) * maxcount, "statement"); else if (case_count >= maxcount) { @@ -2436,7 +2436,7 @@ yyreduce: (void) list_merge(ip, cexp); (yyval) = list_merge(ip, cstmt); - break_allowed--; + break_allowed--; fix_break_continue(ip, tbreak, NULL); } #line 2443 "awkgram.c" /* yacc.c:1646 */ @@ -2444,14 +2444,14 @@ yyreduce: case 47: #line 693 "awkgram.y" /* yacc.c:1646 */ - { + { /* * ----------------- * tc: * cond * ----------------- * [Op_jmp_false tb ] - * ----------------- + * ----------------- * body * ----------------- * [Op_jmp tc ] @@ -2496,7 +2496,7 @@ yyreduce: * z: * body * ----------------- - * tc: + * tc: * cond * ----------------- * [Op_jmp_true | z ] @@ -2547,7 +2547,7 @@ yyreduce: && ((yyvsp[0])->nexti->memory->type != Node_var || !((yyvsp[0])->nexti->memory->var_update)) && strcmp((yyvsp[0])->nexti->memory->vname, var_name) == 0 ) { - + /* Efficiency hack. Recognize the special case of * * for (iggy in foo) @@ -2559,10 +2559,10 @@ yyreduce: * * Check that the body is a `delete a[i]' statement, * and that both the loop var and array names match. - */ + */ NODE *arr = NULL; - ip = (yyvsp[0])->nexti->nexti; + ip = (yyvsp[0])->nexti->nexti; if ((yyvsp[-3])->nexti->opcode == Op_push && (yyvsp[-3])->lasti == (yyvsp[-3])->nexti) arr = (yyvsp[-3])->nexti->memory; if (arr != NULL @@ -2588,7 +2588,7 @@ yyreduce: /* [ Op_push_array a ] * [ Op_arrayfor_init | ib ] - * ic:[ Op_arrayfor_incr | ib ] + * ic:[ Op_arrayfor_incr | ib ] * [ Op_var_assign if any ] * * body @@ -2617,7 +2617,7 @@ regular_loop: } /* else $1 is NULL */ - /* add update_FOO instruction if necessary */ + /* add update_FOO instruction if necessary */ if ((yyvsp[-4])->array_var->type == Node_var && (yyvsp[-4])->array_var->var_update) { (void) list_append(ip, instruction(Op_var_update)); ip->lasti->update_var = (yyvsp[-4])->array_var->var_update; @@ -2633,7 +2633,7 @@ regular_loop: if (do_pretty_print) { (void) list_append(ip, instruction(Op_exec_count)); ((yyvsp[-7]) + 1)->forloop_cond = (yyvsp[-4]); - ((yyvsp[-7]) + 1)->forloop_body = ip->lasti; + ((yyvsp[-7]) + 1)->forloop_body = ip->lasti; } if ((yyvsp[0]) != NULL) @@ -2643,7 +2643,7 @@ regular_loop: ip->lasti->target_jmp = (yyvsp[-4]); (yyval) = list_append(ip, tbreak); fix_break_continue(ip, tbreak, tcont); - } + } break_allowed--; continue_allowed--; @@ -2687,7 +2687,7 @@ regular_loop: case 53: #line 915 "awkgram.y" /* yacc.c:1646 */ - { + { if (! break_allowed) error_ln((yyvsp[-1])->source_line, _("`break' is not allowed outside a loop or switch")); @@ -2747,7 +2747,7 @@ regular_loop: #line 957 "awkgram.y" /* yacc.c:1646 */ { /* Initialize the two possible jump targets, the actual target - * is resolved at run-time. + * is resolved at run-time. */ (yyvsp[-2])->target_end = ip_end; /* first instruction in end_block */ (yyvsp[-2])->target_atexit = ip_atexit; /* cleanup and go home */ @@ -2873,7 +2873,7 @@ regular_loop: * [$1 | NULL | redir_type | expr_count] * */ -regular_print: +regular_print: if ((yyvsp[0]) == NULL) { /* no redirection */ if ((yyvsp[-1]) == NULL) { /* printf without arg */ (yyvsp[-3])->expr_count = 0; @@ -3030,7 +3030,7 @@ regular_print: { INSTRUCTION *casestmt = (yyvsp[0]); if ((yyvsp[0]) == NULL) - casestmt = list_create(instruction(Op_no_op)); + casestmt = list_create(instruction(Op_no_op)); if (do_pretty_print) (void) list_prepend(casestmt, instruction(Op_exec_count)); (yyvsp[-4])->case_exp = (yyvsp[-3]); @@ -3064,7 +3064,7 @@ regular_print: case 75: #line 1231 "awkgram.y" /* yacc.c:1646 */ - { + { NODE *n = (yyvsp[0])->memory; (void) force_number(n); negate_num(n); @@ -3473,7 +3473,7 @@ regular_print: case 130: #line 1500 "awkgram.y" /* yacc.c:1646 */ - { + { (yyvsp[0])->opcode = Op_assign_quotient; (yyval) = (yyvsp[0]); } @@ -3843,7 +3843,7 @@ regular_print: ) { NODE *n = (yyvsp[0])->lasti->memory; (void) force_number(n); - negate_num(n); + negate_num(n); (yyval) = (yyvsp[0]); bcfree((yyvsp[-1])); } else { @@ -3901,7 +3901,7 @@ regular_print: warned = true; lintwarn("%s", msg); } - + f = (yyvsp[0])->lasti; f->opcode = Op_indirect_func_call; name = estrdup(f->func_name, strlen(f->func_name)); @@ -3945,7 +3945,7 @@ regular_print: (yyval) = list_create((yyvsp[-3])); } else { INSTRUCTION *t = (yyvsp[-1]); - ((yyvsp[-3]) + 1)->expr_count = count_expressions(&t, true); + ((yyvsp[-3]) + 1)->expr_count = count_expressions(&t, true); (yyval) = list_append(t, (yyvsp[-3])); } } @@ -3993,7 +3993,7 @@ regular_print: case 179: #line 1878 "awkgram.y" /* yacc.c:1646 */ { - INSTRUCTION *ip = (yyvsp[0])->lasti; + INSTRUCTION *ip = (yyvsp[0])->lasti; int count = ip->sub_count; /* # of SUBSEP-seperated expressions */ if (count > 1) { /* change Op_subscript or Op_sub_array to Op_concat */ @@ -4018,7 +4018,7 @@ regular_print: /* install Null string as subscript. */ t = list_create(instruction(Op_push_i)); t->nexti->memory = dupnode(Nnull_string); - (yyvsp[0])->sub_count = 1; + (yyvsp[0])->sub_count = 1; } else (yyvsp[0])->sub_count = count_expressions(&t, false); (yyval) = list_append(t, (yyvsp[0])); @@ -4393,7 +4393,7 @@ struct token { # define BREAK 0x0800 /* break allowed inside */ # define CONTINUE 0x1000 /* continue allowed inside */ # define DEBUG_USE 0x2000 /* for use by developers */ - + NODE *(*ptr)(int); /* function that implements this keyword */ NODE *(*ptr2)(int); /* alternate arbitrary-precision function */ }; @@ -4525,7 +4525,7 @@ getfname(NODE *(*fptr)(int)) j = sizeof(tokentab) / sizeof(tokentab[0]); /* linear search, no other way to do it */ - for (i = 0; i < j; i++) + for (i = 0; i < j; i++) if (tokentab[i].ptr == fptr || tokentab[i].ptr2 == fptr) return tokentab[i].operator; @@ -4598,7 +4598,7 @@ print_included_from() int saveline, line; SRCFILE *s; - /* suppress current file name, line # from `.. included from ..' msgs */ + /* suppress current file name, line # from `.. included from ..' msgs */ saveline = sourceline; sourceline = 0; @@ -4799,7 +4799,7 @@ mk_program() if (prog_block == NULL) { if (end_block->nexti == end_block->lasti - && beginfile_block->nexti == beginfile_block->lasti + && beginfile_block->nexti == beginfile_block->lasti && endfile_block->nexti == endfile_block->lasti ) { /* no pattern-action and (real) end, beginfile or endfile blocks */ @@ -4816,7 +4816,7 @@ mk_program() cp = list_merge(begin_block, end_block); if (program_comment != NULL) { (void) list_prepend(cp, program_comment); - } + } if (comment != NULL) (void) list_append(cp, comment); (void) list_append(cp, ip_atexit); @@ -4841,7 +4841,7 @@ mk_program() (void) list_prepend(prog_block, ip_rec); (void) list_append(prog_block, instruction(Op_jmp)); prog_block->lasti->target_jmp = ip_rec; - + list_append(beginfile_block, instruction(Op_after_beginfile)); cp = list_merge(beginfile_block, prog_block); @@ -4853,10 +4853,10 @@ mk_program() if (program_comment != NULL) { (void) list_prepend(cp, program_comment); - } + } if (comment != NULL) { (void) list_append(cp, comment); - } + } (void) list_append(cp, ip_atexit); (void) list_append(cp, instruction(Op_stop)); @@ -4874,7 +4874,7 @@ out: #undef end_block #undef prog_block #undef beginfile_block -#undef endfile_block +#undef endfile_block } /* parse_program --- read in the program and convert into a list of instructions */ @@ -5025,7 +5025,7 @@ add_srcfile(enum srctype stype, char *src, SRCFILE *thisfile, bool *already_incl *already_included = true; return NULL; } else { - /* duplicates are allowed for -f */ + /* duplicates are allowed for -f */ if (s->stype == SRC_INC) fatal(_("can't include `%s' and use it as a program file"), src); /* no need to scan for further matches, since @@ -5076,11 +5076,11 @@ include_source(INSTRUCTION *file) sourcefile->srclines = sourceline; sourcefile->lexptr = lexptr; sourcefile->lexend = lexend; - sourcefile->lexptr_begin = lexptr_begin; + sourcefile->lexptr_begin = lexptr_begin; sourcefile->lexeme = lexeme; sourcefile->lasttok = lasttok; - /* included file becomes the current source */ + /* included file becomes the current source */ sourcefile = s; lexptr = NULL; sourceline = 0; @@ -5387,7 +5387,7 @@ tokexpand() { static int toksize; int tokoffset; - + if (tokstart != NULL) { tokoffset = tok - tokstart; toksize *= 2; @@ -5455,7 +5455,7 @@ again: int idx, work_ring_idx = cur_ring_idx; mbstate_t tmp_state; size_t mbclen; - + for (idx = 0; lexptr + idx < lexend; idx++) { tmp_state = cur_mbstate; mbclen = mbrlen(lexptr, idx + 1, &tmp_state); @@ -5521,7 +5521,7 @@ check_comment(void) if (comment != NULL) { if (first_rule) { program_comment = comment; - } else + } else block_comment = comment; comment = NULL; } @@ -5722,7 +5722,7 @@ yylex(void) lasttok = 0; return SUBSCRIPT; } - + if (lasttok == LEX_EOF) /* error earlier in current source, must give up !! */ return 0; @@ -5757,7 +5757,7 @@ yylex(void) * * [..[..] []] [^]] [.../...] * [...\[...] [...\]...] [...\/...] - * + * * (Remember that all of the above are inside /.../) * * The code for \ handles \[, \] and \/. @@ -5786,7 +5786,7 @@ yylex(void) break; case ']': if (in_brack > 0 - && (cur_index == b_index + 1 + && (cur_index == b_index + 1 || (cur_index == b_index + 2 && tok[-1] == '^'))) ; /* do nothing */ else { @@ -5954,7 +5954,7 @@ retry: in_parens--; return lasttok = c; - case '(': + case '(': in_parens++; return lasttok = c; case '$': @@ -6057,7 +6057,7 @@ retry: did_warn_op = true; warning(_("operator `^' is not supported in old awk")); } - yylval = GET_INSTRUCTION(Op_exp); + yylval = GET_INSTRUCTION(Op_exp); return lasttok = '^'; } @@ -6180,7 +6180,7 @@ retry: yylval->lextok = estrdup(tokstart, tok - tokstart); return lasttok = FILENAME; } - + yylval->opcode = Op_push_i; yylval->memory = make_str_node(tokstart, tok - tokstart, esc_seen ? SCAN : 0); @@ -6512,7 +6512,7 @@ retry: case LEX_BEGIN: case LEX_END: case LEX_BEGINFILE: - case LEX_ENDFILE: + case LEX_ENDFILE: yylval = bcalloc(tokentab[mid].value, 3, sourceline); break; @@ -6561,7 +6561,7 @@ out: tokkey = estrdup(tokstart, tok - tokstart); if (*lexptr == '(') { yylval = bcalloc(Op_token, 2, sourceline); - yylval->lextok = tokkey; + yylval->lextok = tokkey; return lasttok = FUNC_CALL; } else { static bool goto_warned = false; @@ -6637,7 +6637,7 @@ snode(INSTRUCTION *subn, INSTRUCTION *r) nexp++; } assert(nexp > 0); - } + } /* check against how many args. are allowed for this builtin */ args_allowed = tokentab[idx].flags & ARGS; @@ -6708,7 +6708,7 @@ snode(INSTRUCTION *subn, INSTRUCTION *r) subn->lasti->assign_ctxt = Op_sub_builtin; } - return subn; + return subn; } else { /* gensub */ @@ -6737,16 +6737,16 @@ snode(INSTRUCTION *subn, INSTRUCTION *r) /* special case processing for a few builtins */ if (r->builtin == do_length) { - if (nexp == 0) { + if (nexp == 0) { /* no args. Use $0 */ INSTRUCTION *list; - r->expr_count = 1; + r->expr_count = 1; list = list_create(r); (void) list_prepend(list, instruction(Op_field_spec)); (void) list_prepend(list, instruction(Op_push_i)); list->nexti->memory = make_profile_number(0.0, "0", 1); - return list; + return list; } else { arg = subn->nexti; if (arg->nexti == arg->lasti && arg->nexti->opcode == Op_push) @@ -7087,7 +7087,7 @@ mk_function(INSTRUCTION *fi, INSTRUCTION *def) return fi; } -/* +/* * install_function: * install function name in the symbol table. * Extra work, build up and install a list of the parameter names. @@ -7111,7 +7111,7 @@ install_function(char *fname, INSTRUCTION *fi, INSTRUCTION *plist) fi->func_body = f; f->param_cnt = pcount; f->code_ptr = fi; - f->fparms = NULL; + f->fparms = NULL; if (pcount > 0) { char **pnames; pnames = check_params(fname, pcount, plist); /* frees plist */ @@ -7168,7 +7168,7 @@ check_params(char *fname, int pcount, INSTRUCTION *list) } bcfree(list); - return pnames; + return pnames; } @@ -7176,7 +7176,7 @@ check_params(char *fname, int pcount, INSTRUCTION *list) undef HASHSIZE #endif #define HASHSIZE 1021 - + static struct fdesc { char *name; short used; @@ -7238,7 +7238,7 @@ check_funcs() if (! in_main_context()) goto free_mem; - + for (i = 0; i < HASHSIZE; i++) { for (fp = ftable[i]; fp != NULL; fp = fp->next) { #ifdef REALLYMEAN @@ -7578,7 +7578,7 @@ mk_binary(INSTRUCTION *s1, INSTRUCTION *s2, INSTRUCTION *op) break; default: goto regular; - } + } op->memory = ip2->memory; bcfree(ip2); @@ -7594,7 +7594,7 @@ regular: } /* mk_boolean --- instructions for boolean and, or */ - + static INSTRUCTION * mk_boolean(INSTRUCTION *left, INSTRUCTION *right, INSTRUCTION *op) { @@ -7622,7 +7622,7 @@ mk_boolean(INSTRUCTION *left, INSTRUCTION *right, INSTRUCTION *op) right->lasti->target_stmt = left->lasti; } else { /* optimization for x || y || z || ... */ INSTRUCTION *ip; - + op->opcode = final_opc; (void) list_append(right, op); op->target_stmt = tp; @@ -7659,7 +7659,7 @@ mk_condition(INSTRUCTION *cond, INSTRUCTION *ifp, INSTRUCTION *true_branch, * * ---------------- * [Op_jmp y] - * ---------------- + * ---------------- * f: * false_branch * ---------------- @@ -7821,7 +7821,7 @@ append_rule(INSTRUCTION *pattern, INSTRUCTION *action) rule_block[rule] = ip; else (void) list_merge(rule_block[rule], ip); - + return rule_block[rule]; } @@ -7843,7 +7843,7 @@ mk_assignment(INSTRUCTION *lhs, INSTRUCTION *rhs, INSTRUCTION *op) break; case Op_push: case Op_push_array: - tp->opcode = Op_push_lhs; + tp->opcode = Op_push_lhs; break; case Op_field_assign: yyerror(_("cannot assign a value to the result of a field post-increment expression")); @@ -7898,7 +7898,7 @@ optimize_assignment(INSTRUCTION *exp) * Replaces Op_push_array + Op_subscript_lhs + Op_assign + Op_pop * with single instruction Op_store_sub. * Limitation: 1 dimension and sub is simple var/value. - * + * * 2) Simple variable assignment var = x: * Replaces Op_push_lhs + Op_assign + Op_pop with Op_store_var. * @@ -7922,7 +7922,7 @@ optimize_assignment(INSTRUCTION *exp) i1 = exp->lasti; if ( i1->opcode != Op_assign - && i1->opcode != Op_field_assign) + && i1->opcode != Op_field_assign) return list_append(exp, instruction(Op_pop)); for (i2 = exp->nexti; i2 != i1; i2 = i2->nexti) { @@ -7997,7 +7997,7 @@ optimize_assignment(INSTRUCTION *exp) * so use expr_count instead. */ i3->nexti = NULL; - i2->opcode = Op_no_op; + i2->opcode = Op_no_op; bcfree(i1); /* Op_assign */ exp->lasti = i3; /* update Op_list */ return exp; @@ -8020,7 +8020,7 @@ optimize_assignment(INSTRUCTION *exp) && (i3->memory->flags & INTLSTR) == 0 && i3->nexti == i2 ) { - /* constant initializer */ + /* constant initializer */ i2->initval = i3->memory; bcfree(i3); exp->nexti = i2; @@ -8056,7 +8056,7 @@ mk_getline(INSTRUCTION *op, INSTRUCTION *var, INSTRUCTION *redir, int redirtype) * [ file (simp_exp)] * [ [ var ] ] * [ Op_K_getline_redir|NULL|redir_type|into_var] - * [ [var_assign] ] + * [ [var_assign] ] * */ @@ -8065,7 +8065,7 @@ mk_getline(INSTRUCTION *op, INSTRUCTION *var, INSTRUCTION *redir, int redirtype) bcfree(op); op = bcalloc(Op_K_getline, 2, sline); (op + 1)->target_endfile = ip_endfile; - (op + 1)->target_beginfile = ip_beginfile; + (op + 1)->target_beginfile = ip_beginfile; } if (var != NULL) { @@ -8123,11 +8123,11 @@ mk_for_loop(INSTRUCTION *forp, INSTRUCTION *init, INSTRUCTION *cond, * ------------------------ * body (may be NULL) * ------------------------ - * tc: + * tc: * incr (may be NULL) - * [ Op_jmp x ] + * [ Op_jmp x ] * ------------------------ - * tb:[ Op_no_op ] + * tb:[ Op_no_op ] */ INSTRUCTION *ip, *tbreak, *tcont; @@ -8239,7 +8239,7 @@ mk_expression_list(INSTRUCTION *list, INSTRUCTION *s1) /* we can't just combine all bytecodes, since we need to * process individual expressions for a few builtins in snode() (-: */ - + /* -- list of lists */ /* [Op_list| ... ]------ * | @@ -8295,7 +8295,7 @@ count_expressions(INSTRUCTION **list, bool isarg) (void) list_merge(r, expr); expr = t2->nexti; } - + assert(count > 0); if (! isarg && count > max_args) max_args = count; @@ -8561,7 +8561,7 @@ install_builtins(void) * The scene of the murder was grisly to look upon. When the inspector * arrived, the sergeant turned to him and said, "Another programmer stabbed * in the back. He never knew what happened." - * + * * The inspector replied, "Looks like the MO of isalpha, and his even meaner * big brother, isalnum. The Locale brothers." The sergeant merely * shuddered in horror. @@ -2,7 +2,7 @@ * awkgram.y --- yacc/bison parser */ -/* +/* * Copyright (C) 1986, 1988, 1989, 1991-2016 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the @@ -40,7 +40,7 @@ static void lintwarn_ln(int line, const char *m, ...) ATTRIBUTE_PRINTF_2; static void warning_ln(int line, const char *m, ...) ATTRIBUTE_PRINTF_2; static char *get_src_buf(void); static int yylex(void); -int yyparse(void); +int yyparse(void); static INSTRUCTION *snode(INSTRUCTION *subn, INSTRUCTION *op); static char **check_params(char *fname, int pcount, INSTRUCTION *list); static int install_function(char *fname, INSTRUCTION *fi, INSTRUCTION *plist); @@ -115,7 +115,7 @@ static char *lexptr; /* pointer to next char during parsing */ static char *lexend; /* end of buffer */ static char *lexptr_begin; /* keep track of where we were for error msgs */ static char *lexeme; /* beginning of lexeme for debugging */ -static bool lexeof; /* seen EOF for current source? */ +static bool lexeof; /* seen EOF for current source? */ static char *thisline = NULL; static int in_braces = 0; /* count braces for firstline, lastline in an 'action' */ static int lastline = 0; @@ -181,7 +181,7 @@ extern double fmod(double x, double y); %token LEX_BEGIN LEX_END LEX_IF LEX_ELSE LEX_RETURN LEX_DELETE %token LEX_SWITCH LEX_CASE LEX_DEFAULT LEX_WHILE LEX_DO LEX_FOR LEX_BREAK LEX_CONTINUE %token LEX_PRINT LEX_PRINTF LEX_NEXT LEX_EXIT LEX_FUNCTION -%token LEX_BEGINFILE LEX_ENDFILE +%token LEX_BEGINFILE LEX_ENDFILE %token LEX_GETLINE LEX_NEXTFILE %token LEX_IN %token LEX_AND LEX_OR INCREMENT DECREMENT @@ -322,7 +322,7 @@ pattern } else $$ = $1; } - + | exp ',' opt_nls exp { INSTRUCTION *tp; @@ -433,7 +433,7 @@ lex_builtin : LEX_BUILTIN | LEX_LENGTH ; - + function_prologue : LEX_FUNCTION func_name '(' { want_param_names = FUNC_HEADER; } opt_param_list r_paren opt_nls { @@ -608,7 +608,7 @@ statement int case_count = 0; int i; - tbreak = instruction(Op_no_op); + tbreak = instruction(Op_no_op); cstmt = list_create(tbreak); cexp = list_create(instruction(Op_pop)); dflt = instruction(Op_jmp); @@ -635,7 +635,7 @@ statement error_ln(curr->source_line, _("duplicate case values in switch body: %s"), caseval); } - + if (case_values == NULL) emalloc(case_values, const char **, sizeof(char *) * maxcount, "statement"); else if (case_count >= maxcount) { @@ -686,18 +686,18 @@ statement (void) list_merge(ip, cexp); $$ = list_merge(ip, cstmt); - break_allowed--; + break_allowed--; fix_break_continue(ip, tbreak, NULL); } | LEX_WHILE '(' exp r_paren opt_nls statement - { + { /* * ----------------- * tc: * cond * ----------------- * [Op_jmp_false tb ] - * ----------------- + * ----------------- * body * ----------------- * [Op_jmp tc ] @@ -738,7 +738,7 @@ statement * z: * body * ----------------- - * tc: + * tc: * cond * ----------------- * [Op_jmp_true | z ] @@ -785,7 +785,7 @@ statement && ($8->nexti->memory->type != Node_var || !($8->nexti->memory->var_update)) && strcmp($8->nexti->memory->vname, var_name) == 0 ) { - + /* Efficiency hack. Recognize the special case of * * for (iggy in foo) @@ -797,10 +797,10 @@ statement * * Check that the body is a `delete a[i]' statement, * and that both the loop var and array names match. - */ + */ NODE *arr = NULL; - ip = $8->nexti->nexti; + ip = $8->nexti->nexti; if ($5->nexti->opcode == Op_push && $5->lasti == $5->nexti) arr = $5->nexti->memory; if (arr != NULL @@ -826,7 +826,7 @@ statement /* [ Op_push_array a ] * [ Op_arrayfor_init | ib ] - * ic:[ Op_arrayfor_incr | ib ] + * ic:[ Op_arrayfor_incr | ib ] * [ Op_var_assign if any ] * * body @@ -855,7 +855,7 @@ regular_loop: } /* else $1 is NULL */ - /* add update_FOO instruction if necessary */ + /* add update_FOO instruction if necessary */ if ($4->array_var->type == Node_var && $4->array_var->var_update) { (void) list_append(ip, instruction(Op_var_update)); ip->lasti->update_var = $4->array_var->var_update; @@ -871,7 +871,7 @@ regular_loop: if (do_pretty_print) { (void) list_append(ip, instruction(Op_exec_count)); ($1 + 1)->forloop_cond = $4; - ($1 + 1)->forloop_body = ip->lasti; + ($1 + 1)->forloop_body = ip->lasti; } if ($8 != NULL) @@ -881,7 +881,7 @@ regular_loop: ip->lasti->target_jmp = $4; $$ = list_append(ip, tbreak); fix_break_continue(ip, tbreak, tcont); - } + } break_allowed--; continue_allowed--; @@ -912,7 +912,7 @@ regular_loop: non_compound_stmt : LEX_BREAK statement_term - { + { if (! break_allowed) error_ln($1->source_line, _("`break' is not allowed outside a loop or switch")); @@ -956,7 +956,7 @@ non_compound_stmt | LEX_EXIT opt_exp statement_term { /* Initialize the two possible jump targets, the actual target - * is resolved at run-time. + * is resolved at run-time. */ $1->target_end = ip_end; /* first instruction in end_block */ $1->target_atexit = ip_atexit; /* cleanup and go home */ @@ -1074,7 +1074,7 @@ simple_stmt * [$1 | NULL | redir_type | expr_count] * */ -regular_print: +regular_print: if ($4 == NULL) { /* no redirection */ if ($3 == NULL) { /* printf without arg */ $1->expr_count = 0; @@ -1138,7 +1138,7 @@ regular_print: $$ = list_append(list_append($4, $2), $1); } $$ = add_pending_comment($$); - } + } | LEX_DELETE '(' NAME ')' /* * this is for tawk compatibility. maybe the warnings @@ -1203,7 +1203,7 @@ case_statement { INSTRUCTION *casestmt = $5; if ($5 == NULL) - casestmt = list_create(instruction(Op_no_op)); + casestmt = list_create(instruction(Op_no_op)); if (do_pretty_print) (void) list_prepend(casestmt, instruction(Op_exec_count)); $1->case_exp = $2; @@ -1228,7 +1228,7 @@ case_value : YNUMBER { $$ = $1; } | '-' YNUMBER %prec UNARY - { + { NODE *n = $2->memory; (void) force_number(n); negate_num(n); @@ -1242,9 +1242,9 @@ case_value add_sign_to_num(n, '+'); $$ = $2; } - | YSTRING + | YSTRING { $$ = $1; } - | regexp + | regexp { if ($1->memory->type == Node_regex) $1->opcode = Op_push_re; @@ -1497,7 +1497,7 @@ assign_operator | ASSIGNOP { $$ = $1; } | SLASH_BEFORE_EQUAL ASSIGN /* `/=' */ - { + { $2->opcode = Op_assign_quotient; $$ = $2; } @@ -1752,7 +1752,7 @@ non_post_simp_exp ) { NODE *n = $2->lasti->memory; (void) force_number(n); - negate_num(n); + negate_num(n); $$ = $2; bcfree($1); } else { @@ -1801,7 +1801,7 @@ func_call warned = true; lintwarn("%s", msg); } - + f = $2->lasti; f->opcode = Op_indirect_func_call; name = estrdup(f->func_name, strlen(f->func_name)); @@ -1844,7 +1844,7 @@ direct_func_call $$ = list_create($1); } else { INSTRUCTION *t = $3; - ($1 + 1)->expr_count = count_expressions(&t, true); + ($1 + 1)->expr_count = count_expressions(&t, true); $$ = list_append(t, $1); } } @@ -1876,7 +1876,7 @@ delete_subscript delete_exp_list : bracketed_exp_list { - INSTRUCTION *ip = $1->lasti; + INSTRUCTION *ip = $1->lasti; int count = ip->sub_count; /* # of SUBSEP-seperated expressions */ if (count > 1) { /* change Op_subscript or Op_sub_array to Op_concat */ @@ -1900,7 +1900,7 @@ bracketed_exp_list /* install Null string as subscript. */ t = list_create(instruction(Op_push_i)); t->nexti->memory = dupnode(Nnull_string); - $3->sub_count = 1; + $3->sub_count = 1; } else $3->sub_count = count_expressions(&t, false); $$ = list_append(t, $3); @@ -2016,7 +2016,7 @@ struct token { # define BREAK 0x0800 /* break allowed inside */ # define CONTINUE 0x1000 /* continue allowed inside */ # define DEBUG_USE 0x2000 /* for use by developers */ - + NODE *(*ptr)(int); /* function that implements this keyword */ NODE *(*ptr2)(int); /* alternate arbitrary-precision function */ }; @@ -2148,7 +2148,7 @@ getfname(NODE *(*fptr)(int)) j = sizeof(tokentab) / sizeof(tokentab[0]); /* linear search, no other way to do it */ - for (i = 0; i < j; i++) + for (i = 0; i < j; i++) if (tokentab[i].ptr == fptr || tokentab[i].ptr2 == fptr) return tokentab[i].operator; @@ -2221,7 +2221,7 @@ print_included_from() int saveline, line; SRCFILE *s; - /* suppress current file name, line # from `.. included from ..' msgs */ + /* suppress current file name, line # from `.. included from ..' msgs */ saveline = sourceline; sourceline = 0; @@ -2422,7 +2422,7 @@ mk_program() if (prog_block == NULL) { if (end_block->nexti == end_block->lasti - && beginfile_block->nexti == beginfile_block->lasti + && beginfile_block->nexti == beginfile_block->lasti && endfile_block->nexti == endfile_block->lasti ) { /* no pattern-action and (real) end, beginfile or endfile blocks */ @@ -2439,7 +2439,7 @@ mk_program() cp = list_merge(begin_block, end_block); if (program_comment != NULL) { (void) list_prepend(cp, program_comment); - } + } if (comment != NULL) (void) list_append(cp, comment); (void) list_append(cp, ip_atexit); @@ -2464,7 +2464,7 @@ mk_program() (void) list_prepend(prog_block, ip_rec); (void) list_append(prog_block, instruction(Op_jmp)); prog_block->lasti->target_jmp = ip_rec; - + list_append(beginfile_block, instruction(Op_after_beginfile)); cp = list_merge(beginfile_block, prog_block); @@ -2476,10 +2476,10 @@ mk_program() if (program_comment != NULL) { (void) list_prepend(cp, program_comment); - } + } if (comment != NULL) { (void) list_append(cp, comment); - } + } (void) list_append(cp, ip_atexit); (void) list_append(cp, instruction(Op_stop)); @@ -2497,7 +2497,7 @@ out: #undef end_block #undef prog_block #undef beginfile_block -#undef endfile_block +#undef endfile_block } /* parse_program --- read in the program and convert into a list of instructions */ @@ -2648,7 +2648,7 @@ add_srcfile(enum srctype stype, char *src, SRCFILE *thisfile, bool *already_incl *already_included = true; return NULL; } else { - /* duplicates are allowed for -f */ + /* duplicates are allowed for -f */ if (s->stype == SRC_INC) fatal(_("can't include `%s' and use it as a program file"), src); /* no need to scan for further matches, since @@ -2699,11 +2699,11 @@ include_source(INSTRUCTION *file) sourcefile->srclines = sourceline; sourcefile->lexptr = lexptr; sourcefile->lexend = lexend; - sourcefile->lexptr_begin = lexptr_begin; + sourcefile->lexptr_begin = lexptr_begin; sourcefile->lexeme = lexeme; sourcefile->lasttok = lasttok; - /* included file becomes the current source */ + /* included file becomes the current source */ sourcefile = s; lexptr = NULL; sourceline = 0; @@ -3010,7 +3010,7 @@ tokexpand() { static int toksize; int tokoffset; - + if (tokstart != NULL) { tokoffset = tok - tokstart; toksize *= 2; @@ -3078,7 +3078,7 @@ again: int idx, work_ring_idx = cur_ring_idx; mbstate_t tmp_state; size_t mbclen; - + for (idx = 0; lexptr + idx < lexend; idx++) { tmp_state = cur_mbstate; mbclen = mbrlen(lexptr, idx + 1, &tmp_state); @@ -3144,7 +3144,7 @@ check_comment(void) if (comment != NULL) { if (first_rule) { program_comment = comment; - } else + } else block_comment = comment; comment = NULL; } @@ -3345,7 +3345,7 @@ yylex(void) lasttok = 0; return SUBSCRIPT; } - + if (lasttok == LEX_EOF) /* error earlier in current source, must give up !! */ return 0; @@ -3380,7 +3380,7 @@ yylex(void) * * [..[..] []] [^]] [.../...] * [...\[...] [...\]...] [...\/...] - * + * * (Remember that all of the above are inside /.../) * * The code for \ handles \[, \] and \/. @@ -3409,7 +3409,7 @@ yylex(void) break; case ']': if (in_brack > 0 - && (cur_index == b_index + 1 + && (cur_index == b_index + 1 || (cur_index == b_index + 2 && tok[-1] == '^'))) ; /* do nothing */ else { @@ -3577,7 +3577,7 @@ retry: in_parens--; return lasttok = c; - case '(': + case '(': in_parens++; return lasttok = c; case '$': @@ -3680,7 +3680,7 @@ retry: did_warn_op = true; warning(_("operator `^' is not supported in old awk")); } - yylval = GET_INSTRUCTION(Op_exp); + yylval = GET_INSTRUCTION(Op_exp); return lasttok = '^'; } @@ -3803,7 +3803,7 @@ retry: yylval->lextok = estrdup(tokstart, tok - tokstart); return lasttok = FILENAME; } - + yylval->opcode = Op_push_i; yylval->memory = make_str_node(tokstart, tok - tokstart, esc_seen ? SCAN : 0); @@ -4135,7 +4135,7 @@ retry: case LEX_BEGIN: case LEX_END: case LEX_BEGINFILE: - case LEX_ENDFILE: + case LEX_ENDFILE: yylval = bcalloc(tokentab[mid].value, 3, sourceline); break; @@ -4184,7 +4184,7 @@ out: tokkey = estrdup(tokstart, tok - tokstart); if (*lexptr == '(') { yylval = bcalloc(Op_token, 2, sourceline); - yylval->lextok = tokkey; + yylval->lextok = tokkey; return lasttok = FUNC_CALL; } else { static bool goto_warned = false; @@ -4260,7 +4260,7 @@ snode(INSTRUCTION *subn, INSTRUCTION *r) nexp++; } assert(nexp > 0); - } + } /* check against how many args. are allowed for this builtin */ args_allowed = tokentab[idx].flags & ARGS; @@ -4331,7 +4331,7 @@ snode(INSTRUCTION *subn, INSTRUCTION *r) subn->lasti->assign_ctxt = Op_sub_builtin; } - return subn; + return subn; } else { /* gensub */ @@ -4360,16 +4360,16 @@ snode(INSTRUCTION *subn, INSTRUCTION *r) /* special case processing for a few builtins */ if (r->builtin == do_length) { - if (nexp == 0) { + if (nexp == 0) { /* no args. Use $0 */ INSTRUCTION *list; - r->expr_count = 1; + r->expr_count = 1; list = list_create(r); (void) list_prepend(list, instruction(Op_field_spec)); (void) list_prepend(list, instruction(Op_push_i)); list->nexti->memory = make_profile_number(0.0, "0", 1); - return list; + return list; } else { arg = subn->nexti; if (arg->nexti == arg->lasti && arg->nexti->opcode == Op_push) @@ -4710,7 +4710,7 @@ mk_function(INSTRUCTION *fi, INSTRUCTION *def) return fi; } -/* +/* * install_function: * install function name in the symbol table. * Extra work, build up and install a list of the parameter names. @@ -4734,7 +4734,7 @@ install_function(char *fname, INSTRUCTION *fi, INSTRUCTION *plist) fi->func_body = f; f->param_cnt = pcount; f->code_ptr = fi; - f->fparms = NULL; + f->fparms = NULL; if (pcount > 0) { char **pnames; pnames = check_params(fname, pcount, plist); /* frees plist */ @@ -4791,7 +4791,7 @@ check_params(char *fname, int pcount, INSTRUCTION *list) } bcfree(list); - return pnames; + return pnames; } @@ -4799,7 +4799,7 @@ check_params(char *fname, int pcount, INSTRUCTION *list) undef HASHSIZE #endif #define HASHSIZE 1021 - + static struct fdesc { char *name; short used; @@ -4861,7 +4861,7 @@ check_funcs() if (! in_main_context()) goto free_mem; - + for (i = 0; i < HASHSIZE; i++) { for (fp = ftable[i]; fp != NULL; fp = fp->next) { #ifdef REALLYMEAN @@ -5201,7 +5201,7 @@ mk_binary(INSTRUCTION *s1, INSTRUCTION *s2, INSTRUCTION *op) break; default: goto regular; - } + } op->memory = ip2->memory; bcfree(ip2); @@ -5217,7 +5217,7 @@ regular: } /* mk_boolean --- instructions for boolean and, or */ - + static INSTRUCTION * mk_boolean(INSTRUCTION *left, INSTRUCTION *right, INSTRUCTION *op) { @@ -5245,7 +5245,7 @@ mk_boolean(INSTRUCTION *left, INSTRUCTION *right, INSTRUCTION *op) right->lasti->target_stmt = left->lasti; } else { /* optimization for x || y || z || ... */ INSTRUCTION *ip; - + op->opcode = final_opc; (void) list_append(right, op); op->target_stmt = tp; @@ -5282,7 +5282,7 @@ mk_condition(INSTRUCTION *cond, INSTRUCTION *ifp, INSTRUCTION *true_branch, * * ---------------- * [Op_jmp y] - * ---------------- + * ---------------- * f: * false_branch * ---------------- @@ -5444,7 +5444,7 @@ append_rule(INSTRUCTION *pattern, INSTRUCTION *action) rule_block[rule] = ip; else (void) list_merge(rule_block[rule], ip); - + return rule_block[rule]; } @@ -5466,7 +5466,7 @@ mk_assignment(INSTRUCTION *lhs, INSTRUCTION *rhs, INSTRUCTION *op) break; case Op_push: case Op_push_array: - tp->opcode = Op_push_lhs; + tp->opcode = Op_push_lhs; break; case Op_field_assign: yyerror(_("cannot assign a value to the result of a field post-increment expression")); @@ -5521,7 +5521,7 @@ optimize_assignment(INSTRUCTION *exp) * Replaces Op_push_array + Op_subscript_lhs + Op_assign + Op_pop * with single instruction Op_store_sub. * Limitation: 1 dimension and sub is simple var/value. - * + * * 2) Simple variable assignment var = x: * Replaces Op_push_lhs + Op_assign + Op_pop with Op_store_var. * @@ -5545,7 +5545,7 @@ optimize_assignment(INSTRUCTION *exp) i1 = exp->lasti; if ( i1->opcode != Op_assign - && i1->opcode != Op_field_assign) + && i1->opcode != Op_field_assign) return list_append(exp, instruction(Op_pop)); for (i2 = exp->nexti; i2 != i1; i2 = i2->nexti) { @@ -5620,7 +5620,7 @@ optimize_assignment(INSTRUCTION *exp) * so use expr_count instead. */ i3->nexti = NULL; - i2->opcode = Op_no_op; + i2->opcode = Op_no_op; bcfree(i1); /* Op_assign */ exp->lasti = i3; /* update Op_list */ return exp; @@ -5643,7 +5643,7 @@ optimize_assignment(INSTRUCTION *exp) && (i3->memory->flags & INTLSTR) == 0 && i3->nexti == i2 ) { - /* constant initializer */ + /* constant initializer */ i2->initval = i3->memory; bcfree(i3); exp->nexti = i2; @@ -5679,7 +5679,7 @@ mk_getline(INSTRUCTION *op, INSTRUCTION *var, INSTRUCTION *redir, int redirtype) * [ file (simp_exp)] * [ [ var ] ] * [ Op_K_getline_redir|NULL|redir_type|into_var] - * [ [var_assign] ] + * [ [var_assign] ] * */ @@ -5688,7 +5688,7 @@ mk_getline(INSTRUCTION *op, INSTRUCTION *var, INSTRUCTION *redir, int redirtype) bcfree(op); op = bcalloc(Op_K_getline, 2, sline); (op + 1)->target_endfile = ip_endfile; - (op + 1)->target_beginfile = ip_beginfile; + (op + 1)->target_beginfile = ip_beginfile; } if (var != NULL) { @@ -5746,11 +5746,11 @@ mk_for_loop(INSTRUCTION *forp, INSTRUCTION *init, INSTRUCTION *cond, * ------------------------ * body (may be NULL) * ------------------------ - * tc: + * tc: * incr (may be NULL) - * [ Op_jmp x ] + * [ Op_jmp x ] * ------------------------ - * tb:[ Op_no_op ] + * tb:[ Op_no_op ] */ INSTRUCTION *ip, *tbreak, *tcont; @@ -5862,7 +5862,7 @@ mk_expression_list(INSTRUCTION *list, INSTRUCTION *s1) /* we can't just combine all bytecodes, since we need to * process individual expressions for a few builtins in snode() (-: */ - + /* -- list of lists */ /* [Op_list| ... ]------ * | @@ -5918,7 +5918,7 @@ count_expressions(INSTRUCTION **list, bool isarg) (void) list_merge(r, expr); expr = t2->nexti; } - + assert(count > 0); if (! isarg && count > max_args) max_args = count; @@ -6184,7 +6184,7 @@ install_builtins(void) * The scene of the murder was grisly to look upon. When the inspector * arrived, the sergeant turned to him and said, "Another programmer stabbed * in the back. He never knew what happened." - * + * * The inspector replied, "Looks like the MO of isalpha, and his even meaner * big brother, isalnum. The Locale brothers." The sergeant merely * shuddered in horror. diff --git a/awklib/eg/lib/grcat.c b/awklib/eg/lib/grcat.c index cf39083c..30e81cca 100644 --- a/awklib/eg/lib/grcat.c +++ b/awklib/eg/lib/grcat.c @@ -9,7 +9,6 @@ * December 2010, move to ANSI C definition for main(). */ -/* For OS/2, do nothing. */ #if HAVE_CONFIG_H #include <config.h> #endif @@ -2,22 +2,22 @@ * builtin.c - Builtin functions and various utility procedures. */ -/* +/* * Copyright (C) 1986, 1988, 1989, 1991-2016 the Free Software Foundation, Inc. - * + * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. - * + * * GAWK is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. - * + * * GAWK is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA @@ -193,9 +193,9 @@ do_fflush(int nargs) /* * November, 2012. - * It turns out that circa 2002, when BWK + * It turns out that circa 2002, when BWK * added fflush() and fflush("") to his awk, he made both of - * them flush everything. + * them flush everything. * * Now, with our inside agent getting ready to try to get fflush() * standardized in POSIX, we are going to make our awk consistent @@ -386,7 +386,7 @@ do_index(int nargs) * If we don't have valid wide character strings, use * the real bytes. */ - do_single_byte = ((s1->wstlen == 0 && s1->stlen > 0) + do_single_byte = ((s1->wstlen == 0 && s1->stlen > 0) || (s2->wstlen == 0 && s2->stlen > 0)); } @@ -521,7 +521,7 @@ do_length(int nargs) /* * Support for deferred loading of array elements requires that - * we use the array length interface even though it isn't + * we use the array length interface even though it isn't * necessary for the built-in array types. * * 1/2015: The deferred arrays are gone, but this is probably @@ -962,7 +962,7 @@ check_pos: case ' ': /* print ' ' or '-' */ /* 'space' flag is ignored */ /* if '+' already present */ - if (signchar != false) + if (signchar != false) goto check_pos; /* FALL THROUGH */ case '+': /* print '+' or '-' */ @@ -988,18 +988,18 @@ check_pos: alt = true; goto check_pos; case '\'': -#if defined(HAVE_LOCALE_H) +#if defined(HAVE_LOCALE_H) quote_flag = true; goto check_pos; #else - goto retry; + goto retry; #endif case 'l': if (big_flag) break; else { static bool warned = false; - + if (do_lint && ! warned) { lintwarn(_("`l' is meaningless in awk formats; ignored")); warned = true; @@ -1016,7 +1016,7 @@ check_pos: break; else { static bool warned = false; - + if (do_lint && ! warned) { lintwarn(_("`L' is meaningless in awk formats; ignored")); warned = true; @@ -1033,7 +1033,7 @@ check_pos: break; else { static bool warned = false; - + if (do_lint && ! warned) { lintwarn(_("`h' is meaningless in awk formats; ignored")); warned = true; @@ -1219,7 +1219,7 @@ out0: jj = 0; /* keep using current val in loc.grouping[ii] */ else if (loc.grouping[ii+1] == CHAR_MAX) quote_flag = false; - else { + else { ii++; jj = 0; } @@ -1334,7 +1334,7 @@ mpf1: zero_flag = (! lj && ((zero_flag && ! have_prec) || (fw == 0 && have_prec))); - + (void) mpfr_get_z(mpzval, mf, MPFR_RNDZ); /* convert to GMP integer */ fmt_type = have_prec ? MP_INT_WITH_PREC : MP_INT_WITHOUT_PREC; zi = mpzval; @@ -1399,11 +1399,11 @@ mpf1: PREPEND(ts[k]); } } - if (loc.grouping[ii+1] == 0) + if (loc.grouping[ii+1] == 0) jj = 0; /* keep using current val in loc.grouping[ii] */ - else if (loc.grouping[ii+1] == CHAR_MAX) + else if (loc.grouping[ii+1] == CHAR_MAX) quote_flag = false; - else { + else { ii++; jj = 0; } @@ -1964,7 +1964,7 @@ do_strftime(int nargs) tmp = POP_SCALAR(); if (do_lint && (fixtype(tmp)->flags & STRING) == 0) lintwarn(_("strftime: received non-string first argument")); - + t1 = force_string(tmp); format = t1->stptr; formatlen = t1->stlen; @@ -2224,7 +2224,7 @@ do_print(int nargs, int redirtype) /* do_print_rec --- special case printing of $0, for speed */ -void +void do_print_rec(int nargs, int redirtype) { FILE *fp = NULL; @@ -2493,11 +2493,11 @@ do_rand(int nargs ATTRIBUTE_UNUSED) * that when the values of successive values are combined * like (rand1*rand2)^2, (rand3*rand4)^2, ... the * resulting time series is not white noise. The - * following also seems to fix that bug. + * following also seems to fix that bug. * * The add/subtract 0.5 keeps small bits from filling * below 2^-53 in the double, not that anyone should be - * looking down there. + * looking down there. * * Date: Wed, 25 Sep 2013 10:45:38 -0600 (MDT) * From: "Nelson H. F. Beebe" <beebe@math.utah.edu> @@ -2505,32 +2505,32 @@ do_rand(int nargs ATTRIBUTE_UNUSED) * from integer to floating-point, and I discuss the serious pitfalls * in my book, because it leads to platform-dependent behavior at the * end points of the interval [0,1] - * + * * (5) the documentation in the gawk info node says - * + * * `rand()' * Return a random number. The values of `rand()' are uniformly * distributed between zero and one. The value could be zero but is * never one.(1) - * + * * The division by RAND_DIVISOR may not guarantee that 1.0 is never * returned: the programmer forgot the platform-dependent issue of * rounding. - * + * * For points 4 and 5, the safe way is a loop: - * - * double + * + * double * rand(void) // return value in [0.0, 1.0) * { * value = internal_rand(); * - * while (value == 1.0) + * while (value == 1.0) * value = internal_rand(); - * + * * return (value); * } */ - + do { long d1, d2; /* @@ -2604,7 +2604,7 @@ do_match(int nargs) tre = POP(); rp = re_update(tre); t1 = POP_STRING(); - + rstart = research(rp, t1->stptr, 0, t1->stlen, RE_NEED_START); if (rstart >= 0) { /* match succeded */ size_t *wc_indices = NULL; @@ -2617,7 +2617,7 @@ do_match(int nargs) } rstart++; /* now it's 1-based indexing */ - + /* Build the array only if the caller wants the optional subpatterns */ if (dest != NULL) { subsepstr = SUBSEP_node->var_value->stptr; @@ -2633,7 +2633,7 @@ do_match(int nargs) size_t subpat_len; NODE **lhs; NODE *sub; - + start = t1->stptr + s; subpat_start = s; subpat_len = len = SUBPATEND(rp, t1->stptr, ii) - s; @@ -2641,7 +2641,7 @@ do_match(int nargs) subpat_start = wc_indices[s]; subpat_len = wc_indices[s + len - 1] - subpat_start + 1; } - + it = make_string(start, len); it->flags |= MAYBE_NUM; /* user input */ @@ -2657,7 +2657,7 @@ do_match(int nargs) sprintf(buff, "%d", ii); ilen = strlen(buff); amt = ilen + subseplen + strlen("length") + 1; - + if (oldamt == 0) { emalloc(buf, char *, amt, "do_match"); } else if (amt > oldamt) { @@ -2667,9 +2667,9 @@ do_match(int nargs) memcpy(buf, buff, ilen); memcpy(buf + ilen, subsepstr, subseplen); memcpy(buf + ilen + subseplen, "start", 6); - + slen = ilen + subseplen + 5; - + it = make_number((AWKNUM) subpat_start + 1); sub = make_string(buf, slen); lhs = assoc_lookup(dest, sub); @@ -2678,13 +2678,13 @@ do_match(int nargs) if (dest->astore != NULL) (*dest->astore)(dest, sub); unref(sub); - + memcpy(buf, buff, ilen); memcpy(buf + ilen, subsepstr, subseplen); memcpy(buf + ilen + subseplen, "length", 7); - + slen = ilen + subseplen + 6; - + it = make_number((AWKNUM) subpat_len); sub = make_string(buf, slen); lhs = assoc_lookup(dest, sub); @@ -2719,9 +2719,9 @@ do_match(int nargs) * Gsub can be tricksy; particularly when handling the case of null strings. * The following awk code was useful in debugging problems. It is too bad * that it does not readily translate directly into the C code, below. - * + * * #! /usr/local/bin/mawk -f - * + * * BEGIN { * true = 1; false = 0 * print "--->", mygsub("abc", "b+", "FOO") @@ -2731,7 +2731,7 @@ do_match(int nargs) * print "--->", mygsub("abc", "c+", "X") * print "--->", mygsub("abc", "x*$", "X") * } - * + * * function mygsub(str, regex, replace, origstr, newstr, eosflag, nonzeroflag) * { * origstr = str; @@ -2769,7 +2769,7 @@ do_match(int nargs) * } * if (length(str) > 0) * newstr = newstr str # rest of string - * + * * return newstr * } */ @@ -2781,7 +2781,7 @@ do_match(int nargs) * * The relevant text is to be found on lines 6394-6407 (pages 166, 167) of the * 2001 standard: - * + * * sub(ere, repl[, in ]) * Substitute the string repl in place of the first instance of the * extended regular expression ERE in string in and return the number of @@ -2839,7 +2839,7 @@ do_sub(int nargs, unsigned int flags) long current; bool lastmatchnonzero; char *mb_indices = NULL; - + if ((flags & GENSUB) != 0) { double d; NODE *glob_flag; @@ -3045,7 +3045,7 @@ do_sub(int nargs, unsigned int flags) int dig = scan[1] - '0'; if (dig < NUMSUBPATS(rp, target->stptr) && SUBPATSTART(rp, tp->stptr, dig) != -1) { char *start, *end; - + start = target->stptr + SUBPATSTART(rp, target->stptr, dig); end = target->stptr @@ -3139,7 +3139,7 @@ done: DEREF(rep_node); if ((matches == 0 || (flags & LITERAL) != 0) && buf != NULL) { - efree(buf); + efree(buf); buf = NULL; } @@ -3148,7 +3148,7 @@ done: /* return the result string */ DEREF(target); assert(buf != NULL); - return make_str_node(buf, textlen, ALREADY_MALLOCED); + return make_str_node(buf, textlen, ALREADY_MALLOCED); } /* return the original string */ @@ -3160,7 +3160,7 @@ done: DEREF(target); else if (matches > 0) { unref(*lhs); - *lhs = make_str_node(buf, textlen, ALREADY_MALLOCED); + *lhs = make_str_node(buf, textlen, ALREADY_MALLOCED); } return make_number((AWKNUM) matches); diff --git a/cint_array.c b/cint_array.c index 7a92cb0d..092ce88a 100644 --- a/cint_array.c +++ b/cint_array.c @@ -2,23 +2,23 @@ * cint_array.c - routines for arrays of (mostly) consecutive positive integer indices. */ -/* +/* * Copyright (C) 1986, 1988, 1989, 1991-2013, 2016, * the Free Software Foundation, Inc. - * + * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. - * + * * GAWK is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. - * + * * GAWK is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA @@ -37,7 +37,7 @@ extern NODE **is_integer(NODE *symbol, NODE *subs); * THRESHOLD --- Maximum capacity waste; THRESHOLD >= 2^(NHAT + 1). */ -static int NHAT = 10; +static int NHAT = 10; static long THRESHOLD; /* @@ -102,7 +102,7 @@ static void leaf_info(NODE *array, NODE *ndump, const char *aname); static void leaf_print(NODE *array, size_t bi, int indent_level); #endif -/* powers of 2 table upto 2^30 */ +/* powers of 2 table upto 2^30 */ static const long power_two_table[] = { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, @@ -118,7 +118,7 @@ static const long power_two_table[] = { /* * To store 2^n integers, allocate top-level array of size n, elements * of which are 1-Dimensional (leaf-array) of geometrically increasing - * size (power of 2). + * size (power of 2). * * [0] --> [ 0 ] * [1] --> [ 1 ] @@ -128,7 +128,7 @@ static const long power_two_table[] = { * |k| --> [ 2^(k - 1)| ... | 2^k - 1 ] * ... * - * For a given integer n (> 0), the leaf-array is at 1 + floor(log2(n)). + * For a given integer n (> 0), the leaf-array is at 1 + floor(log2(n)). * * The idea for the geometrically increasing array sizes is from: * Fast Functional Lists, Hash-Lists, Deques and Variable Length Arrays. @@ -394,7 +394,7 @@ cint_copy(NODE *symbol, NODE *newsymb) for (i = NHAT; i < INT32_BIT; i++) { if (old[i] == NULL) continue; - new[i] = make_node(Node_array_tree); + new[i] = make_node(Node_array_tree); tree_copy(newsymb, old[i], new[i]); } @@ -494,7 +494,7 @@ cint_dump(NODE *symbol, NODE *ndump) xsize = xn->table_size; } cint_size = symbol->table_size - xsize; - + if ((symbol->flags & XARRAY) == 0) fprintf(output_fp, "%s `%s'\n", (symbol->parent_array == NULL) ? "array" : "sub-array", @@ -525,7 +525,7 @@ cint_dump(NODE *symbol, NODE *ndump) /* Node_array_tree + HAT */ kb += (sizeof(NODE) + tree_kilobytes(tn)) / 1024.0; } - kb += (INT32_BIT * sizeof(NODE *)) / 1024.0; /* symbol->nodes */ + kb += (INT32_BIT * sizeof(NODE *)) / 1024.0; /* symbol->nodes */ kb += (symbol->array_capacity * sizeof(NODE *)) / 1024.0; /* value nodes in Node_array_leaf(s) */ if (xn != NULL) { if (xn->array_funcs == int_array_func) @@ -600,12 +600,12 @@ cint_hash(long k) * By Sean Eron Anderson * seander@cs.stanford.edu * Individually, the code snippets here are in the public domain - * (unless otherwise noted) — feel free to use them however you please. - * The aggregate collection and descriptions are © 1997-2005 + * (unless otherwise noted) --- feel free to use them however you please. + * The aggregate collection and descriptions are (C) 1997-2005 * Sean Eron Anderson. The code and descriptions are distributed in the * hope that they will be useful, but WITHOUT ANY WARRANTY and without * even the implied warranty of merchantability or fitness for a particular - * purpose. + * purpose. * */ @@ -678,15 +678,15 @@ cint_print(NODE *symbol) /* * A half HAT is defined here as a HAT with a top-level array of size n^2/2 * and holds the first n^2/2 elements. - * + * * 1. 2^8 elements can be stored in a full HAT of size 2^4. - * 2. 2^9 elements can be stored in a half HAT of size 2^5. + * 2. 2^9 elements can be stored in a half HAT of size 2^5. * 3. When the number of elements is some power of 2, it * can be stored in a full or a half HAT. * 4. When the number of elements is some power of 2, it * can be stored in a HAT (full or half) with HATs as leaf elements * (full or half), and so on (e.g. 2^8 elements in a HAT of size 2^4 (top-level - * array dimension) with each leaf array being a HAT of size 2^2). + * array dimension) with each leaf array being a HAT of size 2^2). * * IMPLEMENTATION DETAILS: * 1. A HAT of 2^12 elements needs 2^6 house-keeping NODEs @@ -737,7 +737,7 @@ tree_lookup(NODE *symbol, NODE *tree, long k, int m, long base) */ n = (m + 1) / 2; - + if (tree->table_size == 0) { size_t actual_size; NODE **table; @@ -920,7 +920,7 @@ tree_list(NODE *tree, NODE **list, assoc_kind_t assoc_kind) static void tree_copy(NODE *newsymb, NODE *tree, NODE *newtree) -{ +{ NODE **old, **new; size_t j, hsize; @@ -1061,13 +1061,13 @@ leaf_lookup(NODE *symbol, NODE *array, long k, long size, long base) } -/* leaf_exists --- check if the array contains an integer subscript */ +/* leaf_exists --- check if the array contains an integer subscript */ static inline NODE ** leaf_exists(NODE *array, long k) { NODE **lhs; - lhs = array->nodes + (k - array->array_base); + lhs = array->nodes + (k - array->array_base); return (*lhs != NULL) ? lhs : NULL; } @@ -1086,7 +1086,7 @@ leaf_clear(NODE *array) continue; if (r->type == Node_var_array) { assoc_clear(r); /* recursively clear all sub-arrays */ - efree(r->vname); + efree(r->vname); freenode(r); } else unref(r); @@ -1104,7 +1104,7 @@ leaf_remove(NODE *symbol, NODE *array, long k) { NODE **lhs; - lhs = array->nodes + (k - array->array_base); + lhs = array->nodes + (k - array->array_base); if (*lhs == NULL) return false; *lhs = NULL; @@ -1171,7 +1171,7 @@ leaf_list(NODE *array, NODE **list, assoc_kind_t assoc_kind) /* index */ num = array->array_base + ci; if ((assoc_kind & AISTR) != 0) { - sprintf(buf, "%ld", num); + sprintf(buf, "%ld", num); subs = make_string(buf, strlen(buf)); subs->numbr = num; subs->flags |= (NUMCUR|NUMINT); @@ -2,22 +2,22 @@ * cmd.h - definitions for command parser */ -/* +/* * Copyright (C) 2004, 2010, 2011, 2013, 2014 the Free Software Foundation, Inc. - * + * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. - * + * * GAWK is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. - * + * * GAWK is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA @@ -106,7 +106,7 @@ enum argtype { D_range }; -/* non-number arguments to commands */ +/* non-number arguments to commands */ enum nametypeval { A_NONE = 0, @@ -135,7 +135,7 @@ typedef struct cmd_argument { NODE *nodeval; } value; -#define a_int value.lval /* type = D_int or D_range */ +#define a_int value.lval /* type = D_int or D_range */ #define a_argument value.lval /* type = D_argument */ #define a_string value.sval /* type = D_string, D_array, D_subscript or D_variable */ #define a_node value.nodeval /* type = D_node, D_field or D_func */ @@ -89,7 +89,7 @@ static bool want_nodeval = false; static int cmd_idx = -1; /* index of current command in cmd table */ static int repeat_idx = -1; /* index of last repeatable command in command table */ -static CMDARG *arg_list = NULL; /* list of arguments */ +static CMDARG *arg_list = NULL; /* list of arguments */ static long errcount = 0; static char *lexptr_begin = NULL; static bool in_commands = false; @@ -97,7 +97,7 @@ static int num_dim; static bool in_eval = false; static const char start_EVAL[] = "function @eval(){"; -static const char end_EVAL[] = "}"; +static const char end_EVAL[] = "}"; static CMDARG *append_statement(CMDARG *stmt_list, char *stmt); static NODE *concat_args(CMDARG *a, int count); @@ -1553,7 +1553,7 @@ yyreduce: bool terminate = false; CMDARG *args; int ctype = 0; - + ctype = cmdtab[cmd_idx].type; /* a blank line repeats previous command @@ -1794,7 +1794,7 @@ yyreduce: if (type) { in_commands = true; if (input_from_tty) { - dbg_prompt = commands_prompt; + dbg_prompt = commands_prompt; fprintf(out_fp, _("Type commands for when %s %d is hit, one per line.\n"), (type == D_break) ? "breakpoint" : "watchpoint", num); fprintf(out_fp, _("End with the command \"end\"\n")); @@ -1811,7 +1811,7 @@ yyreduce: yyerror(_("`end' valid only in command `commands' or `eval'")); else { if (input_from_tty) - dbg_prompt = dgawk_prompt; + dbg_prompt = dgawk_prompt; in_commands = false; } } @@ -2108,7 +2108,7 @@ yyreduce: CMDARG *a; NODE *subs; int count = 0; - + for (a = (yyvsp[-1]); a != NULL; a = a->next) count++; subs = concat_args((yyvsp[-1]), count); @@ -2165,7 +2165,7 @@ yyreduce: case 145: #line 678 "command.y" /* yacc.c:1646 */ - { + { NODE *n = (yyvsp[0])->a_node; if ((n->flags & NUMBER) == 0) yyerror(_("non-numeric value found, numeric expected")); @@ -2176,7 +2176,7 @@ yyreduce: case 146: #line 685 "command.y" /* yacc.c:1646 */ - { + { NODE *n = (yyvsp[0])->a_node; if ((n->flags & NUMBER) == 0) yyerror(_("non-numeric value found, numeric expected")); @@ -2498,12 +2498,12 @@ yyreturn: -/* append_statement --- append 'stmt' to the list of eval awk statements */ +/* append_statement --- append 'stmt' to the list of eval awk statements */ static CMDARG * -append_statement(CMDARG *stmt_list, char *stmt) +append_statement(CMDARG *stmt_list, char *stmt) { - CMDARG *a, *arg; + CMDARG *a, *arg; char *s; int len, slen, ssize; @@ -2535,7 +2535,7 @@ append_statement(CMDARG *stmt_list, char *stmt) s[slen] = '\0'; return arg; } - + len = strlen(stmt) + 1; /* 1 for newline */ s = stmt_list->a_string; slen = strlen(s); @@ -2699,7 +2699,7 @@ get_command_name(int ctype) return cmdtab[i].name; } return NULL; -} +} /* mk_cmdarg --- make an argument for command */ @@ -2714,7 +2714,7 @@ mk_cmdarg(enum argtype type) } /* append_cmdarg --- append ARG to the list of arguments for the current command */ - + static void append_cmdarg(CMDARG *arg) { @@ -2785,7 +2785,7 @@ yylex(void) static char *lexend; int c; char *tokstart; - size_t toklen; + size_t toklen; yylval = (CMDARG *) NULL; @@ -2799,7 +2799,7 @@ yylex(void) again: lexptr_begin = read_a_line(dbg_prompt); if (lexptr_begin == NULL) { /* EOF or error */ - if (get_eof_status() == EXIT_FATAL) + if (get_eof_status() == EXIT_FATAL) exit(EXIT_FATAL); if (get_eof_status() == EXIT_FAILURE) { static int seen_eof = 0; @@ -2831,7 +2831,7 @@ again: && input_from_tty ) history_expand_line(&lexptr_begin); - + lexptr = lexptr_begin; lexend = lexptr + strlen(lexptr); if (*lexptr == '\0' /* blank line */ @@ -2850,14 +2850,14 @@ again: } repeat_idx = -1; } - + c = *lexptr; while (c == ' ' || c == '\t') c = *++lexptr; if (! input_from_tty && c == '#') - return '\n'; + return '\n'; tokstart = lexptr; if (lexptr >= lexend) @@ -2914,7 +2914,7 @@ again: } c = *lexptr; - + if (cmdtab[cmd_idx].type == D_option) { if (c == '=') return *lexptr++; @@ -3016,8 +3016,8 @@ err: r = mpg_integer(); mpfr_get_z(r->mpg_i, tmp->mpg_numbr, MPFR_RNDZ); unref(tmp); - } - } else + } + } else #endif r = make_number(strtod(tokstart, & lexptr)); @@ -3126,7 +3126,7 @@ concat_args(CMDARG *arg, int count) n = force_string(arg->a_node); return dupnode(n); } - + emalloc(tmp, NODE **, count * sizeof(NODE *), "concat_args"); subseplen = SUBSEP_node->var_value->stlen; subsep = SUBSEP_node->var_value->stptr; @@ -3161,7 +3161,7 @@ concat_args(CMDARG *arg, int count) } /* find_command --- find the index in 'cmdtab' using exact, - * abbreviation or unique partial match + * abbreviation or unique partial match */ static int @@ -3253,10 +3253,10 @@ do_help(CMDARG *arg, int cmd) #ifdef HAVE_LIBREADLINE -/* next_word --- find the next word in a line to complete +/* next_word --- find the next word in a line to complete * (word seperation characters are space and tab). */ - + static char * next_word(char *p, int len, char **endp) { @@ -3338,10 +3338,10 @@ command_completion(const char *text, int start, int end) if (this_cmd == D_print || this_cmd == D_printf) return rl_completion_matches(text, variable_generator); return NULL; -} +} /* command_generator --- generator function for command completion */ - + static char * command_generator(const char *text, int state) { @@ -3414,7 +3414,7 @@ argument_generator(const char *text, int state) if (strncmp(name, text, textlen) == 0) return estrdup(name, strlen(name)); } - } + } return NULL; } @@ -2,23 +2,23 @@ * command.y - yacc/bison parser for debugger commands. */ -/* +/* * Copyright (C) 2004, 2010, 2011, 2014, 2016 * the Free Software Foundation, Inc. - * + * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. - * + * * GAWK is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. - * + * * GAWK is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA @@ -42,7 +42,7 @@ static bool want_nodeval = false; static int cmd_idx = -1; /* index of current command in cmd table */ static int repeat_idx = -1; /* index of last repeatable command in command table */ -static CMDARG *arg_list = NULL; /* list of arguments */ +static CMDARG *arg_list = NULL; /* list of arguments */ static long errcount = 0; static char *lexptr_begin = NULL; static bool in_commands = false; @@ -50,7 +50,7 @@ static int num_dim; static bool in_eval = false; static const char start_EVAL[] = "function @eval(){"; -static const char end_EVAL[] = "}"; +static const char end_EVAL[] = "}"; static CMDARG *append_statement(CMDARG *stmt_list, char *stmt); static NODE *concat_args(CMDARG *a, int count); @@ -132,7 +132,7 @@ line bool terminate = false; CMDARG *args; int ctype = 0; - + ctype = cmdtab[cmd_idx].type; /* a blank line repeats previous command @@ -308,7 +308,7 @@ command | D_LIST list_args | D_UNTIL location | D_CLEAR location - | break_cmd break_args + | break_cmd break_args | D_SET { want_nodeval = true; } variable '=' node | D_OPTION option_args | D_RETURN { want_nodeval = true; } opt_node @@ -345,7 +345,7 @@ command if (type) { in_commands = true; if (input_from_tty) { - dbg_prompt = commands_prompt; + dbg_prompt = commands_prompt; fprintf(out_fp, _("Type commands for when %s %d is hit, one per line.\n"), (type == D_break) ? "breakpoint" : "watchpoint", num); fprintf(out_fp, _("End with the command \"end\"\n")); @@ -358,7 +358,7 @@ command yyerror(_("`end' valid only in command `commands' or `eval'")); else { if (input_from_tty) - dbg_prompt = dgawk_prompt; + dbg_prompt = dgawk_prompt; in_commands = false; } } @@ -493,9 +493,9 @@ location break_args : /* empty */ - { $$ = NULL; } + { $$ = NULL; } | plus_integer { want_nodeval = true; } condition_exp - | func_name + | func_name | D_STRING ':' plus_integer { want_nodeval = true; } condition_exp | D_STRING ':' func_name ; @@ -631,7 +631,7 @@ subscript CMDARG *a; NODE *subs; int count = 0; - + for (a = $2; a != NULL; a = a->next) count++; subs = concat_args($2, count); @@ -641,7 +641,7 @@ subscript $2->a_node = subs; $$ = $2; } - | '[' exp_list error + | '[' exp_list error ; subscript_list @@ -675,14 +675,14 @@ node : D_NODE { $$ = $1; } | '+' D_NODE - { + { NODE *n = $2->a_node; if ((n->flags & NUMBER) == 0) yyerror(_("non-numeric value found, numeric expected")); $$ = $2; } | '-' D_NODE - { + { NODE *n = $2->a_node; if ((n->flags & NUMBER) == 0) yyerror(_("non-numeric value found, numeric expected")); @@ -705,7 +705,7 @@ opt_integer | integer { $$ = $1; } ; - + plus_integer : D_INT { @@ -720,7 +720,7 @@ plus_integer $$ = $2; } ; - + integer : D_INT { $$ = $1; } @@ -748,12 +748,12 @@ nls %% -/* append_statement --- append 'stmt' to the list of eval awk statements */ +/* append_statement --- append 'stmt' to the list of eval awk statements */ static CMDARG * -append_statement(CMDARG *stmt_list, char *stmt) +append_statement(CMDARG *stmt_list, char *stmt) { - CMDARG *a, *arg; + CMDARG *a, *arg; char *s; int len, slen, ssize; @@ -785,7 +785,7 @@ append_statement(CMDARG *stmt_list, char *stmt) s[slen] = '\0'; return arg; } - + len = strlen(stmt) + 1; /* 1 for newline */ s = stmt_list->a_string; slen = strlen(s); @@ -949,7 +949,7 @@ get_command_name(int ctype) return cmdtab[i].name; } return NULL; -} +} /* mk_cmdarg --- make an argument for command */ @@ -964,7 +964,7 @@ mk_cmdarg(enum argtype type) } /* append_cmdarg --- append ARG to the list of arguments for the current command */ - + static void append_cmdarg(CMDARG *arg) { @@ -1035,7 +1035,7 @@ yylex(void) static char *lexend; int c; char *tokstart; - size_t toklen; + size_t toklen; yylval = (CMDARG *) NULL; @@ -1049,7 +1049,7 @@ yylex(void) again: lexptr_begin = read_a_line(dbg_prompt); if (lexptr_begin == NULL) { /* EOF or error */ - if (get_eof_status() == EXIT_FATAL) + if (get_eof_status() == EXIT_FATAL) exit(EXIT_FATAL); if (get_eof_status() == EXIT_FAILURE) { static int seen_eof = 0; @@ -1081,7 +1081,7 @@ again: && input_from_tty ) history_expand_line(&lexptr_begin); - + lexptr = lexptr_begin; lexend = lexptr + strlen(lexptr); if (*lexptr == '\0' /* blank line */ @@ -1100,14 +1100,14 @@ again: } repeat_idx = -1; } - + c = *lexptr; while (c == ' ' || c == '\t') c = *++lexptr; if (! input_from_tty && c == '#') - return '\n'; + return '\n'; tokstart = lexptr; if (lexptr >= lexend) @@ -1164,7 +1164,7 @@ again: } c = *lexptr; - + if (cmdtab[cmd_idx].type == D_option) { if (c == '=') return *lexptr++; @@ -1266,8 +1266,8 @@ err: r = mpg_integer(); mpfr_get_z(r->mpg_i, tmp->mpg_numbr, MPFR_RNDZ); unref(tmp); - } - } else + } + } else #endif r = make_number(strtod(tokstart, & lexptr)); @@ -1376,7 +1376,7 @@ concat_args(CMDARG *arg, int count) n = force_string(arg->a_node); return dupnode(n); } - + emalloc(tmp, NODE **, count * sizeof(NODE *), "concat_args"); subseplen = SUBSEP_node->var_value->stlen; subsep = SUBSEP_node->var_value->stptr; @@ -1411,7 +1411,7 @@ concat_args(CMDARG *arg, int count) } /* find_command --- find the index in 'cmdtab' using exact, - * abbreviation or unique partial match + * abbreviation or unique partial match */ static int @@ -1503,10 +1503,10 @@ do_help(CMDARG *arg, int cmd) #ifdef HAVE_LIBREADLINE -/* next_word --- find the next word in a line to complete +/* next_word --- find the next word in a line to complete * (word seperation characters are space and tab). */ - + static char * next_word(char *p, int len, char **endp) { @@ -1588,10 +1588,10 @@ command_completion(const char *text, int start, int end) if (this_cmd == D_print || this_cmd == D_printf) return rl_completion_matches(text, variable_generator); return NULL; -} +} /* command_generator --- generator function for command completion */ - + static char * command_generator(const char *text, int state) { @@ -1664,7 +1664,7 @@ argument_generator(const char *text, int state) if (strncmp(name, text, textlen) == 0) return estrdup(name, strlen(name)); } - } + } return NULL; } @@ -10,23 +10,23 @@ * the information, to arnold@skeeve.com. */ -/* +/* * Copyright (C) 1995-2004, 2008, 2009, 2011, 2016 * the Free Software Foundation, Inc. - * + * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. - * + * * GAWK is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. - * + * * GAWK is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA @@ -1,23 +1,23 @@ /* - * debug.c - gawk debugger + * debug.c - gawk debugger */ -/* +/* * Copyright (C) 2004, 2010-2013, 2016 the Free Software Foundation, Inc. - * + * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. - * + * * GAWK is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. - * + * * GAWK is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA @@ -77,7 +77,7 @@ struct commands_item { CMDARG *arg; }; -/* breakpoint structure */ +/* breakpoint structure */ typedef struct break_point { struct break_point *next; struct break_point *prev; @@ -99,7 +99,7 @@ typedef struct break_point { #define BP_TEMP 4 #define BP_IGNORE 8 -} BREAKPOINT; +} BREAKPOINT; static BREAKPOINT breakpoints = { &breakpoints, &breakpoints, 0 }; @@ -126,12 +126,12 @@ struct list_item { NODE *symbol; /* variable or function param */ NODE **subs; /* subscripts */ - int num_subs; /* subscript(dimension) count */ + int num_subs; /* subscript(dimension) count */ char *sname; /* symbol or param name */ long fcall_count; - struct commands_item commands; + struct commands_item commands; int silent; struct condition cndn; @@ -149,8 +149,8 @@ struct list_item { #define PARAM 1 #define SUBSCRIPT 2 #define FIELD_NUM 4 -#define OLD_IS_ARRAY 8 /* old item is array */ -#define CUR_IS_ARRAY 16 /* current item is array */ +#define OLD_IS_ARRAY 8 /* old item is array */ +#define CUR_IS_ARRAY 16 /* current item is array */ }; #define IS_PARAM(d) (((d)->flags & PARAM) != 0) @@ -175,7 +175,7 @@ static struct { INSTRUCTION *pc; /* 'until' and 'return' commands */ int repeat_count; /* 'step', 'next', 'stepi', 'nexti' commands */ bool print_frame; /* print frame info, 'finish' and 'until' */ - bool print_ret; /* print returned value, 'finish' */ + bool print_ret; /* print returned value, 'finish' */ int break_point; /* non-zero (breakpoint number) if stopped at break point */ int watch_point; /* non-zero (watchpoint number) if stopped at watch point */ @@ -183,7 +183,7 @@ static struct { * awk interpreter and return control * to debugger command interpreter. */ - + enum argtype command; /* command type */ } stop; @@ -216,7 +216,7 @@ struct dbg_option { int *num_val; char **str_val; void (*assign)(const char *); - const char *help_txt; + const char *help_txt; }; #define DEFAULT_HISTFILE "./.gawk_history" @@ -273,7 +273,7 @@ jmp_buf pager_quit_tag; bool pager_quit_tag_valid = false; static int screen_width = INT_MAX; /* no of columns */ static int screen_height = INT_MAX; /* no of rows */ -static int pager_lines_printed = 0; /* no of lines printed so far */ +static int pager_lines_printed = 0; /* no of lines printed so far */ static void restart(bool run) ATTRIBUTE_NORETURN; static void close_all(void); @@ -574,7 +574,7 @@ print_lines(char *src, int start_line, int nlines) for (i = start_line; i < start_line + nlines; i++) { int supposed_len, len; char *p; - + sprintf(linebuf, "%-8d", i); /* mark the line about to be executed with =>; nlines > 1 @@ -582,7 +582,7 @@ print_lines(char *src, int start_line, int nlines) */ if (nlines > 1) { BREAKPOINT *b; - bool has_bpt = false; + bool has_bpt = false; for (b = breakpoints.prev; b != &breakpoints; b = b->prev) { if (src == b->src && i == b->bpi->source_line) { has_bpt = true; @@ -595,7 +595,7 @@ print_lines(char *src, int start_line, int nlines) else sprintf(linebuf, "%-4d =>", i); } else if (has_bpt) - sprintf(linebuf, "%-4d:b ", i); + sprintf(linebuf, "%-4d:b ", i); } p = linebuf + strlen(linebuf); @@ -647,7 +647,7 @@ do_list(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) long count = list_size; INSTRUCTION *rp; char *src = cur_srcfile->src; - + line_first = last_printed_line + 1; /* default or no arg */ if (arg == NULL) /* list or list + */ goto list; @@ -679,10 +679,10 @@ range: count = arg->a_int - line_first + 1; break; - case D_string: + case D_string: src = arg->a_string; if (arg->next != NULL) { - arg = arg->next; + arg = arg->next; if (arg->type == D_int) /* list file:n */ goto line; else if (arg->type == D_range) /* list file:m-n */ @@ -713,7 +713,7 @@ list: if (line_last != -1) { last_printed_line = line_last; last_print_count = line_last - line_first + 1; - } + } return false; } @@ -780,7 +780,7 @@ do_info(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) continue; start++; *end = '\0'; - gprintf(out_fp, "%s", start); /* FIXME: translate ? */ + gprintf(out_fp, "%s", start); /* FIXME: translate ? */ *end = '}'; } } @@ -900,7 +900,7 @@ do_info(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) sub = d->subs[i]; gprintf(out_fp, "[\"%s\"]", sub->stptr); } - gprintf(out_fp, "\n"); + gprintf(out_fp, "\n"); } else if (IS_FIELD(d)) gprintf(out_fp, "%d:\t$%ld\n", d->number, get_number_si(symbol)); else @@ -920,7 +920,7 @@ do_info(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) continue; start++; *end = '\0'; - gprintf(out_fp, "%s", start); /* FIXME: translate ? */ + gprintf(out_fp, "%s", start); /* FIXME: translate ? */ *end = '}'; } } @@ -998,7 +998,7 @@ find_param(const char *name, long num, char **pname) func = f->func_node; pcount = func->param_cnt; for (i = 0; i < pcount; i++) { - fparam = func->fparms[i].param; + fparam = func->fparms[i].param; if (strcmp(name, fparam) == 0) { r = f->stack[i]; if (r->type == Node_array_ref) @@ -1123,7 +1123,7 @@ print_subscript(NODE *arr, char *arr_name, CMDARG *a, int count) else { /* print # of elements in array */ fprintf(out_fp, "%s = ", r->vname); - print_symbol(r, false); + print_symbol(r, false); } } else { fprintf(out_fp, "%s[\"%s\"] = ", arr_name, subs->stptr); @@ -1163,7 +1163,7 @@ do_print_var(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) if ((r = find_array(name)) != NULL) { int count = a->a_count; for (; count > 0; count--) { - NODE *value, *subs; + NODE *value, *subs; a = a->next; subs = a->a_node; value = in_array(r, subs); @@ -1195,9 +1195,9 @@ do_print_var(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) /* notably D_node, subscript for invalid array name; skip */ break; } - } + } return false; -} +} /* do_set_var --- set command */ @@ -1358,7 +1358,7 @@ delete_item(struct list_item *d) free_context(d->cndn.ctxt, false); if (d->cndn.expr != NULL) efree(d->cndn.expr); - + d->next->prev = d->prev; d->prev->next = d->next; efree(d); @@ -1533,7 +1533,7 @@ display(struct list_item *d) symbol = r; if (i == count - 1) /* it's a sub-array */ goto print_sym; /* print # of elements in sub-array */ - } else { + } else { if (i != count - 1) return; /* FIXME msg and delete item ? */ fprintf(out_fp, "%d: %s[\"%s\"] = ", d->number, @@ -1574,15 +1574,15 @@ do_display(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) } /* do_undisplay --- undisplay command */ - + int do_undisplay(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) { do_delete_item(&display_list, arg); - return false; + return false; } -/* condition_triggered --- test if a condition expression is true */ +/* condition_triggered --- test if a condition expression is true */ static int condition_triggered(struct condition *cndn) @@ -1631,21 +1631,21 @@ find_subscript(struct list_item *item, NODE **ptr) } /* cmp_val --- compare values of watched item, returns true if different; */ - + static int -cmp_val(struct list_item *w, NODE *old, NODE *new) +cmp_val(struct list_item *w, NODE *old, NODE *new) { /* * case old new result * ------------------------------ - * 1: NULL ARRAY true + * 1: NULL ARRAY true * 2: NULL SCALAR true * 3: NULL NULL false * 4: SCALAR SCALAR cmp_node * 5: SCALAR ARRAY true * 6: SCALAR NULL true * 7: ARRAY SCALAR true - * 8: ARRAY ARRAY compare size + * 8: ARRAY ARRAY compare size * 9: ARRAY NULL true */ @@ -1834,7 +1834,7 @@ do_watch(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) } /* do_unwatch --- unwatch command */ - + int do_unwatch(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) { @@ -1881,9 +1881,9 @@ print_function(INSTRUCTION *pc, void *x) { NODE *func; int i, pcount; - struct pf_data *data = (struct pf_data *) x; + struct pf_data *data = (struct pf_data *) x; int defn = data->defn; - Func_print print_func = data->print_func; + Func_print print_func = data->print_func; FILE *fp = data->fp; func = pc->func_body; @@ -1892,7 +1892,7 @@ print_function(INSTRUCTION *pc, void *x) print_func(fp, "%s(", func->vname); for (i = 0; i < pcount; i++) { print_func(fp, "%s", func->fparms[i].param); - if (i < pcount - 1) + if (i < pcount - 1) print_func(fp, ", "); } print_func(fp, ")"); @@ -1936,7 +1936,7 @@ print_numbered_frame(long num) } else { fprintf(out_fp, _("#%ld\tin "), num); print_frame(f->func_node, f->vname, - ((INSTRUCTION *) find_frame(num - 1)->reti)->source_line); + ((INSTRUCTION *) find_frame(num - 1)->reti)->source_line); } fprintf(out_fp, "\n"); } @@ -1965,7 +1965,7 @@ do_backtrace(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) if (cur < 0) cur = 0; } - } + } for (; cur <= last; cur++) { print_numbered_frame(cur); @@ -1973,12 +1973,12 @@ do_backtrace(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) if (cur <= fcall_count) fprintf(out_fp, _("More stack frames follow ...\n")); return false; -} +} /* print_cur_frame_and_sourceline --- print current frame, and * current source line. */ - + static void print_cur_frame_and_sourceline() { @@ -2092,7 +2092,7 @@ find_rule(char *src, long lineno) /* mk_breakpoint --- create a breakpoint instruction and the corresponding * breakpoint structure. */ - + static INSTRUCTION * mk_breakpoint(char *src, int srcline) { @@ -2113,7 +2113,7 @@ mk_breakpoint(char *src, int srcline) b->src = src; bp->break_pt = b; b->bpi = bp; - + /* prepend to list */ b->next = breakpoints.next; b->prev = &breakpoints; @@ -2136,7 +2136,7 @@ delete_breakpoint(BREAKPOINT *b) * deleteing the instruction is not that simple, * since could have reference to it somewhere else (e.g. cur_pc). */ - + pc->opcode = Op_no_op; pc->source_line = 0; pc->break_pt = NULL; @@ -2147,7 +2147,7 @@ delete_breakpoint(BREAKPOINT *b) delete_commands_item(c->next); } - free_context(b->cndn.ctxt, false); + free_context(b->cndn.ctxt, false); if (b->cndn.expr != NULL) efree(b->cndn.expr); @@ -2165,7 +2165,7 @@ find_breakpoint(long num) BREAKPOINT *b; if (num <= 0) - return NULL; + return NULL; for (b = breakpoints.next; b != &breakpoints; b = b->next) { if (b->number == num) @@ -2175,7 +2175,7 @@ find_breakpoint(long num) } /* add_breakpoint --- add a breakpoint instruction between PREVP and IP */ - + static BREAKPOINT * add_breakpoint(INSTRUCTION *prevp, INSTRUCTION *ip, char *src, bool silent) { @@ -2255,7 +2255,7 @@ set_breakpoint_at(INSTRUCTION *rp, int lineno, bool silent) * a monotonically increasing sequence. Check if the line # is between * the first and last statements of the case block before continuing * the search. - */ + */ for (i2 = ip->stmt_start, i1 = i2->nexti; i2 != ip->stmt_end; i2 = i1, i1 = i1->nexti) { if (i1->source_line >= lineno) @@ -2293,7 +2293,7 @@ set_breakpoint_next(INSTRUCTION *rp, INSTRUCTION *ip) } return NULL; } - + /* set_breakpoint --- set a breakpoint */ static int @@ -2309,7 +2309,7 @@ set_breakpoint(CMDARG *arg, bool temporary) if (arg == NULL) { /* * (From GDB Documentation): -* +* * When called without any arguments, break sets a breakpoint at the next instruction * to be executed in the selected stack frame (see section Examining the Stack). * In any selected frame but the innermost, this makes your program stop as soon @@ -2322,7 +2322,7 @@ set_breakpoint(CMDARG *arg, bool temporary) * one instruction has been executed. If it did not do this, * you would be unable to proceed past a breakpoint without first disabling the * breakpoint. This rule applies whether or not the breakpoint already existed -* when your program stopped. +* when your program stopped. */ CHECK_PROG_RUNNING(); if (cur_frame == 0) { @@ -2427,7 +2427,7 @@ breakpoint_triggered(BREAKPOINT *b) if ((b->flags & BP_ENABLE_ONCE) != 0) { b->flags &= ~BP_ENABLE_ONCE; b->flags &= ~BP_ENABLE; - } + } return b->number; } @@ -2437,7 +2437,7 @@ int do_breakpoint(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) { return set_breakpoint(arg, false); -} +} /* do_tmp_breakpoint --- tbreak command */ @@ -2611,7 +2611,7 @@ do_delete_breakpoint(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) delete_all = prompt_yes_no( _("Delete all breakpoints? (y or n) "), _("y")[0], true, out_fp); - + if (delete_all) { while (breakpoints.next != &breakpoints) delete_breakpoint(breakpoints.next); @@ -2736,7 +2736,7 @@ initialize_readline() /* our completion function. */ rl_attempted_completion_function = command_completion; - read_a_line = readline; + read_a_line = readline; } #else #define initialize_readline() /* nothing */ @@ -2769,9 +2769,9 @@ debug_prog(INSTRUCTION *pc) if (! read_a_line) read_a_line = g_readline; - push_cmd_src(input_fd, input_from_tty, read_a_line, 0, 0, EXIT_FATAL); + push_cmd_src(input_fd, input_from_tty, read_a_line, 0, 0, EXIT_FATAL); - setbuf(out_fp, (char *) NULL); + setbuf(out_fp, (char *) NULL); for (cur_srcfile = srcfiles->prev; cur_srcfile != srcfiles; cur_srcfile = cur_srcfile->prev) { if (cur_srcfile->stype == SRC_FILE @@ -2800,7 +2800,7 @@ debug_prog(INSTRUCTION *pc) unserialize(HISTORY); unserialize(OPTION); unsetenv("DGAWK_RESTART"); - fprintf(out_fp, "Restarting ...\n"); + fprintf(out_fp, "Restarting ...\n"); if (strcasecmp(run, "true") == 0) (void) do_run(NULL, 0); @@ -2867,7 +2867,7 @@ check_breakpoint(INSTRUCTION **pi) pc = *pi; if (stop.command == D_return) - return false; + return false; if (pc->opcode == Op_breakpoint) { int bnum; *pi = pc->nexti; /* skip past the breakpoint instruction; @@ -3239,7 +3239,7 @@ check_return(INSTRUCTION **pi) func = find_frame(cur_frame)->func_node; assert(func != NULL); - *pi = (func->code_ptr + 1)->lasti; + *pi = (func->code_ptr + 1)->lasti; /* assert((*pi)->opcode == Op_K_return); */ } @@ -3306,7 +3306,7 @@ do_until(CMDARG *arg, int cmd) int lineno; INSTRUCTION *rp, *ip; NODE *func; - + CHECK_PROG_RUNNING(); stop.pc = NULL; stop.sourceline = 0; @@ -3413,7 +3413,7 @@ print_watch_item(struct list_item *w) sub = w->subs[i]; fprintf(out_fp, "[\"%s\"]", sub->stptr); } - fprintf(out_fp, "\n"); + fprintf(out_fp, "\n"); } else if (IS_FIELD(w)) fprintf(out_fp, "$%ld\n", get_number_si(symbol)); else @@ -3478,12 +3478,12 @@ next_command() print_watch_item(w); } - /* frame info */ + /* frame info */ if (stop.print_frame) { print_frame(frame_ptr->func_node, source, sourceline); fprintf(out_fp, "\n"); stop.print_frame = false; - } + } (void) print_lines(source, sourceline, 1); @@ -3495,12 +3495,12 @@ no_output: /* update last_printed_line, so that output of 'list' is * centered around current sourceline */ - + last_printed_line = sourceline - list_size / 2; if (last_printed_line < 0) last_printed_line = 0; - /* update current source file */ + /* update current source file */ s = source_find(source); if (cur_srcfile != s) { if (cur_srcfile->fd != INVALID_HANDLE) { @@ -3526,7 +3526,7 @@ no_output: read_command(); /* zzparse */ } -/* debug_post_execute --- post_hook in the interpreter */ +/* debug_post_execute --- post_hook in the interpreter */ static void debug_post_execute(INSTRUCTION *pc) @@ -3545,14 +3545,14 @@ debug_post_execute(INSTRUCTION *pc) stop.command = D_illegal; stop.check_func = NULL; fprintf(out_fp, _("'finish' not meaningful with non-local jump '%s'\n"), - op2str(pc->opcode)); + op2str(pc->opcode)); } else if (stop.command == D_until) { /* cancel until command */ stop.print_frame = false; stop.command = D_illegal; stop.check_func = NULL; fprintf(out_fp, _("'until' not meaningful with non-local jump '%s'\n"), - op2str(pc->opcode)); + op2str(pc->opcode)); } break; @@ -3579,7 +3579,7 @@ debug_post_execute(INSTRUCTION *pc) } } -/* debug_pre_execute --- pre_hook, called by the interpreter before execution; +/* debug_pre_execute --- pre_hook, called by the interpreter before execution; * checks if execution needs to be suspended and control * transferred to the debugger. */ @@ -3609,7 +3609,7 @@ debug_pre_execute(INSTRUCTION **pi) * yield surprising results. Ditto for Op_push_lhs for special variables * (upto Op_var_assign, the set_FOO routine). */ - + switch (cur_pc->opcode) { case Op_field_spec_lhs: cant_stop = true; @@ -3617,7 +3617,7 @@ debug_pre_execute(INSTRUCTION **pi) case Op_field_assign: cant_stop = false; - return true; /* may stop at next instruction */ + return true; /* may stop at next instruction */ case Op_push_lhs: m = cur_pc->memory; @@ -3647,7 +3647,7 @@ debug_pre_execute(INSTRUCTION **pi) break; /* processed later in check_breakpoint() */ default: - if (cur_pc->source_line <= 0) + if (cur_pc->source_line <= 0) return true; break; } @@ -3685,7 +3685,7 @@ debug_pre_execute(INSTRUCTION **pi) /* print_memory --- print a scalar value */ -static void +static void print_memory(NODE *m, NODE *func, Func_print print_func, FILE *fp) { switch (m->type) { @@ -3714,7 +3714,7 @@ print_memory(NODE *m, NODE *func, Func_print print_func, FILE *fp) case Node_dynregex: break; - + case Node_param_list: assert(func != NULL); print_func(fp, "%s", func->fparms[m->param_cnt].param); @@ -3779,7 +3779,7 @@ print_instruction(INSTRUCTION *pc, Func_print print_func, FILE *fp, int in_dump) func = find_frame(0)->func_node; } - + switch (pc->opcode) { case Op_K_if: print_func(fp, "[branch_if = %p] [branch_else = %p] [branch_else->lasti = %p]\n", @@ -3943,7 +3943,7 @@ print_instruction(INSTRUCTION *pc, Func_print print_func, FILE *fp, int in_dump) genflags2str(pc->sub_flags, values)); } break; - + case Op_builtin: print_func(fp, "%s [arg_count = %ld]\n", getfname(pc->builtin), pc->expr_count); @@ -3976,7 +3976,7 @@ print_instruction(INSTRUCTION *pc, Func_print print_func, FILE *fp, int in_dump) break; case Op_concat: - /* NB: concat_flag CSVAR only used in grammar, don't display it */ + /* NB: concat_flag CSVAR only used in grammar, don't display it */ print_func(fp, "[expr_count = %ld] [concat_flag = %s]\n", pc->expr_count, (pc->concat_flag & CSUBSEP) != 0 ? "CSUBSEP" : "0"); @@ -4061,7 +4061,7 @@ do_trace_instruction(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) else do_trace = false; return false; -} +} /* print_code --- print a list of instructions */ @@ -4145,7 +4145,7 @@ do_save(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) */ if (strlen(line) > 1 - && strncmp(line, "sa", 2) == 0) + && strncmp(line, "sa", 2) == 0) continue; fprintf(fp, "%s\n", line); @@ -4161,9 +4161,9 @@ do_save(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) int do_option(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) { - const struct dbg_option *opt; + const struct dbg_option *opt; char *name, *value; - + if (arg == NULL) { /* display all available options and corresponding values */ for (opt = option_list; opt->name; opt++) { if (opt->str_val != NULL) @@ -4198,7 +4198,7 @@ do_option(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) #ifdef HAVE_LIBREADLINE -/* initialize_pager --- initialize our idea of the terminal size */ +/* initialize_pager --- initialize our idea of the terminal size */ void initialize_pager(FILE *fp) @@ -4234,9 +4234,9 @@ prompt_continue(FILE *fp) if (quit_pager) longjmp(pager_quit_tag, 1); pager_lines_printed = 0; -} +} -/* gprintf --- like fprintf but allows paging */ +/* gprintf --- like fprintf but allows paging */ int gprintf(FILE *fp, const char *format, ...) @@ -4255,9 +4255,9 @@ gprintf(FILE *fp, const char *format, ...) } else if (buflen - bl < GPRINTF_BUFSIZ/2) { buflen += GPRINTF_BUFSIZ; erealloc(buf, char *, buflen * sizeof(char), "gprintf"); - } + } #undef GPRINTF_BUFSIZ - + while (true) { va_start(args, format); nchar = vsnprintf(buf + bl, buflen - bl, format, args); @@ -4271,14 +4271,14 @@ gprintf(FILE *fp, const char *format, ...) break; } - /* enlarge buffer, and try again */ + /* enlarge buffer, and try again */ buflen *= 2; erealloc(buf, char *, buflen * sizeof(char), "gprintf"); } bl = 0; for (p = buf; (q = strchr(p, '\n')) != NULL; p = q + 1) { - int sz = (int) (q - p); + int sz = (int) (q - p); while (sz > 0) { int cnt; @@ -4298,7 +4298,7 @@ gprintf(FILE *fp, const char *format, ...) sz -= screen_width; assert(sz > 0); p += cnt; - } + } } fprintf(fp, "\n"); @@ -4454,7 +4454,7 @@ enlarge_buffer: else nchar = snprintf(buf + bl, buflen - bl, "%d%c%d%c%s%c", wd->number, FSEP, D_variable, FSEP, wd->sname, FSEP); - cnum = wd->number; + cnum = wd->number; commands = &wd->commands; cndn = &wd->cndn; break; @@ -4545,8 +4545,8 @@ enlarge_buffer: buf[bl++] = FSEP; /* field */ buf[bl++] = RSEP; /* record */ buf[bl] = '\0'; - - /* condition expression */ + + /* condition expression */ if (cndn->expr) { bl--; /* undo RSEP from above */ nchar = strlen(cndn->expr); @@ -4574,7 +4574,7 @@ enlarge_buffer: break; default: break; - } + } } if (bl > 0) /* non-empty list */ @@ -4597,7 +4597,7 @@ unserialize_commands(char *str, int str_len) /* unserialize_list_item --- create a list_item structure from unserialized data */ - + static struct list_item * unserialize_list_item(struct list_item *list, char **pstr, int *pstr_len, int field_cnt) { @@ -4647,7 +4647,7 @@ unserialize_list_item(struct list_item *list, char **pstr, int *pstr_len, int fi l->subs = subs; } l->number = num; /* keep same item number across executions */ - + if (list == &watch_list) { initialize_watch_item(l); /* unserialize watchpoint `commands' */ @@ -4664,11 +4664,11 @@ unserialize_list_item(struct list_item *list, char **pstr, int *pstr_len, int fi } else list->number = num; - return l; + return l; } /* unserialize_breakpoint --- create a breakpoint structure from unserialized data */ - + static BREAKPOINT * unserialize_breakpoint(char **pstr, int *pstr_len, int field_cnt) { @@ -4703,7 +4703,7 @@ unserialize_breakpoint(char **pstr, int *pstr_len, int field_cnt) if (field_cnt > 6) /* unserialize breakpoint `commands' */ unserialize_commands(pstr[6], pstr_len[6]); - if (field_cnt > 7) { /* condition expression */ + if (field_cnt > 7) { /* condition expression */ char *expr; expr = estrdup(pstr[7], pstr_len[7]); if (parse_condition(D_break, b->number, expr) != 0) @@ -4771,7 +4771,7 @@ unserialize(int type) #ifdef GAWKDEBUG fatal("Increase MAX_FIELD and recompile.\n"); #else - return; + return; #endif } @@ -4861,7 +4861,7 @@ has_break_or_watch_point(int *pnum, bool any) /* N.B: breakpoints and watchpoints get numbers from a single * counter/sequencer watch_list.number. - */ + */ for (b = breakpoints.next; b != &breakpoints; b = b->next) { if (b->number == *pnum) @@ -4896,7 +4896,7 @@ do_commands(CMDARG *arg, int cmd) static struct list_item *w; static struct commands_item *commands; struct commands_item *c; - + if (cmd == D_commands) { int num = -1, type; if (arg == NULL) @@ -4944,7 +4944,7 @@ do_commands(CMDARG *arg, int cmd) c->next = NULL; c->cmd = cmd; - /* N.B.: first arg is the command string, see command.y */ + /* N.B.: first arg is the command string, see command.y */ c->cmd_string = arg->a_string; c->arg = arg->next; /* actual arguments to the command */ efree(arg); @@ -5041,7 +5041,7 @@ do_print_f(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) d_error(_("attempt to use array `%s[\"%s\"]' in a scalar context"), name, subs->stptr); goto done; - } else + } else tmp[i] = value; } else { if (value == NULL) { @@ -5059,7 +5059,7 @@ do_print_f(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) } } } - break; + break; case D_node: tmp[i] = a->a_node; break; @@ -5115,7 +5115,7 @@ static int open_readfd(const char *file) { int fd; - + fd = open(file, O_RDONLY); if (fd <= INVALID_HANDLE) return INVALID_HANDLE; @@ -5147,14 +5147,14 @@ find_option(char *name) void option_help() { - const struct dbg_option *opt; + const struct dbg_option *opt; for (opt = option_list; opt->name; opt++) fprintf(out_fp, "\t%-15.15s - %s\n", opt->name, _(opt->help_txt)); } #ifdef HAVE_LIBREADLINE - + /* option_generator --- generator function for option name completion */ char * @@ -5216,7 +5216,7 @@ set_gawk_output(const char *file) output_is_tty = os_isatty(fileno(stderr)); return; } - + if (strncmp(cp, "fd/", 3) == 0) { cp += 3; fd = (int) strtoul(cp, NULL, 10); @@ -5234,7 +5234,7 @@ set_gawk_output(const char *file) if (fd > INVALID_HANDLE && fp == NULL) { fp = fdopen(fd, "w"); if (fp == NULL) - close(fd); + close(fd); } } else { @@ -5265,7 +5265,7 @@ set_prompt(const char *value) dbg_prompt = dgawk_prompt; } -/* set_option_flag --- convert option string to flag value */ +/* set_option_flag --- convert option string to flag value */ static int set_option_flag(const char *value) @@ -5349,7 +5349,7 @@ read_commands_string(const char *prompt ATTRIBUTE_UNUSED) return NULL; p = (char *) commands_string; - end = (char *) commands_string + commands_string_len; + end = (char *) commands_string + commands_string_len; for (; p < end; p++) { if (*p == line_sep) { line = estrdup(commands_string, p - commands_string); @@ -5371,7 +5371,7 @@ static void save_options(const char *file) { FILE *fp; - const struct dbg_option *opt; + const struct dbg_option *opt; fp = fopen(file, "w"); if (fp == NULL) @@ -5410,7 +5410,7 @@ close_all() close_extensions(); - set_gawk_output(NULL); /* closes output_fp if not stdout */ + set_gawk_output(NULL); /* closes output_fp if not stdout */ } /* pre_execute_code --- pre_hook for execute_code, called by pre_execute */ @@ -5460,7 +5460,7 @@ execute_code(volatile INSTRUCTION *code) /* We use one global stack for all contexts. * Save # of items in stack; in case of * a fatal error, pop stack until it has that many items. - */ + */ save_stack_size = (stack_ptr - stack_bottom) + 1; do_flags = false; @@ -5496,13 +5496,13 @@ do_eval(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) int ret; int save_flags = do_flags; SRCFILE *the_source; - + if (prog_running) { this_frame = find_frame(0); this_func = this_frame->func_node; } - install_params(this_func); /* expose current function parameters to eval */ + install_params(this_func); /* expose current function parameters to eval */ ctxt = new_context(); ctxt->install_func = append_symbol; /* keep track of newly installed globals */ push_context(ctxt); @@ -5527,9 +5527,9 @@ do_eval(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) eval->func_name = NULL; /* not needed, func_body already assigned */ (eval + 1)->expr_count = 0; eval->nexti = bcalloc(Op_stop, 1, 0); - + } else { - /* execute as a part of the current function */ + /* execute as a part of the current function */ int i; INSTRUCTION *t; @@ -5542,7 +5542,7 @@ do_eval(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) /* add or append eval locals to the current frame stack */ ecount = f->param_cnt; /* eval local count */ pcount = this_func->param_cnt; - + if (ecount > 0) { if (pcount == 0) emalloc(this_frame->stack, NODE **, ecount * sizeof(NODE *), "do_eval"); @@ -5582,7 +5582,7 @@ do_eval(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) /* else fatal error */ - if (this_func != NULL && ecount > 0) { + if (this_func != NULL && ecount > 0) { int i; /* undo frame manipulation from above */ @@ -5637,7 +5637,7 @@ GDB Documentation: immediately for syntactic correctness, and to determine whether symbols in it have referents in the context of your breakpoint. If expression uses symbols not referenced in the context of the breakpoint, GDB prints -an error message: +an error message: No symbol "foo" in current context. */ @@ -5673,7 +5673,7 @@ parse_condition(int type, int num, char *expr) cndn = &b->cndn; rp = find_rule(b->src, b->bpi->source_line); if (rp != NULL && rp->opcode == Op_func) - this_func = rp->func_body; + this_func = rp->func_body; } else if (type == D_watch && (w = find_item(&watch_list, num)) != NULL) { cndn = &w->cndn; this_func = find_frame(cur_frame)->func_node; @@ -5693,7 +5693,7 @@ parse_condition(int type, int num, char *expr) do_flags = false; ret = parse_program(&code); do_flags = save_flags; - remove_params(this_func); + remove_params(this_func); pop_context(); if (ret != 0 || invalid_symbol) { @@ -5702,7 +5702,7 @@ parse_condition(int type, int num, char *expr) } /* condition expression is parsed as awk pattern without - * any action. The code is then modified to end up with + * any action. The code is then modified to end up with * a `1.0' on stack when the expression is true, `0.0' otherwise. */ @@ -5717,7 +5717,7 @@ parse_condition(int type, int num, char *expr) it->nexti = bcalloc(Op_jmp, 1, 0); it->nexti->target_jmp = stop; it->nexti->nexti = rule->lasti; - + it = rule->lasti; /* Op_no_op, target for Op_jmp_false */ assert(it->opcode == Op_no_op); it->opcode = Op_push_i; @@ -5795,13 +5795,13 @@ push_cmd_src( /* eof_status = EXIT_FATAL - exit with status EXIT_FATAL on EOF or error. * = EXIT_FAILURE - exit status EXIT_FAILURE on error. - * = EXIT_SUCCESS - don't exit on EOF or error. + * = EXIT_SUCCESS - don't exit on EOF or error. */ cs->eof_status = eofstatus; cs->str = NULL; cs->next = cmd_src; cmd_src = cs; - + input_fd = fd; input_from_tty = istty; read_a_line = readfunc; diff --git a/doc/ChangeLog b/doc/ChangeLog index f5743cb0..305fc8e4 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,8 @@ +2016-10-23 Arnold D. Robbins <arnold@skeeve.com> + + * gawktexi.in: Remove references to MS-DOS and OS/2, + simplify the whole section on PC operating systems. + 2016-10-02 Arnold D. Robbins <arnold@skeeve.com> * gawktexi.in (Bugs): Rework this section and break into diff --git a/doc/gawk.info b/doc/gawk.info index 3c68a117..1faa775c 100644 --- a/doc/gawk.info +++ b/doc/gawk.info @@ -624,14 +624,11 @@ in (a) below. A copy of the license is included in the section entitled * Configuration Philosophy:: How it's all supposed to work. * Non-Unix Installation:: Installation on Other Operating Systems. -* PC Installation:: Installing and Compiling - 'gawk' on MS-DOS and OS/2. +* PC Installation:: Installing and Compiling 'gawk' on + Microsoft Windows. * PC Binary Installation:: Installing a prepared distribution. -* PC Compiling:: Compiling 'gawk' for MS-DOS, - Windows32, and OS/2. -* PC Testing:: Testing 'gawk' on PC systems. -* PC Using:: Running 'gawk' on MS-DOS, - Windows32 and OS/2. +* PC Compiling:: Compiling 'gawk' for Windows32. +* PC Using:: Running 'gawk' on Windows32. * Cygwin:: Building and running 'gawk' for Cygwin. * MSYS:: Using 'gawk' In The MSYS @@ -869,8 +866,7 @@ different computing environments. This Info file, while describing the of 'awk' called 'gawk' (which stands for "GNU 'awk'"). 'gawk' runs on a broad range of Unix systems, ranging from Intel-architecture PC-based computers up through large-scale systems. 'gawk' has also been ported -to Mac OS X, Microsoft Windows (all versions) and OS/2 PCs, and -OpenVMS.(3) +to Mac OS X, Microsoft Windows (all versions), and OpenVMS.(3) * Menu: @@ -1515,8 +1511,7 @@ following command line: 'awk' applies the PROGRAM to the "standard input", which usually means whatever you type on the keyboard. This continues until you indicate end-of-file by typing 'Ctrl-d'. (On non-POSIX operating systems, the -end-of-file character may be different. For example, on OS/2, it is -'Ctrl-z'.) +end-of-file character may be different.) As an example, the following program prints a friendly piece of advice (from Douglas Adams's 'The Hitchhiker's Guide to the Galaxy'), to @@ -2961,7 +2956,7 @@ been found, and 'gawk' no longer needs to use 'AWKPATH'. ---------- Footnotes ---------- - (1) Semicolons on MS-Windows and MS-DOS. + (1) Semicolons on MS-Windows. (2) Your version of 'gawk' may use a different directory; it will depend upon how 'gawk' was built and installed. The actual directory is @@ -28091,8 +28086,8 @@ Various '.c', '.y', and '.h' files Files needed for building 'gawk' on POSIX-compliant systems. 'pc/*' - Files needed for building 'gawk' under MS-Windows and OS/2 (*note - PC Installation:: for details). + Files needed for building 'gawk' under MS-Windows (*note PC + Installation:: for details). 'vms/*' Files needed for building 'gawk' under Vax/VMS and OpenVMS (*note @@ -28311,35 +28306,27 @@ systems. * Menu: * PC Installation:: Installing and Compiling 'gawk' on - MS-DOS and OS/2. + Microsoft Windows. * VMS Installation:: Installing 'gawk' on VMS. File: gawk.info, Node: PC Installation, Next: VMS Installation, Up: Non-Unix Installation -B.3.1 Installation on PC Operating Systems ------------------------------------------- +B.3.1 Installation on MS-Windows +-------------------------------- This minor node covers installation and usage of 'gawk' on Intel -architecture machines running MS-DOS, any version of MS-Windows, or -OS/2. In this minor node, the term "Windows32" refers to any of -Microsoft Windows 95/98/ME/NT/2000/XP/Vista/7/8. +architecture machines running any version of MS-Windows. In this minor +node, the term "Windows32" refers to any of Microsoft Windows +95/98/ME/NT/2000/XP/Vista/7/8/10. - The limitations of MS-DOS (and MS-DOS shells under the other -operating systems) have meant that various "DOS extenders" are often -used with programs such as 'gawk'. The varying capabilities of -Microsoft Windows 3.1 and Windows32 can add to the confusion. For an -overview of the considerations, refer to 'README_d/README.pc' in the -distribution. + See also the 'README_d/README.pc' file in the distribution. * Menu: * PC Binary Installation:: Installing a prepared distribution. -* PC Compiling:: Compiling 'gawk' for MS-DOS, - Windows32, and OS/2. -* PC Testing:: Testing 'gawk' on PC systems. -* PC Using:: Running 'gawk' on MS-DOS, Windows32 - and OS/2. +* PC Compiling:: Compiling 'gawk' for Windows32. +* PC Using:: Running 'gawk' on Windows32. * Cygwin:: Building and running 'gawk' for Cygwin. * MSYS:: Using 'gawk' In The MSYS Environment. @@ -28347,59 +28334,31 @@ distribution. File: gawk.info, Node: PC Binary Installation, Next: PC Compiling, Up: PC Installation -B.3.1.1 Installing a Prepared Distribution for PC Systems -......................................................... - -If you have received a binary distribution prepared by the MS-DOS -maintainers, then 'gawk' and the necessary support files appear under -the 'gnu' directory, with executables in 'gnu/bin', libraries in -'gnu/lib/awk', and manual pages under 'gnu/man'. This is designed for -easy installation to a '/gnu' directory on your drive--however, the -files can be installed anywhere provided 'AWKPATH' is set properly. -Regardless of the installation directory, the first line of 'igawk.cmd' -and 'igawk.bat' (in 'gnu/bin') may need to be edited. - - The binary distribution contains a separate file describing the -contents. In particular, it may include more than one version of the -'gawk' executable. +B.3.1.1 Installing a Prepared Distribution for MS-Windows Systems +................................................................. - OS/2 (32 bit, EMX) binary distributions are prepared for the '/usr' -directory of your preferred drive. Set 'UNIXROOT' to your installation -drive (e.g., 'e:') if you want to install 'gawk' onto another drive than -the hardcoded default 'c:'. Executables appear in '/usr/bin', libraries -under '/usr/share/awk', manual pages under '/usr/man', Texinfo -documentation under '/usr/info', and NLS files under -'/usr/share/locale'. Note that the files can be installed anywhere -provided 'AWKPATH' is set properly. - - If you already have a file '/usr/info/dir' from another package _do -not overwrite it!_ Instead enter the following commands at your prompt -(replace 'x:' by your installation drive): - - install-info --info-dir=x:/usr/info x:/usr/info/gawk.info - install-info --info-dir=x:/usr/info x:/usr/info/gawkinet.info - - The binary distribution may contain a separate file containing -additional or more detailed installation instructions. +The only supported binary distribution for MS-Windows systems is that +provided by Eli Zaretskii's "ezwinports" +(https://sourceforge.net/projects/ezwinports/) project. Install the +compiled 'gawk' from there. -File: gawk.info, Node: PC Compiling, Next: PC Testing, Prev: PC Binary Installation, Up: PC Installation +File: gawk.info, Node: PC Compiling, Next: PC Using, Prev: PC Binary Installation, Up: PC Installation B.3.1.2 Compiling 'gawk' for PC Operating Systems ................................................. -'gawk' can be compiled for MS-DOS, Windows32, and OS/2 using MinGW -(Windows32) or Eberhard Mattes (EMX: MS-DOS, Windows32 and OS/2). The -file 'README_d/README.pc' in the 'gawk' distribution contains additional +'gawk' can be compiled for Windows32 using MinGW (Windows32). The file +'README_d/README.pc' in the 'gawk' distribution contains additional notes, and 'pc/Makefile' contains important information on compilation options. - To build 'gawk' for MS-DOS and Windows32, copy the files in the 'pc' -directory (_except_ for 'ChangeLog') to the directory with the rest of -the 'gawk' sources, then invoke 'make' with the appropriate target name -as an argument to build 'gawk'. The 'Makefile' copied from the 'pc' -directory contains a configuration section with comments and may need to -be edited in order to work with your 'make' utility. + To build 'gawk' for Windows32, copy the files in the 'pc' directory +(_except_ for 'ChangeLog') to the directory with the rest of the 'gawk' +sources, then invoke 'make' with the appropriate target name as an +argument to build 'gawk'. The 'Makefile' copied from the 'pc' directory +contains a configuration section with comments and may need to be edited +in order to work with your 'make' utility. The 'Makefile' supports a number of targets for building various MS-DOS and Windows32 versions. A list of targets is printed if the @@ -28407,120 +28366,25 @@ MS-DOS and Windows32 versions. A list of targets is printed if the native MS-Windows binary of 'gawk' using the MinGW tools, type 'make mingw32'. - The 32 bit EMX version of 'gawk' works "out of the box" under OS/2. -However, it is highly recommended to use GCC 2.95.3 for the compilation. -In principle, it is possible to compile 'gawk' the following way: - - $ ./configure - $ make - - This is not recommended, though. To get an OMF executable you should -use the following commands at your 'sh' prompt: - - $ CFLAGS="-O2 -Zomf -Zmt" - $ export CFLAGS - $ LDFLAGS="-s -Zcrtdll -Zlinker /exepack:2 -Zlinker /pm:vio -Zstack 0x6000" - $ export LDFLAGS - $ RANLIB="echo" - $ export RANLIB - $ ./configure --prefix=c:/usr - $ make AR=emxomfar - - These are just suggestions for use with GCC 2.x. You may use any -other set of (self-consistent) environment variables and compiler flags. - - If you use GCC 2.95 it is recommended to use also: - - $ LIBS="-lgcc" - $ export LIBS - - You can also get an 'a.out' executable if you prefer: - - $ CFLAGS="-O2 -Zmt" - $ export CFLAGS - $ LDFLAGS="-s -Zstack 0x6000" - $ LIBS="-lgcc" - $ unset RANLIB - $ ./configure --prefix=c:/usr - $ make - - NOTE: Compilation of 'a.out' executables also works with GCC 3.2. - Versions later than GCC 3.2 have not been tested successfully. - - 'make install' works as expected with the EMX build. - - NOTE: Ancient OS/2 ports of GNU 'make' are not able to handle the - Makefiles of this package. If you encounter any problems with - 'make', try GNU Make 3.79.1 or later versions. You should find the - latest version on <ftp://hobbes.nmsu.edu/pub/os2/>.(1) - - ---------- Footnotes ---------- - - (1) As of November 2014, this site is still there, but the author -could not find a package for GNU Make. - -File: gawk.info, Node: PC Testing, Next: PC Using, Prev: PC Compiling, Up: PC Installation - -B.3.1.3 Testing 'gawk' on PC Operating Systems -.............................................. +File: gawk.info, Node: PC Using, Next: Cygwin, Prev: PC Compiling, Up: PC Installation -Using 'make' to run the standard tests and to install 'gawk' requires -additional Unix-like tools, including 'sh', 'sed', and 'cp'. In order -to run the tests, the 'test/*.ok' files may need to be converted so that -they have the usual MS-DOS-style end-of-line markers. Alternatively, -run 'make check CMP="diff -a"' to use GNU 'diff' in text mode instead of -'cmp' to compare the resulting files. - - Most of the tests work properly with Stewartson's shell along with -the companion utilities or appropriate GNU utilities. However, some -editing of 'test/Makefile' is required. It is recommended that you copy -the file 'pc/Makefile.tst' over the file 'test/Makefile' as a -replacement. Details can be found in 'README_d/README.pc' and in the -file 'pc/Makefile.tst'. - - On OS/2 the 'pid' test fails because 'spawnl()' is used instead of -'fork()'/'execl()' to start child processes. Also the 'mbfw1' and -'mbprintf1' tests fail because the needed multibyte functionality is not -available. - - -File: gawk.info, Node: PC Using, Next: Cygwin, Prev: PC Testing, Up: PC Installation - -B.3.1.4 Using 'gawk' on PC Operating Systems +B.3.1.3 Using 'gawk' on PC Operating Systems ............................................ -Under MS-DOS and MS-Windows, the Cygwin and MinGW environments support -both the '|&' operator and TCP/IP networking (*note TCP/IP -Networking::). EMX (OS/2 only) supports at least the '|&' operator. +Under MS-Windows, the Cygwin and MinGW environments support both the +'|&' operator and TCP/IP networking (*note TCP/IP Networking::). - The MS-DOS and MS-Windows versions of 'gawk' search for program files -as described in *note AWKPATH Variable::. However, semicolons (rather -than colons) separate elements in the 'AWKPATH' variable. If 'AWKPATH' -is not set or is empty, then the default search path is + The MS-Windows version of 'gawk' searches for program files as +described in *note AWKPATH Variable::. However, semicolons (rather than +colons) separate elements in the 'AWKPATH' variable. If 'AWKPATH' is +not set or is empty, then the default search path is '.;c:/lib/awk;c:/gnu/lib/awk'. - The search path for OS/2 (32 bit, EMX) is determined by the prefix -directory (most likely '/usr' or 'c:/usr') that has been specified as an -option of the 'configure' script as is the case for the Unix versions. -If 'c:/usr' is the prefix directory then the default search path -contains '.' and 'c:/usr/share/awk'. Additionally, to support binary -distributions of 'gawk' for OS/2 systems whose drive 'c:' might not -support long file names or might not exist at all, there is a special -environment variable. If 'UNIXROOT' specifies a drive then this -specific drive is also searched for program files. E.g., if 'UNIXROOT' -is set to 'e:' the complete default search path is -'.;c:/usr/share/awk;e:/usr/share/awk'. - - An 'sh'-like shell (as opposed to 'command.com' under MS-DOS or -'cmd.exe' under MS-Windows or OS/2) may be useful for 'awk' programming. -The DJGPP collection of tools(1) includes an MS-DOS port of Bash, and -several shells are available for OS/2, including 'ksh'. - - Under MS-Windows, OS/2 and MS-DOS, 'gawk' (and many other text -programs) silently translates end-of-line '\r\n' to '\n' on input and -'\n' to '\r\n' on output. A special 'BINMODE' variable (c.e.) allows -control over these translations and is interpreted as follows: + Under MS-Windows, 'gawk' (and many other text programs) silently +translates end-of-line '\r\n' to '\n' on input and '\n' to '\r\n' on +output. A special 'BINMODE' variable (c.e.) allows control over these +translations and is interpreted as follows: * If 'BINMODE' is '"r"' or one, then binary mode is set on read (i.e., no translations on reads). @@ -28576,14 +28440,10 @@ or: With proper quoting, in the first example the setting of 'RS' can be moved into the 'BEGIN' rule. - ---------- Footnotes ---------- - - (1) Available from <ftp://ftp.delorie.com/pub/djgpp/current/v2gnu/>. - File: gawk.info, Node: Cygwin, Next: MSYS, Prev: PC Using, Up: PC Installation -B.3.1.5 Using 'gawk' In The Cygwin Environment +B.3.1.4 Using 'gawk' In The Cygwin Environment .............................................. 'gawk' can be built and used "out of the box" under MS-Windows if you @@ -28604,7 +28464,7 @@ the 'make' proceeds as usual. File: gawk.info, Node: MSYS, Prev: Cygwin, Up: PC Installation -B.3.1.6 Using 'gawk' In The MSYS Environment +B.3.1.5 Using 'gawk' In The MSYS Environment ............................................ In the MSYS environment under MS-Windows, 'gawk' automatically uses @@ -29211,9 +29071,9 @@ B.6 Summary ./configure && make && make check * 'gawk' may be built on non-POSIX systems as well. The currently - supported systems are MS-Windows using MSYS, MinGW, and Cygwin, - OS/2 using EMX, and both Vax/VMS and OpenVMS. Instructions for each - system are included in this major node. + supported systems are MS-Windows using MSYS, MinGW, and Cygwin, and + both Vax/VMS and OpenVMS. Instructions for each system are included + in this major node. * Bug reports should be sent via email to <bug-gawk@gnu.org>. Bug reports should be in English and should include the version of @@ -32362,7 +32222,7 @@ Index * /inet/... special files (gawk): TCP/IP Networking. (line 6) * /inet4/... special files (gawk): TCP/IP Networking. (line 6) * /inet6/... special files (gawk): TCP/IP Networking. (line 6) -* ; (semicolon), AWKPATH variable and: PC Using. (line 10) +* ; (semicolon), AWKPATH variable and: PC Using. (line 9) * ; (semicolon), separating statements in actions: Statements/Lines. (line 90) * ; (semicolon), separating statements in actions <1>: Action Overview. @@ -32657,7 +32517,7 @@ Index * awk programs, running: Running gawk. (line 6) * awk programs, running <1>: Long. (line 6) * awk programs, running, from shell scripts: One-shot. (line 22) -* awk programs, running, without input files: Read Terminal. (line 17) +* awk programs, running, without input files: Read Terminal. (line 16) * awk programs, shell variables in: Using Shell Variables. (line 6) * awk, function of: Getting Started. (line 6) @@ -32690,7 +32550,7 @@ Index * awka compiler for awk: Other Versions. (line 68) * AWKLIBPATH environment variable: AWKLIBPATH Variable. (line 6) * AWKPATH environment variable: AWKPATH Variable. (line 6) -* AWKPATH environment variable <1>: PC Using. (line 10) +* AWKPATH environment variable <1>: PC Using. (line 9) * awkprof.out file: Profiling. (line 6) * awksed.awk program: Simple Sed. (line 25) * awkvars.out file: Options. (line 94) @@ -32784,7 +32644,7 @@ Index * bindtextdomain() function (gawk), portability and: I18N Portability. (line 33) * BINMODE variable: User-modified. (line 15) -* BINMODE variable <1>: PC Using. (line 35) +* BINMODE variable <1>: PC Using. (line 16) * bit-manipulation functions: Bitwise Functions. (line 6) * bits2str() user-defined function: Bitwise Functions. (line 72) * bitwise AND: Bitwise Functions. (line 40) @@ -32965,7 +32825,7 @@ Index * common extensions, /dev/stderr special file: Special FD. (line 48) * common extensions, /dev/stdin special file: Special FD. (line 48) * common extensions, /dev/stdout special file: Special FD. (line 48) -* common extensions, BINMODE variable: PC Using. (line 35) +* common extensions, BINMODE variable: PC Using. (line 16) * common extensions, delete to delete entire arrays: Delete. (line 39) * common extensions, func keyword: Definition Syntax. (line 99) * common extensions, length() applied to an array: String Functions. @@ -32990,9 +32850,8 @@ Index * compiled programs: Basic High Level. (line 13) * compiled programs <1>: Glossary. (line 218) * compiling gawk for Cygwin: Cygwin. (line 6) -* compiling gawk for MS-DOS and MS-Windows: PC Compiling. (line 12) +* compiling gawk for MS-Windows: PC Compiling. (line 11) * compiling gawk for VMS: VMS Compilation. (line 6) -* compiling gawk with EMX for OS/2: PC Compiling. (line 25) * compl: Bitwise Functions. (line 44) * complement, bitwise: Bitwise Functions. (line 25) * compound statements, control statements and: Statements. (line 10) @@ -33266,7 +33125,7 @@ Index * differences in awk and gawk, BINMODE variable: User-modified. (line 15) * differences in awk and gawk, BINMODE variable <1>: PC Using. - (line 35) + (line 16) * differences in awk and gawk, close() function: Close Files And Pipes. (line 81) * differences in awk and gawk, close() function <1>: Close Files And Pipes. @@ -33499,7 +33358,7 @@ Index * extensions, common, /dev/stderr special file: Special FD. (line 48) * extensions, common, /dev/stdin special file: Special FD. (line 48) * extensions, common, /dev/stdout special file: Special FD. (line 48) -* extensions, common, BINMODE variable: PC Using. (line 35) +* extensions, common, BINMODE variable: PC Using. (line 16) * extensions, common, delete to delete entire arrays: Delete. (line 39) * extensions, common, fflush() function: I/O Functions. (line 43) * extensions, common, func keyword: Definition Syntax. (line 99) @@ -33589,7 +33448,7 @@ Index * files, descriptors, See file descriptors: Special FD. (line 6) * files, group: Group Functions. (line 6) * files, initialization and cleanup: Filetrans Function. (line 6) -* files, input, See input files: Read Terminal. (line 17) +* files, input, See input files: Read Terminal. (line 16) * files, log, timestamps in: Time Functions. (line 6) * files, managing: Data File Management. (line 6) @@ -33800,11 +33659,9 @@ Index * gawk, line continuation in: Conditional Exp. (line 34) * gawk, LINT variable in: User-modified. (line 87) * gawk, list of contributors to: Contributors. (line 6) -* gawk, MS-DOS version of: PC Using. (line 10) -* gawk, MS-Windows version of: PC Using. (line 10) +* gawk, MS-Windows version of: PC Using. (line 9) * gawk, newlines in: Statements/Lines. (line 12) * gawk, octal numbers and: Nondecimal-numbers. (line 41) -* gawk, OS/2 version of: PC Using. (line 17) * gawk, predefined variables and: Built-in Variables. (line 14) * gawk, PROCINFO array in: Auto-set. (line 148) * gawk, PROCINFO array in <1>: Time Functions. (line 47) @@ -34003,7 +33860,7 @@ Index * input files, examples: Sample Data Files. (line 6) * input files, reading: Reading Files. (line 6) * input files, running awk without: Read Terminal. (line 6) -* input files, running awk without <1>: Read Terminal. (line 17) +* input files, running awk without <1>: Read Terminal. (line 16) * input files, variable assignments and: Other Arguments. (line 26) * input pipeline: Getline/Pipe. (line 10) * input record, length of: String Functions. (line 177) @@ -34812,12 +34669,12 @@ Index * search and replace in strings: String Functions. (line 89) * search in string: String Functions. (line 155) * search paths: Programs Exercises. (line 70) -* search paths <1>: PC Using. (line 10) +* search paths <1>: PC Using. (line 9) * search paths <2>: VMS Running. (line 57) * search paths, for loadable extensions: AWKLIBPATH Variable. (line 6) * search paths, for source files: AWKPATH Variable. (line 6) * search paths, for source files <1>: Programs Exercises. (line 70) -* search paths, for source files <2>: PC Using. (line 10) +* search paths, for source files <2>: PC Using. (line 9) * search paths, for source files <3>: VMS Running. (line 57) * searching, files for regular expressions: Egrep Program. (line 6) * searching, for words: Dupword Program. (line 6) @@ -34825,7 +34682,7 @@ Index * sed utility <1>: Simple Sed. (line 6) * sed utility <2>: Glossary. (line 16) * seeding random number generator: Numeric Functions. (line 79) -* semicolon (;), AWKPATH variable and: PC Using. (line 10) +* semicolon (;), AWKPATH variable and: PC Using. (line 9) * semicolon (;), separating statements in actions: Statements/Lines. (line 90) * semicolon (;), separating statements in actions <1>: Action Overview. @@ -35189,7 +35046,6 @@ Index * Unix awk, password files, field separators and: Command Line Field Separator. (line 62) * Unix, awk scripts and: Executable Scripts. (line 6) -* UNIXROOT variable, on OS/2 systems: PC Using. (line 17) * unsigned integers: Computer Arithmetic. (line 41) * until debugger command: Debugger Execution Control. (line 82) @@ -35308,573 +35164,570 @@ Index Tag Table: Node: Top1200 -Node: Foreword342713 -Node: Foreword447155 -Node: Preface48687 -Ref: Preface-Footnote-151559 -Ref: Preface-Footnote-251666 -Ref: Preface-Footnote-351900 -Node: History52042 -Node: Names54394 -Ref: Names-Footnote-155488 -Node: This Manual55635 -Ref: This Manual-Footnote-162120 -Node: Conventions62220 -Node: Manual History64574 -Ref: Manual History-Footnote-167569 -Ref: Manual History-Footnote-267610 -Node: How To Contribute67684 -Node: Acknowledgments68813 -Node: Getting Started73699 -Node: Running gawk76138 -Node: One-shot77328 -Node: Read Terminal78591 -Node: Long80623 -Node: Executable Scripts82136 -Ref: Executable Scripts-Footnote-184931 -Node: Comments85034 -Node: Quoting87518 -Node: DOS Quoting93035 -Node: Sample Data Files93710 -Node: Very Simple96305 -Node: Two Rules101207 -Node: More Complex103092 -Node: Statements/Lines105958 -Ref: Statements/Lines-Footnote-1110417 -Node: Other Features110682 -Node: When111618 -Ref: When-Footnote-1113372 -Node: Intro Summary113437 -Node: Invoking Gawk114321 -Node: Command Line115835 -Node: Options116633 -Ref: Options-Footnote-1132732 -Ref: Options-Footnote-2132962 -Node: Other Arguments132987 -Node: Naming Standard Input135934 -Node: Environment Variables137027 -Node: AWKPATH Variable137585 -Ref: AWKPATH Variable-Footnote-1140996 -Ref: AWKPATH Variable-Footnote-2141041 -Node: AWKLIBPATH Variable141302 -Node: Other Environment Variables142559 -Node: Exit Status146380 -Node: Include Files147057 -Node: Loading Shared Libraries150652 -Node: Obsolete152080 -Node: Undocumented152772 -Node: Invoking Summary153069 -Node: Regexp154729 -Node: Regexp Usage156248 -Node: Escape Sequences158285 -Node: Regexp Operators164517 -Ref: Regexp Operators-Footnote-1171933 -Ref: Regexp Operators-Footnote-2172080 -Node: Bracket Expressions172178 -Ref: table-char-classes174654 -Node: Leftmost Longest177791 -Node: Computed Regexps179094 -Node: GNU Regexp Operators182521 -Node: Case-sensitivity186200 -Ref: Case-sensitivity-Footnote-1189096 -Ref: Case-sensitivity-Footnote-2189331 -Node: Strong Regexp Constants189439 -Node: Regexp Summary190228 -Node: Reading Files191703 -Node: Records193866 -Node: awk split records194599 -Node: gawk split records199530 -Ref: gawk split records-Footnote-1204070 -Node: Fields204107 -Node: Nonconstant Fields206848 -Ref: Nonconstant Fields-Footnote-1209084 -Node: Changing Fields209288 -Node: Field Separators215216 -Node: Default Field Splitting217914 -Node: Regexp Field Splitting219032 -Node: Single Character Fields222385 -Node: Command Line Field Separator223445 -Node: Full Line Fields226663 -Ref: Full Line Fields-Footnote-1228185 -Ref: Full Line Fields-Footnote-2228231 -Node: Field Splitting Summary228332 -Node: Constant Size230406 -Node: Splitting By Content234984 -Ref: Splitting By Content-Footnote-1238955 -Node: Multiple Line239118 -Ref: Multiple Line-Footnote-1245000 -Node: Getline245179 -Node: Plain Getline247646 -Node: Getline/Variable250285 -Node: Getline/File251434 -Node: Getline/Variable/File252820 -Ref: Getline/Variable/File-Footnote-1254423 -Node: Getline/Pipe254511 -Node: Getline/Variable/Pipe257216 -Node: Getline/Coprocess258349 -Node: Getline/Variable/Coprocess259614 -Node: Getline Notes260354 -Node: Getline Summary263149 -Ref: table-getline-variants263571 -Node: Read Timeout264319 -Ref: Read Timeout-Footnote-1268225 -Node: Retrying Input268283 -Node: Command-line directories269482 -Node: Input Summary270388 -Node: Input Exercises273560 -Node: Printing274288 -Node: Print276122 -Node: Print Examples277579 -Node: Output Separators280359 -Node: OFMT282376 -Node: Printf283732 -Node: Basic Printf284517 -Node: Control Letters286091 -Node: Format Modifiers290079 -Node: Printf Examples296094 -Node: Redirection298580 -Node: Special FD305421 -Ref: Special FD-Footnote-1308589 -Node: Special Files308663 -Node: Other Inherited Files309280 -Node: Special Network310281 -Node: Special Caveats311141 -Node: Close Files And Pipes312090 -Ref: table-close-pipe-return-values318997 -Ref: Close Files And Pipes-Footnote-1319780 -Ref: Close Files And Pipes-Footnote-2319928 -Node: Nonfatal320080 -Node: Output Summary322405 -Node: Output Exercises323627 -Node: Expressions324306 -Node: Values325494 -Node: Constants326172 -Node: Scalar Constants326863 -Ref: Scalar Constants-Footnote-1327727 -Node: Nondecimal-numbers327977 -Node: Regexp Constants330990 -Node: Using Constant Regexps331516 -Node: Variables334679 -Node: Using Variables335336 -Node: Assignment Options337246 -Node: Conversion339119 -Node: Strings And Numbers339643 -Ref: Strings And Numbers-Footnote-1342706 -Node: Locale influences conversions342815 -Ref: table-locale-affects345573 -Node: All Operators346191 -Node: Arithmetic Ops346820 -Node: Concatenation349326 -Ref: Concatenation-Footnote-1352173 -Node: Assignment Ops352280 -Ref: table-assign-ops357271 -Node: Increment Ops358584 -Node: Truth Values and Conditions362044 -Node: Truth Values363118 -Node: Typing and Comparison364166 -Node: Variable Typing364986 -Node: Comparison Operators368610 -Ref: table-relational-ops369029 -Node: POSIX String Comparison372524 -Ref: POSIX String Comparison-Footnote-1374219 -Ref: POSIX String Comparison-Footnote-2374358 -Node: Boolean Ops374442 -Ref: Boolean Ops-Footnote-1378924 -Node: Conditional Exp379016 -Node: Function Calls380752 -Node: Precedence384629 -Node: Locales388288 -Node: Expressions Summary389920 -Node: Patterns and Actions392493 -Node: Pattern Overview393613 -Node: Regexp Patterns395290 -Node: Expression Patterns395832 -Node: Ranges399613 -Node: BEGIN/END402721 -Node: Using BEGIN/END403482 -Ref: Using BEGIN/END-Footnote-1406218 -Node: I/O And BEGIN/END406324 -Node: BEGINFILE/ENDFILE408638 -Node: Empty411545 -Node: Using Shell Variables411862 -Node: Action Overview414136 -Node: Statements416461 -Node: If Statement418309 -Node: While Statement419804 -Node: Do Statement421832 -Node: For Statement422980 -Node: Switch Statement426138 -Node: Break Statement428524 -Node: Continue Statement430616 -Node: Next Statement432443 -Node: Nextfile Statement434826 -Node: Exit Statement437478 -Node: Built-in Variables439881 -Node: User-modified441014 -Node: Auto-set448600 -Ref: Auto-set-Footnote-1463253 -Ref: Auto-set-Footnote-2463459 -Node: ARGC and ARGV463515 -Node: Pattern Action Summary467728 -Node: Arrays470158 -Node: Array Basics471487 -Node: Array Intro472331 -Ref: figure-array-elements474306 -Ref: Array Intro-Footnote-1477010 -Node: Reference to Elements477138 -Node: Assigning Elements479602 -Node: Array Example480093 -Node: Scanning an Array481852 -Node: Controlling Scanning484874 -Ref: Controlling Scanning-Footnote-1490273 -Node: Numeric Array Subscripts490589 -Node: Uninitialized Subscripts492773 -Node: Delete494392 -Ref: Delete-Footnote-1497144 -Node: Multidimensional497201 -Node: Multiscanning500296 -Node: Arrays of Arrays501887 -Node: Arrays Summary506654 -Node: Functions508747 -Node: Built-in509785 -Node: Calling Built-in510866 -Node: Numeric Functions512862 -Ref: Numeric Functions-Footnote-1517695 -Ref: Numeric Functions-Footnote-2518052 -Ref: Numeric Functions-Footnote-3518100 -Node: String Functions518372 -Ref: String Functions-Footnote-1541876 -Ref: String Functions-Footnote-2542004 -Ref: String Functions-Footnote-3542252 -Node: Gory Details542339 -Ref: table-sub-escapes544130 -Ref: table-sub-proposed545649 -Ref: table-posix-sub547012 -Ref: table-gensub-escapes548553 -Ref: Gory Details-Footnote-1549376 -Node: I/O Functions549530 -Ref: table-system-return-values556112 -Ref: I/O Functions-Footnote-1558092 -Ref: I/O Functions-Footnote-2558240 -Node: Time Functions558360 -Ref: Time Functions-Footnote-1568882 -Ref: Time Functions-Footnote-2568950 -Ref: Time Functions-Footnote-3569108 -Ref: Time Functions-Footnote-4569219 -Ref: Time Functions-Footnote-5569331 -Ref: Time Functions-Footnote-6569558 -Node: Bitwise Functions569824 -Ref: table-bitwise-ops570418 -Ref: Bitwise Functions-Footnote-1574756 -Node: Type Functions574929 -Node: I18N Functions577461 -Node: User-defined579112 -Node: Definition Syntax579917 -Ref: Definition Syntax-Footnote-1585604 -Node: Function Example585675 -Ref: Function Example-Footnote-1588597 -Node: Function Caveats588619 -Node: Calling A Function589137 -Node: Variable Scope590095 -Node: Pass By Value/Reference593089 -Node: Return Statement596588 -Node: Dynamic Typing599567 -Node: Indirect Calls600497 -Ref: Indirect Calls-Footnote-1610748 -Node: Functions Summary610876 -Node: Library Functions613581 -Ref: Library Functions-Footnote-1617188 -Ref: Library Functions-Footnote-2617331 -Node: Library Names617502 -Ref: Library Names-Footnote-1620962 -Ref: Library Names-Footnote-2621185 -Node: General Functions621271 -Node: Strtonum Function622374 -Node: Assert Function625396 -Node: Round Function628722 -Node: Cliff Random Function630263 -Node: Ordinal Functions631279 -Ref: Ordinal Functions-Footnote-1634342 -Ref: Ordinal Functions-Footnote-2634594 -Node: Join Function634804 -Ref: Join Function-Footnote-1636574 -Node: Getlocaltime Function636774 -Node: Readfile Function640516 -Node: Shell Quoting642488 -Node: Data File Management643889 -Node: Filetrans Function644521 -Node: Rewind Function648617 -Node: File Checking650523 -Ref: File Checking-Footnote-1651857 -Node: Empty Files652058 -Node: Ignoring Assigns654037 -Node: Getopt Function655587 -Ref: Getopt Function-Footnote-1667056 -Node: Passwd Functions667256 -Ref: Passwd Functions-Footnote-1676095 -Node: Group Functions676183 -Ref: Group Functions-Footnote-1684081 -Node: Walking Arrays684288 -Node: Library Functions Summary687296 -Node: Library Exercises688702 -Node: Sample Programs689167 -Node: Running Examples689937 -Node: Clones690665 -Node: Cut Program691889 -Node: Egrep Program701818 -Ref: Egrep Program-Footnote-1709330 -Node: Id Program709440 -Node: Split Program713120 -Ref: Split Program-Footnote-1716579 -Node: Tee Program716708 -Node: Uniq Program719498 -Node: Wc Program726924 -Ref: Wc Program-Footnote-1731179 -Node: Miscellaneous Programs731273 -Node: Dupword Program732486 -Node: Alarm Program734516 -Node: Translate Program739371 -Ref: Translate Program-Footnote-1743936 -Node: Labels Program744206 -Ref: Labels Program-Footnote-1747557 -Node: Word Sorting747641 -Node: History Sorting751713 -Node: Extract Program753548 -Node: Simple Sed761077 -Node: Igawk Program764151 -Ref: Igawk Program-Footnote-1778482 -Ref: Igawk Program-Footnote-2778684 -Ref: Igawk Program-Footnote-3778806 -Node: Anagram Program778921 -Node: Signature Program781983 -Node: Programs Summary783230 -Node: Programs Exercises784444 -Ref: Programs Exercises-Footnote-1788573 -Node: Advanced Features788664 -Node: Nondecimal Data790654 -Node: Array Sorting792245 -Node: Controlling Array Traversal792945 -Ref: Controlling Array Traversal-Footnote-1801312 -Node: Array Sorting Functions801430 -Ref: Array Sorting Functions-Footnote-1806521 -Node: Two-way I/O806717 -Ref: Two-way I/O-Footnote-1813267 -Ref: Two-way I/O-Footnote-2813454 -Node: TCP/IP Networking813536 -Node: Profiling816654 -Ref: Profiling-Footnote-1825147 -Node: Advanced Features Summary825470 -Node: Internationalization827314 -Node: I18N and L10N828794 -Node: Explaining gettext829481 -Ref: Explaining gettext-Footnote-1835373 -Ref: Explaining gettext-Footnote-2835558 -Node: Programmer i18n835723 -Ref: Programmer i18n-Footnote-1840578 -Node: Translator i18n840627 -Node: String Extraction841421 -Ref: String Extraction-Footnote-1842553 -Node: Printf Ordering842639 -Ref: Printf Ordering-Footnote-1845425 -Node: I18N Portability845489 -Ref: I18N Portability-Footnote-1847945 -Node: I18N Example848008 -Ref: I18N Example-Footnote-1850814 -Node: Gawk I18N850887 -Node: I18N Summary851532 -Node: Debugger852873 -Node: Debugging853895 -Node: Debugging Concepts854336 -Node: Debugging Terms856145 -Node: Awk Debugging858720 -Node: Sample Debugging Session859626 -Node: Debugger Invocation860160 -Node: Finding The Bug861546 -Node: List of Debugger Commands868024 -Node: Breakpoint Control869357 -Node: Debugger Execution Control873051 -Node: Viewing And Changing Data876413 -Node: Execution Stack879787 -Node: Debugger Info881424 -Node: Miscellaneous Debugger Commands885495 -Node: Readline Support890583 -Node: Limitations891479 -Ref: Limitations-Footnote-1895710 -Node: Debugging Summary895761 -Node: Arbitrary Precision Arithmetic897040 -Node: Computer Arithmetic898456 -Ref: table-numeric-ranges902047 -Ref: Computer Arithmetic-Footnote-1902769 -Node: Math Definitions902826 -Ref: table-ieee-formats906140 -Ref: Math Definitions-Footnote-1906743 -Node: MPFR features906848 -Node: FP Math Caution908565 -Ref: FP Math Caution-Footnote-1909637 -Node: Inexactness of computations910006 -Node: Inexact representation910966 -Node: Comparing FP Values912326 -Node: Errors accumulate913408 -Node: Getting Accuracy914841 -Node: Try To Round917551 -Node: Setting precision918450 -Ref: table-predefined-precision-strings919147 -Node: Setting the rounding mode920977 -Ref: table-gawk-rounding-modes921351 -Ref: Setting the rounding mode-Footnote-1924759 -Node: Arbitrary Precision Integers924938 -Ref: Arbitrary Precision Integers-Footnote-1929855 -Node: POSIX Floating Point Problems930004 -Ref: POSIX Floating Point Problems-Footnote-1933886 -Node: Floating point summary933924 -Node: Dynamic Extensions936114 -Node: Extension Intro937667 -Node: Plugin License938933 -Node: Extension Mechanism Outline939730 -Ref: figure-load-extension940169 -Ref: figure-register-new-function941734 -Ref: figure-call-new-function942826 -Node: Extension API Description944888 -Node: Extension API Functions Introduction946420 -Node: General Data Types951279 -Ref: General Data Types-Footnote-1957234 -Node: Memory Allocation Functions957533 -Ref: Memory Allocation Functions-Footnote-1960378 -Node: Constructor Functions960477 -Node: Registration Functions962222 -Node: Extension Functions962907 -Node: Exit Callback Functions965530 -Node: Extension Version String966780 -Node: Input Parsers967443 -Node: Output Wrappers977325 -Node: Two-way processors981837 -Node: Printing Messages984102 -Ref: Printing Messages-Footnote-1985273 -Node: Updating ERRNO985426 -Node: Requesting Values986165 -Ref: table-value-types-returned986902 -Node: Accessing Parameters987785 -Node: Symbol Table Access989020 -Node: Symbol table by name989532 -Node: Symbol table by cookie991553 -Ref: Symbol table by cookie-Footnote-1995705 -Node: Cached values995769 -Ref: Cached values-Footnote-1999276 -Node: Array Manipulation999367 -Ref: Array Manipulation-Footnote-11000458 -Node: Array Data Types1000495 -Ref: Array Data Types-Footnote-11003153 -Node: Array Functions1003245 -Node: Flattening Arrays1007103 -Node: Creating Arrays1014011 -Node: Redirection API1018780 -Node: Extension API Variables1021611 -Node: Extension Versioning1022244 -Ref: gawk-api-version1022681 -Node: Extension API Informational Variables1024437 -Node: Extension API Boilerplate1025501 -Node: Finding Extensions1029315 -Node: Extension Example1029874 -Node: Internal File Description1030672 -Node: Internal File Ops1034752 -Ref: Internal File Ops-Footnote-11046514 -Node: Using Internal File Ops1046654 -Ref: Using Internal File Ops-Footnote-11049037 -Node: Extension Samples1049311 -Node: Extension Sample File Functions1050840 -Node: Extension Sample Fnmatch1058489 -Node: Extension Sample Fork1059976 -Node: Extension Sample Inplace1061194 -Node: Extension Sample Ord1064404 -Node: Extension Sample Readdir1065240 -Ref: table-readdir-file-types1066129 -Node: Extension Sample Revout1066934 -Node: Extension Sample Rev2way1067523 -Node: Extension Sample Read write array1068263 -Node: Extension Sample Readfile1070205 -Node: Extension Sample Time1071300 -Node: Extension Sample API Tests1072648 -Node: gawkextlib1073140 -Node: Extension summary1075587 -Node: Extension Exercises1079289 -Node: Language History1080787 -Node: V7/SVR3.11082443 -Node: SVR41084595 -Node: POSIX1086029 -Node: BTL1087408 -Node: POSIX/GNU1088137 -Node: Feature History1093999 -Node: Common Extensions1108369 -Node: Ranges and Locales1109652 -Ref: Ranges and Locales-Footnote-11114268 -Ref: Ranges and Locales-Footnote-21114295 -Ref: Ranges and Locales-Footnote-31114530 -Node: Contributors1114751 -Node: History summary1120311 -Node: Installation1121691 -Node: Gawk Distribution1122635 -Node: Getting1123119 -Node: Extracting1124080 -Node: Distribution contents1125718 -Node: Unix Installation1131812 -Node: Quick Installation1132494 -Node: Shell Startup Files1134908 -Node: Additional Configuration Options1135986 -Node: Configuration Philosophy1137791 -Node: Non-Unix Installation1140160 -Node: PC Installation1140618 -Node: PC Binary Installation1141938 -Node: PC Compiling1143790 -Ref: PC Compiling-Footnote-11146584 -Node: PC Testing1146693 -Node: PC Using1147873 -Ref: PC Using-Footnote-11152026 -Node: Cygwin1152099 -Node: MSYS1152869 -Node: VMS Installation1153370 -Node: VMS Compilation1154161 -Ref: VMS Compilation-Footnote-11155390 -Node: VMS Dynamic Extensions1155448 -Node: VMS Installation Details1157133 -Node: VMS Running1159386 -Node: VMS GNV1163665 -Node: VMS Old Gawk1164400 -Node: Bugs1164871 -Node: Bug address1165534 -Node: Usenet1167931 -Node: Maintainers1168706 -Node: Other Versions1170082 -Node: Installation summary1176666 -Node: Notes1177717 -Node: Compatibility Mode1178582 -Node: Additions1179364 -Node: Accessing The Source1180289 -Node: Adding Code1181724 -Node: New Ports1187943 -Node: Derived Files1192431 -Ref: Derived Files-Footnote-11197916 -Ref: Derived Files-Footnote-21197951 -Ref: Derived Files-Footnote-31198549 -Node: Future Extensions1198663 -Node: Implementation Limitations1199321 -Node: Extension Design1200504 -Node: Old Extension Problems1201658 -Ref: Old Extension Problems-Footnote-11203176 -Node: Extension New Mechanism Goals1203233 -Ref: Extension New Mechanism Goals-Footnote-11206597 -Node: Extension Other Design Decisions1206786 -Node: Extension Future Growth1208899 -Node: Old Extension Mechanism1209735 -Node: Notes summary1211498 -Node: Basic Concepts1212680 -Node: Basic High Level1213361 -Ref: figure-general-flow1213643 -Ref: figure-process-flow1214328 -Ref: Basic High Level-Footnote-11217629 -Node: Basic Data Typing1217814 -Node: Glossary1221142 -Node: Copying1253089 -Node: GNU Free Documentation License1290628 -Node: Index1315746 +Node: Foreword342530 +Node: Foreword446972 +Node: Preface48504 +Ref: Preface-Footnote-151363 +Ref: Preface-Footnote-251470 +Ref: Preface-Footnote-351704 +Node: History51846 +Node: Names54198 +Ref: Names-Footnote-155292 +Node: This Manual55439 +Ref: This Manual-Footnote-161924 +Node: Conventions62024 +Node: Manual History64378 +Ref: Manual History-Footnote-167373 +Ref: Manual History-Footnote-267414 +Node: How To Contribute67488 +Node: Acknowledgments68617 +Node: Getting Started73503 +Node: Running gawk75942 +Node: One-shot77132 +Node: Read Terminal78395 +Node: Long80388 +Node: Executable Scripts81901 +Ref: Executable Scripts-Footnote-184696 +Node: Comments84799 +Node: Quoting87283 +Node: DOS Quoting92800 +Node: Sample Data Files93475 +Node: Very Simple96070 +Node: Two Rules100972 +Node: More Complex102857 +Node: Statements/Lines105723 +Ref: Statements/Lines-Footnote-1110182 +Node: Other Features110447 +Node: When111383 +Ref: When-Footnote-1113137 +Node: Intro Summary113202 +Node: Invoking Gawk114086 +Node: Command Line115600 +Node: Options116398 +Ref: Options-Footnote-1132497 +Ref: Options-Footnote-2132727 +Node: Other Arguments132752 +Node: Naming Standard Input135699 +Node: Environment Variables136792 +Node: AWKPATH Variable137350 +Ref: AWKPATH Variable-Footnote-1140761 +Ref: AWKPATH Variable-Footnote-2140795 +Node: AWKLIBPATH Variable141056 +Node: Other Environment Variables142313 +Node: Exit Status146134 +Node: Include Files146811 +Node: Loading Shared Libraries150406 +Node: Obsolete151834 +Node: Undocumented152526 +Node: Invoking Summary152823 +Node: Regexp154483 +Node: Regexp Usage156002 +Node: Escape Sequences158039 +Node: Regexp Operators164271 +Ref: Regexp Operators-Footnote-1171687 +Ref: Regexp Operators-Footnote-2171834 +Node: Bracket Expressions171932 +Ref: table-char-classes174408 +Node: Leftmost Longest177545 +Node: Computed Regexps178848 +Node: GNU Regexp Operators182275 +Node: Case-sensitivity185954 +Ref: Case-sensitivity-Footnote-1188850 +Ref: Case-sensitivity-Footnote-2189085 +Node: Strong Regexp Constants189193 +Node: Regexp Summary189982 +Node: Reading Files191457 +Node: Records193620 +Node: awk split records194353 +Node: gawk split records199284 +Ref: gawk split records-Footnote-1203824 +Node: Fields203861 +Node: Nonconstant Fields206602 +Ref: Nonconstant Fields-Footnote-1208838 +Node: Changing Fields209042 +Node: Field Separators214970 +Node: Default Field Splitting217668 +Node: Regexp Field Splitting218786 +Node: Single Character Fields222139 +Node: Command Line Field Separator223199 +Node: Full Line Fields226417 +Ref: Full Line Fields-Footnote-1227939 +Ref: Full Line Fields-Footnote-2227985 +Node: Field Splitting Summary228086 +Node: Constant Size230160 +Node: Splitting By Content234738 +Ref: Splitting By Content-Footnote-1238709 +Node: Multiple Line238872 +Ref: Multiple Line-Footnote-1244754 +Node: Getline244933 +Node: Plain Getline247400 +Node: Getline/Variable250039 +Node: Getline/File251188 +Node: Getline/Variable/File252574 +Ref: Getline/Variable/File-Footnote-1254177 +Node: Getline/Pipe254265 +Node: Getline/Variable/Pipe256970 +Node: Getline/Coprocess258103 +Node: Getline/Variable/Coprocess259368 +Node: Getline Notes260108 +Node: Getline Summary262903 +Ref: table-getline-variants263325 +Node: Read Timeout264073 +Ref: Read Timeout-Footnote-1267979 +Node: Retrying Input268037 +Node: Command-line directories269236 +Node: Input Summary270142 +Node: Input Exercises273314 +Node: Printing274042 +Node: Print275876 +Node: Print Examples277333 +Node: Output Separators280113 +Node: OFMT282130 +Node: Printf283486 +Node: Basic Printf284271 +Node: Control Letters285845 +Node: Format Modifiers289833 +Node: Printf Examples295848 +Node: Redirection298334 +Node: Special FD305175 +Ref: Special FD-Footnote-1308343 +Node: Special Files308417 +Node: Other Inherited Files309034 +Node: Special Network310035 +Node: Special Caveats310895 +Node: Close Files And Pipes311844 +Ref: table-close-pipe-return-values318751 +Ref: Close Files And Pipes-Footnote-1319534 +Ref: Close Files And Pipes-Footnote-2319682 +Node: Nonfatal319834 +Node: Output Summary322159 +Node: Output Exercises323381 +Node: Expressions324060 +Node: Values325248 +Node: Constants325926 +Node: Scalar Constants326617 +Ref: Scalar Constants-Footnote-1327481 +Node: Nondecimal-numbers327731 +Node: Regexp Constants330744 +Node: Using Constant Regexps331270 +Node: Variables334433 +Node: Using Variables335090 +Node: Assignment Options337000 +Node: Conversion338873 +Node: Strings And Numbers339397 +Ref: Strings And Numbers-Footnote-1342460 +Node: Locale influences conversions342569 +Ref: table-locale-affects345327 +Node: All Operators345945 +Node: Arithmetic Ops346574 +Node: Concatenation349080 +Ref: Concatenation-Footnote-1351927 +Node: Assignment Ops352034 +Ref: table-assign-ops357025 +Node: Increment Ops358338 +Node: Truth Values and Conditions361798 +Node: Truth Values362872 +Node: Typing and Comparison363920 +Node: Variable Typing364740 +Node: Comparison Operators368364 +Ref: table-relational-ops368783 +Node: POSIX String Comparison372278 +Ref: POSIX String Comparison-Footnote-1373973 +Ref: POSIX String Comparison-Footnote-2374112 +Node: Boolean Ops374196 +Ref: Boolean Ops-Footnote-1378678 +Node: Conditional Exp378770 +Node: Function Calls380506 +Node: Precedence384383 +Node: Locales388042 +Node: Expressions Summary389674 +Node: Patterns and Actions392247 +Node: Pattern Overview393367 +Node: Regexp Patterns395044 +Node: Expression Patterns395586 +Node: Ranges399367 +Node: BEGIN/END402475 +Node: Using BEGIN/END403236 +Ref: Using BEGIN/END-Footnote-1405972 +Node: I/O And BEGIN/END406078 +Node: BEGINFILE/ENDFILE408392 +Node: Empty411299 +Node: Using Shell Variables411616 +Node: Action Overview413890 +Node: Statements416215 +Node: If Statement418063 +Node: While Statement419558 +Node: Do Statement421586 +Node: For Statement422734 +Node: Switch Statement425892 +Node: Break Statement428278 +Node: Continue Statement430370 +Node: Next Statement432197 +Node: Nextfile Statement434580 +Node: Exit Statement437232 +Node: Built-in Variables439635 +Node: User-modified440768 +Node: Auto-set448354 +Ref: Auto-set-Footnote-1463007 +Ref: Auto-set-Footnote-2463213 +Node: ARGC and ARGV463269 +Node: Pattern Action Summary467482 +Node: Arrays469912 +Node: Array Basics471241 +Node: Array Intro472085 +Ref: figure-array-elements474060 +Ref: Array Intro-Footnote-1476764 +Node: Reference to Elements476892 +Node: Assigning Elements479356 +Node: Array Example479847 +Node: Scanning an Array481606 +Node: Controlling Scanning484628 +Ref: Controlling Scanning-Footnote-1490027 +Node: Numeric Array Subscripts490343 +Node: Uninitialized Subscripts492527 +Node: Delete494146 +Ref: Delete-Footnote-1496898 +Node: Multidimensional496955 +Node: Multiscanning500050 +Node: Arrays of Arrays501641 +Node: Arrays Summary506408 +Node: Functions508501 +Node: Built-in509539 +Node: Calling Built-in510620 +Node: Numeric Functions512616 +Ref: Numeric Functions-Footnote-1517449 +Ref: Numeric Functions-Footnote-2517806 +Ref: Numeric Functions-Footnote-3517854 +Node: String Functions518126 +Ref: String Functions-Footnote-1541630 +Ref: String Functions-Footnote-2541758 +Ref: String Functions-Footnote-3542006 +Node: Gory Details542093 +Ref: table-sub-escapes543884 +Ref: table-sub-proposed545403 +Ref: table-posix-sub546766 +Ref: table-gensub-escapes548307 +Ref: Gory Details-Footnote-1549130 +Node: I/O Functions549284 +Ref: table-system-return-values555866 +Ref: I/O Functions-Footnote-1557846 +Ref: I/O Functions-Footnote-2557994 +Node: Time Functions558114 +Ref: Time Functions-Footnote-1568636 +Ref: Time Functions-Footnote-2568704 +Ref: Time Functions-Footnote-3568862 +Ref: Time Functions-Footnote-4568973 +Ref: Time Functions-Footnote-5569085 +Ref: Time Functions-Footnote-6569312 +Node: Bitwise Functions569578 +Ref: table-bitwise-ops570172 +Ref: Bitwise Functions-Footnote-1574510 +Node: Type Functions574683 +Node: I18N Functions577215 +Node: User-defined578866 +Node: Definition Syntax579671 +Ref: Definition Syntax-Footnote-1585358 +Node: Function Example585429 +Ref: Function Example-Footnote-1588351 +Node: Function Caveats588373 +Node: Calling A Function588891 +Node: Variable Scope589849 +Node: Pass By Value/Reference592843 +Node: Return Statement596342 +Node: Dynamic Typing599321 +Node: Indirect Calls600251 +Ref: Indirect Calls-Footnote-1610502 +Node: Functions Summary610630 +Node: Library Functions613335 +Ref: Library Functions-Footnote-1616942 +Ref: Library Functions-Footnote-2617085 +Node: Library Names617256 +Ref: Library Names-Footnote-1620716 +Ref: Library Names-Footnote-2620939 +Node: General Functions621025 +Node: Strtonum Function622128 +Node: Assert Function625150 +Node: Round Function628476 +Node: Cliff Random Function630017 +Node: Ordinal Functions631033 +Ref: Ordinal Functions-Footnote-1634096 +Ref: Ordinal Functions-Footnote-2634348 +Node: Join Function634558 +Ref: Join Function-Footnote-1636328 +Node: Getlocaltime Function636528 +Node: Readfile Function640270 +Node: Shell Quoting642242 +Node: Data File Management643643 +Node: Filetrans Function644275 +Node: Rewind Function648371 +Node: File Checking650277 +Ref: File Checking-Footnote-1651611 +Node: Empty Files651812 +Node: Ignoring Assigns653791 +Node: Getopt Function655341 +Ref: Getopt Function-Footnote-1666810 +Node: Passwd Functions667010 +Ref: Passwd Functions-Footnote-1675849 +Node: Group Functions675937 +Ref: Group Functions-Footnote-1683835 +Node: Walking Arrays684042 +Node: Library Functions Summary687050 +Node: Library Exercises688456 +Node: Sample Programs688921 +Node: Running Examples689691 +Node: Clones690419 +Node: Cut Program691643 +Node: Egrep Program701572 +Ref: Egrep Program-Footnote-1709084 +Node: Id Program709194 +Node: Split Program712874 +Ref: Split Program-Footnote-1716333 +Node: Tee Program716462 +Node: Uniq Program719252 +Node: Wc Program726678 +Ref: Wc Program-Footnote-1730933 +Node: Miscellaneous Programs731027 +Node: Dupword Program732240 +Node: Alarm Program734270 +Node: Translate Program739125 +Ref: Translate Program-Footnote-1743690 +Node: Labels Program743960 +Ref: Labels Program-Footnote-1747311 +Node: Word Sorting747395 +Node: History Sorting751467 +Node: Extract Program753302 +Node: Simple Sed760831 +Node: Igawk Program763905 +Ref: Igawk Program-Footnote-1778236 +Ref: Igawk Program-Footnote-2778438 +Ref: Igawk Program-Footnote-3778560 +Node: Anagram Program778675 +Node: Signature Program781737 +Node: Programs Summary782984 +Node: Programs Exercises784198 +Ref: Programs Exercises-Footnote-1788327 +Node: Advanced Features788418 +Node: Nondecimal Data790408 +Node: Array Sorting791999 +Node: Controlling Array Traversal792699 +Ref: Controlling Array Traversal-Footnote-1801066 +Node: Array Sorting Functions801184 +Ref: Array Sorting Functions-Footnote-1806275 +Node: Two-way I/O806471 +Ref: Two-way I/O-Footnote-1813021 +Ref: Two-way I/O-Footnote-2813208 +Node: TCP/IP Networking813290 +Node: Profiling816408 +Ref: Profiling-Footnote-1824901 +Node: Advanced Features Summary825224 +Node: Internationalization827068 +Node: I18N and L10N828548 +Node: Explaining gettext829235 +Ref: Explaining gettext-Footnote-1835127 +Ref: Explaining gettext-Footnote-2835312 +Node: Programmer i18n835477 +Ref: Programmer i18n-Footnote-1840332 +Node: Translator i18n840381 +Node: String Extraction841175 +Ref: String Extraction-Footnote-1842307 +Node: Printf Ordering842393 +Ref: Printf Ordering-Footnote-1845179 +Node: I18N Portability845243 +Ref: I18N Portability-Footnote-1847699 +Node: I18N Example847762 +Ref: I18N Example-Footnote-1850568 +Node: Gawk I18N850641 +Node: I18N Summary851286 +Node: Debugger852627 +Node: Debugging853649 +Node: Debugging Concepts854090 +Node: Debugging Terms855899 +Node: Awk Debugging858474 +Node: Sample Debugging Session859380 +Node: Debugger Invocation859914 +Node: Finding The Bug861300 +Node: List of Debugger Commands867778 +Node: Breakpoint Control869111 +Node: Debugger Execution Control872805 +Node: Viewing And Changing Data876167 +Node: Execution Stack879541 +Node: Debugger Info881178 +Node: Miscellaneous Debugger Commands885249 +Node: Readline Support890337 +Node: Limitations891233 +Ref: Limitations-Footnote-1895464 +Node: Debugging Summary895515 +Node: Arbitrary Precision Arithmetic896794 +Node: Computer Arithmetic898210 +Ref: table-numeric-ranges901801 +Ref: Computer Arithmetic-Footnote-1902523 +Node: Math Definitions902580 +Ref: table-ieee-formats905894 +Ref: Math Definitions-Footnote-1906497 +Node: MPFR features906602 +Node: FP Math Caution908319 +Ref: FP Math Caution-Footnote-1909391 +Node: Inexactness of computations909760 +Node: Inexact representation910720 +Node: Comparing FP Values912080 +Node: Errors accumulate913162 +Node: Getting Accuracy914595 +Node: Try To Round917305 +Node: Setting precision918204 +Ref: table-predefined-precision-strings918901 +Node: Setting the rounding mode920731 +Ref: table-gawk-rounding-modes921105 +Ref: Setting the rounding mode-Footnote-1924513 +Node: Arbitrary Precision Integers924692 +Ref: Arbitrary Precision Integers-Footnote-1929609 +Node: POSIX Floating Point Problems929758 +Ref: POSIX Floating Point Problems-Footnote-1933640 +Node: Floating point summary933678 +Node: Dynamic Extensions935868 +Node: Extension Intro937421 +Node: Plugin License938687 +Node: Extension Mechanism Outline939484 +Ref: figure-load-extension939923 +Ref: figure-register-new-function941488 +Ref: figure-call-new-function942580 +Node: Extension API Description944642 +Node: Extension API Functions Introduction946174 +Node: General Data Types951033 +Ref: General Data Types-Footnote-1956988 +Node: Memory Allocation Functions957287 +Ref: Memory Allocation Functions-Footnote-1960132 +Node: Constructor Functions960231 +Node: Registration Functions961976 +Node: Extension Functions962661 +Node: Exit Callback Functions965284 +Node: Extension Version String966534 +Node: Input Parsers967197 +Node: Output Wrappers977079 +Node: Two-way processors981591 +Node: Printing Messages983856 +Ref: Printing Messages-Footnote-1985027 +Node: Updating ERRNO985180 +Node: Requesting Values985919 +Ref: table-value-types-returned986656 +Node: Accessing Parameters987539 +Node: Symbol Table Access988774 +Node: Symbol table by name989286 +Node: Symbol table by cookie991307 +Ref: Symbol table by cookie-Footnote-1995459 +Node: Cached values995523 +Ref: Cached values-Footnote-1999030 +Node: Array Manipulation999121 +Ref: Array Manipulation-Footnote-11000212 +Node: Array Data Types1000249 +Ref: Array Data Types-Footnote-11002907 +Node: Array Functions1002999 +Node: Flattening Arrays1006857 +Node: Creating Arrays1013765 +Node: Redirection API1018534 +Node: Extension API Variables1021365 +Node: Extension Versioning1021998 +Ref: gawk-api-version1022435 +Node: Extension API Informational Variables1024191 +Node: Extension API Boilerplate1025255 +Node: Finding Extensions1029069 +Node: Extension Example1029628 +Node: Internal File Description1030426 +Node: Internal File Ops1034506 +Ref: Internal File Ops-Footnote-11046268 +Node: Using Internal File Ops1046408 +Ref: Using Internal File Ops-Footnote-11048791 +Node: Extension Samples1049065 +Node: Extension Sample File Functions1050594 +Node: Extension Sample Fnmatch1058243 +Node: Extension Sample Fork1059730 +Node: Extension Sample Inplace1060948 +Node: Extension Sample Ord1064158 +Node: Extension Sample Readdir1064994 +Ref: table-readdir-file-types1065883 +Node: Extension Sample Revout1066688 +Node: Extension Sample Rev2way1067277 +Node: Extension Sample Read write array1068017 +Node: Extension Sample Readfile1069959 +Node: Extension Sample Time1071054 +Node: Extension Sample API Tests1072402 +Node: gawkextlib1072894 +Node: Extension summary1075341 +Node: Extension Exercises1079043 +Node: Language History1080541 +Node: V7/SVR3.11082197 +Node: SVR41084349 +Node: POSIX1085783 +Node: BTL1087162 +Node: POSIX/GNU1087891 +Node: Feature History1093753 +Node: Common Extensions1108123 +Node: Ranges and Locales1109406 +Ref: Ranges and Locales-Footnote-11114022 +Ref: Ranges and Locales-Footnote-21114049 +Ref: Ranges and Locales-Footnote-31114284 +Node: Contributors1114505 +Node: History summary1120065 +Node: Installation1121445 +Node: Gawk Distribution1122389 +Node: Getting1122873 +Node: Extracting1123834 +Node: Distribution contents1125472 +Node: Unix Installation1131557 +Node: Quick Installation1132239 +Node: Shell Startup Files1134653 +Node: Additional Configuration Options1135731 +Node: Configuration Philosophy1137536 +Node: Non-Unix Installation1139905 +Node: PC Installation1140365 +Node: PC Binary Installation1141203 +Node: PC Compiling1141638 +Node: PC Using1142755 +Node: Cygwin1145800 +Node: MSYS1146570 +Node: VMS Installation1147071 +Node: VMS Compilation1147862 +Ref: VMS Compilation-Footnote-11149091 +Node: VMS Dynamic Extensions1149149 +Node: VMS Installation Details1150834 +Node: VMS Running1153087 +Node: VMS GNV1157366 +Node: VMS Old Gawk1158101 +Node: Bugs1158572 +Node: Bug address1159235 +Node: Usenet1161632 +Node: Maintainers1162407 +Node: Other Versions1163783 +Node: Installation summary1170367 +Node: Notes1171402 +Node: Compatibility Mode1172267 +Node: Additions1173049 +Node: Accessing The Source1173974 +Node: Adding Code1175409 +Node: New Ports1181628 +Node: Derived Files1186116 +Ref: Derived Files-Footnote-11191601 +Ref: Derived Files-Footnote-21191636 +Ref: Derived Files-Footnote-31192234 +Node: Future Extensions1192348 +Node: Implementation Limitations1193006 +Node: Extension Design1194189 +Node: Old Extension Problems1195343 +Ref: Old Extension Problems-Footnote-11196861 +Node: Extension New Mechanism Goals1196918 +Ref: Extension New Mechanism Goals-Footnote-11200282 +Node: Extension Other Design Decisions1200471 +Node: Extension Future Growth1202584 +Node: Old Extension Mechanism1203420 +Node: Notes summary1205183 +Node: Basic Concepts1206365 +Node: Basic High Level1207046 +Ref: figure-general-flow1207328 +Ref: figure-process-flow1208013 +Ref: Basic High Level-Footnote-11211314 +Node: Basic Data Typing1211499 +Node: Glossary1214827 +Node: Copying1246774 +Node: GNU Free Documentation License1284313 +Node: Index1309431 End Tag Table diff --git a/doc/gawk.texi b/doc/gawk.texi index aaecb6d2..adc5c917 100644 --- a/doc/gawk.texi +++ b/doc/gawk.texi @@ -988,14 +988,11 @@ particular records in a file and perform operations upon them. * Configuration Philosophy:: How it's all supposed to work. * Non-Unix Installation:: Installation on Other Operating Systems. -* PC Installation:: Installing and Compiling - @command{gawk} on MS-DOS and OS/2. +* PC Installation:: Installing and Compiling @command{gawk} on + Microsoft Windows. * PC Binary Installation:: Installing a prepared distribution. -* PC Compiling:: Compiling @command{gawk} for MS-DOS, - Windows32, and OS/2. -* PC Testing:: Testing @command{gawk} on PC systems. -* PC Using:: Running @command{gawk} on MS-DOS, - Windows32 and OS/2. +* PC Compiling:: Compiling @command{gawk} for Windows32. +* PC Using:: Running @command{gawk} on Windows32. * Cygwin:: Building and running @command{gawk} for Cygwin. * MSYS:: Using @command{gawk} In The MSYS @@ -1377,12 +1374,7 @@ ranging from Intel-architecture PC-based computers up through large-scale systems. @command{gawk} has also been ported to Mac OS X, Microsoft Windows -@ifset FOR_PRINT (all versions), -@end ifset -@ifclear FOR_PRINT -(all versions) and OS/2 PCs, -@end ifclear and OpenVMS.@footnote{Some other, obsolete systems to which @command{gawk} was once ported are no longer supported and the code for those systems has been removed.} @@ -2487,13 +2479,7 @@ awk '@var{program}' @command{awk} applies the @var{program} to the @dfn{standard input}, which usually means whatever you type on the keyboard. This continues until you indicate end-of-file by typing @kbd{Ctrl-d}. -@ifset FOR_PRINT (On non-POSIX operating systems, the end-of-file character may be different.) -@end ifset -@ifclear FOR_PRINT -(On non-POSIX operating systems, the end-of-file character may be different. -For example, on OS/2, it is @kbd{Ctrl-z}.) -@end ifclear @cindex files, input, See input files @cindex input files, running @command{awk} without @@ -4430,7 +4416,7 @@ directories (called the @dfn{search path}) one by one, looking for a file with the specified name. The search path is a string consisting of directory names -separated by colons.@footnote{Semicolons on MS-Windows and MS-DOS.} +separated by colons.@footnote{Semicolons on MS-Windows.} @command{gawk} gets its search path from the @env{AWKPATH} environment variable. If that variable does not exist, or if it has an empty value, @@ -22994,7 +22980,6 @@ is as follows: * December 2010, move to ANSI C definition for main(). */ -/* For OS/2, do nothing. */ #if HAVE_CONFIG_H #include <config.h> #endif @@ -38012,9 +37997,6 @@ Files needed for building @command{gawk} on POSIX-compliant systems. @item pc/* Files needed for building @command{gawk} under MS-Windows -@ifclear FOR_PRINT -and OS/2 -@end ifclear (@pxref{PC Installation} for details). @item vms/* @@ -38272,108 +38254,48 @@ various non-Unix systems. @menu * PC Installation:: Installing and Compiling @command{gawk} on - MS-DOS and OS/2. + Microsoft Windows. * VMS Installation:: Installing @command{gawk} on VMS. @end menu -@c Rewritten by Scott Deifik <scottd.mail@sbcglobal.net> -@c and Darrel Hankerson <hankedr@mail.auburn.edu> - @node PC Installation -@appendixsubsec Installation on PC Operating Systems +@appendixsubsec Installation on MS-Windows @cindex PC operating systems@comma{} @command{gawk} on, installing @cindex operating systems, PC@comma{} @command{gawk} on, installing This @value{SECTION} covers installation and usage of @command{gawk} -on Intel architecture machines -@ifclear FOR_PRINT -running MS-DOS, any version of MS-Windows, or OS/2. -@end ifclear -@ifset FOR_PRINT -running MS-DOS and any version of MS-Windows. -@end ifset +on Intel architecture machines running any version of MS-Windows. In this @value{SECTION}, the term ``Windows32'' -refers to any of Microsoft Windows 95/98/ME/NT/2000/XP/Vista/7/8. +refers to any of Microsoft Windows 95/98/ME/NT/2000/XP/Vista/7/8/10. -The limitations of MS-DOS (and MS-DOS shells under the other operating -systems) have meant that various ``DOS extenders'' are often used with -programs such as @command{gawk}. The varying capabilities of Microsoft -Windows 3.1 and Windows32 can add to the confusion. For an overview -of the considerations, refer to @file{README_d/README.pc} in -the distribution. +See also the @file{README_d/README.pc} file in the distribution. @menu * PC Binary Installation:: Installing a prepared distribution. -* PC Compiling:: Compiling @command{gawk} for MS-DOS, - Windows32, and OS/2. -* PC Testing:: Testing @command{gawk} on PC systems. -* PC Using:: Running @command{gawk} on MS-DOS, Windows32 - and OS/2. +* PC Compiling:: Compiling @command{gawk} for Windows32. +* PC Using:: Running @command{gawk} on Windows32. * Cygwin:: Building and running @command{gawk} for Cygwin. * MSYS:: Using @command{gawk} In The MSYS Environment. @end menu -@ifclear FOR_PRINT @node PC Binary Installation -@appendixsubsubsec Installing a Prepared Distribution for PC Systems - -If you have received a binary distribution prepared by the MS-DOS -maintainers, then @command{gawk} and the necessary support files appear -under the @file{gnu} directory, with executables in @file{gnu/bin}, -libraries in @file{gnu/lib/awk}, and manual pages under @file{gnu/man}. -This is designed for easy installation to a @file{/gnu} directory on your -drive---however, the files can be installed anywhere provided @env{AWKPATH} is -set properly. Regardless of the installation directory, the first line of -@file{igawk.cmd} and @file{igawk.bat} (in @file{gnu/bin}) may need to be -edited. - -The binary distribution contains a separate file describing the -contents. In particular, it may include more than one version of the -@command{gawk} executable. - -OS/2 (32 bit, EMX) binary distributions are prepared for the @file{/usr} -directory of your preferred drive. Set @env{UNIXROOT} to your installation -drive (e.g., @samp{e:}) if you want to install @command{gawk} onto another drive -than the hardcoded default @samp{c:}. Executables appear in @file{/usr/bin}, -libraries under @file{/usr/share/awk}, manual pages under @file{/usr/man}, -Texinfo documentation under @file{/usr/info}, and NLS files -under @file{/usr/share/locale}. -Note that the files can be installed anywhere provided @env{AWKPATH} is -set properly. - -If you already have a file @file{/usr/info/dir} from another package -@emph{do not overwrite it!} Instead enter the following commands at your prompt -(replace @samp{x:} by your installation drive): - -@example -install-info --info-dir=x:/usr/info x:/usr/info/gawk.info -install-info --info-dir=x:/usr/info x:/usr/info/gawkinet.info -@end example - -The binary distribution may contain a separate file containing additional -or more detailed installation instructions. -@end ifclear +@appendixsubsubsec Installing a Prepared Distribution for MS-Windows Systems + +The only supported binary distribution for MS-Windows systems +is that provided by Eli Zaretskii's @uref{https://sourceforge.net/projects/ezwinports/, +``ezwinports''} project. Install the compiled @command{gawk} from there. @node PC Compiling @appendixsubsubsec Compiling @command{gawk} for PC Operating Systems -@ifclear FOR_PRINT -@command{gawk} can be compiled for MS-DOS, Windows32, and OS/2 using -MinGW (Windows32) or Eberhard -Mattes (EMX: MS-DOS, Windows32 and OS/2). -@end ifclear -@ifset FOR_PRINT -@command{gawk} can be compiled for Windows32 using -MinGW. -@end ifset -The file -@file{README_d/README.pc} in the @command{gawk} distribution contains -additional notes, and @file{pc/Makefile} contains important information on -compilation options. +@command{gawk} can be compiled for Windows32 using MinGW (Windows32). +The file @file{README_d/README.pc} in the @command{gawk} distribution +contains additional notes, and @file{pc/Makefile} contains important +information on compilation options. -@cindex compiling @command{gawk} for MS-DOS and MS-Windows -To build @command{gawk} for MS-DOS and Windows32, copy the files in +@cindex compiling @command{gawk} for MS-Windows +To build @command{gawk} for Windows32, copy the files in the @file{pc} directory (@emph{except} for @file{ChangeLog}) to the directory with the rest of the @command{gawk} sources, then invoke @command{make} with the appropriate target name as an argument to @@ -38384,177 +38306,35 @@ to be edited in order to work with your @command{make} utility. The @file{Makefile} supports a number of targets for building various MS-DOS and Windows32 versions. A list of targets is printed if the @command{make} command is given without a target. As an example, -to build a -native MS-Windows binary of @command{gawk} using the MinGW tools, +to build a native MS-Windows binary of @command{gawk} using the MinGW tools, type @samp{make mingw32}. -@ifclear FOR_PRINT -@cindex compiling @command{gawk} with EMX for OS/2 -The 32 bit EMX version of @command{gawk} works ``out of the box'' under OS/2. -However, it is highly recommended to use GCC 2.95.3 for the compilation. -In principle, it is possible to compile @command{gawk} the following way: - -@example -$ @kbd{./configure} -$ @kbd{make} -@end example - -This is not recommended, though. To get an OMF executable you should -use the following commands at your @command{sh} prompt: - -@example -$ @kbd{CFLAGS="-O2 -Zomf -Zmt"} -$ @kbd{export CFLAGS} -$ @kbd{LDFLAGS="-s -Zcrtdll -Zlinker /exepack:2 -Zlinker /pm:vio -Zstack 0x6000"} -$ @kbd{export LDFLAGS} -$ @kbd{RANLIB="echo"} -$ @kbd{export RANLIB} -$ @kbd{./configure --prefix=c:/usr} -$ @kbd{make AR=emxomfar} -@end example - -These are just suggestions for use with GCC 2.x. You may use any other set of -(self-consistent) environment variables and compiler flags. - -@ignore -To get an FHS-compliant file hierarchy it is recommended to use the additional -@command{configure} options @option{--infodir=c:/usr/share/info}, @option{--mandir=c:/usr/share/man} -and @option{--libexecdir=c:/usr/lib}. -@end ignore - -@ignore -The internal @command{gettext} library tends to be problematic. It is therefore recommended -to use either an external one (@option{--without-included-gettext}) or to disable -NLS entirely (@option{--disable-nls}). -@end ignore - -If you use GCC 2.95 it is recommended to use also: - -@example -$ @kbd{LIBS="-lgcc"} -$ @kbd{export LIBS} -@end example - -You can also get an @code{a.out} executable if you prefer: - -@example -$ @kbd{CFLAGS="-O2 -Zmt"} -$ @kbd{export CFLAGS} -$ @kbd{LDFLAGS="-s -Zstack 0x6000"} -$ @kbd{LIBS="-lgcc"} -$ @kbd{unset RANLIB} -@c $ ./configure --prefix=c:/usr --without-included-gettext -$ @kbd{./configure --prefix=c:/usr} -$ @kbd{make} -@end example - -@quotation NOTE -Compilation of @code{a.out} executables also works with GCC 3.2. -Versions later than GCC 3.2 have not been tested successfully. -@end quotation - -@samp{make install} works as expected with the EMX build. - -@quotation NOTE -Ancient OS/2 ports of GNU @command{make} are not able to handle -the Makefiles of this package. If you encounter any problems with -@command{make}, try GNU Make 3.79.1 or later versions. You should -find the latest version on -@uref{ftp://hobbes.nmsu.edu/pub/os2/}.@footnote{As of November 2014, -this site is still there, but the author could not find a package -for GNU Make.} -@end quotation -@end ifclear - -@node PC Testing -@appendixsubsubsec Testing @command{gawk} on PC Operating Systems - -Using @command{make} to run the standard tests and to install @command{gawk} -requires additional Unix-like tools, including @command{sh}, @command{sed}, and -@command{cp}. In order to run the tests, the @file{test/*.ok} files may need to -be converted so that they have the usual MS-DOS-style end-of-line markers. -Alternatively, run @command{make check CMP="diff -a"} to use GNU @command{diff} -in text mode instead of @command{cmp} to compare the resulting files. - -@ifclear FOR_PRINT -Most -of the tests work properly with Stewartson's shell along with the -companion utilities or appropriate GNU utilities. However, some editing of -@file{test/Makefile} is required. It is recommended that you copy the file -@file{pc/Makefile.tst} over the file @file{test/Makefile} as a -replacement. Details can be found in @file{README_d/README.pc} -and in the file @file{pc/Makefile.tst}. - -On OS/2 the @code{pid} test fails because @code{spawnl()} is used instead of -@code{fork()}/@code{execl()} to start child processes. -Also the @code{mbfw1} and @code{mbprintf1} tests fail because the needed -multibyte functionality is not available. -@end ifclear - @node PC Using @appendixsubsubsec Using @command{gawk} on PC Operating Systems @cindex operating systems, PC, @command{gawk} on @cindex PC operating systems, @command{gawk} on -Under MS-DOS and MS-Windows, the Cygwin and MinGW environments support +Under MS-Windows, the Cygwin and MinGW environments support both the @samp{|&} operator and TCP/IP networking (@pxref{TCP/IP Networking}). -@ifclear FOR_PRINT -EMX (OS/2 only) supports at least the @samp{|&} operator. -@end ifclear @cindex search paths @cindex search paths, for source files -@cindex @command{gawk}, MS-DOS version of @cindex @command{gawk}, MS-Windows version of @cindex @code{;} (semicolon), @env{AWKPATH} variable and @cindex semicolon (@code{;}), @env{AWKPATH} variable and @cindex @env{AWKPATH} environment variable -The MS-DOS and MS-Windows versions of @command{gawk} search for +The MS-Windows version of @command{gawk} searches for program files as described in @ref{AWKPATH Variable}. However, semicolons (rather than colons) separate elements in the @env{AWKPATH} variable. If @env{AWKPATH} is not set or is empty, then the default search path is @samp{@w{.;c:/lib/awk;c:/gnu/lib/awk}}. -@ifclear FOR_PRINT -@cindex @command{gawk}, OS/2 version of -@cindex @code{UNIXROOT} variable, on OS/2 systems -The search path for OS/2 (32 bit, EMX) is determined by the prefix directory -(most likely @file{/usr} or @file{c:/usr}) that has been specified as an option of -the @command{configure} script as is the case for the Unix versions. -If @file{c:/usr} is the prefix directory then the default search path contains @file{.} -and @file{c:/usr/share/awk}. -Additionally, to support binary distributions of @command{gawk} for OS/2 -systems whose drive @samp{c:} might not support long @value{FN}s or might not exist -at all, there is a special environment variable. If @env{UNIXROOT} specifies -a drive then this specific drive is also searched for program files. -E.g., if @env{UNIXROOT} is set to @file{e:} the complete default search path is -@samp{@w{.;c:/usr/share/awk;e:/usr/share/awk}}. - -An @command{sh}-like shell (as opposed to @command{command.com} under MS-DOS -or @command{cmd.exe} under MS-Windows or OS/2) may be useful for @command{awk} programming. -The DJGPP collection of tools@footnote{Available from -@uref{ftp://ftp.delorie.com/pub/djgpp/current/v2gnu/}.} -includes an MS-DOS port of Bash, -and several shells are available for OS/2, including @command{ksh}. -@end ifclear -@ifset FOR_PRINT -An @command{sh}-like shell (as opposed to @command{command.com} under MS-DOS -or @command{cmd.exe} under MS-Windows) may be useful for @command{awk} programming. -The DJGPP collection of tools@footnote{Available from -@uref{ftp://ftp.delorie.com/pub/djgpp/current/v2gnu/}.} includes an MS-DOS port of Bash. -@end ifset - @cindex common extensions, @code{BINMODE} variable @cindex extensions, common@comma{} @code{BINMODE} variable @cindex differences in @command{awk} and @command{gawk}, @code{BINMODE} variable @cindex @code{BINMODE} variable -@ifclear FOR_PRINT -Under MS-Windows, OS/2 and MS-DOS, -@end ifclear -@ifset FOR_PRINT -Under MS-Windows and MS-DOS, -@end ifset +Under MS-Windows, @command{gawk} (and many other text programs) silently translates end-of-line @samp{\r\n} to @samp{\n} on input and @samp{\n} to @samp{\r\n} on output. A special @code{BINMODE} variable @value{COMMONEXT} @@ -39186,8 +38966,8 @@ The people maintaining the various @command{gawk} ports are: @item MS-Windows with MinGW @tab Eli Zaretskii, @EMAIL{eliz@@gnu.org,eliz at gnu dot org} -@c Leave this in the print version on purpose. -@c OS/2 is not mentioned anywhere else in the print version though. +@c Leave this in the document on purpose. +@c OS/2 is not mentioned anywhere else though. @item OS/2 @tab Andreas Buening, @EMAIL{andreas.buening@@nexgo.de,andreas dot buening at nexgo dot de} @item VMS @tab John Malmberg, @EMAIL{wb8tyw@@qsl.net,wb8tyw at qsl.net} @@ -39447,9 +39227,6 @@ cd gawk-@value{VERSION}.@value{PATCHLEVEL} @command{gawk} may be built on non-POSIX systems as well. The currently supported systems are MS-Windows using MSYS, MinGW, and Cygwin, -@ifclear FOR_PRINT -OS/2 using EMX, -@end ifclear and both Vax/VMS and OpenVMS. Instructions for each system are included in this @value{APPENDIX}. @@ -42942,7 +42719,7 @@ Consistency issues: Use @code{xxx} for the xxx operator in indexing statements, not @samp. Use MS-Windows not MS Windows - Use MS-DOS not MS-DOS + Use MS-DOS not MS DOS Use an empty set of parentheses after built-in and awk function names. Use "multiFOO" without a hyphen. diff --git a/doc/gawktexi.in b/doc/gawktexi.in index 5bf0c815..afcf749a 100644 --- a/doc/gawktexi.in +++ b/doc/gawktexi.in @@ -983,14 +983,11 @@ particular records in a file and perform operations upon them. * Configuration Philosophy:: How it's all supposed to work. * Non-Unix Installation:: Installation on Other Operating Systems. -* PC Installation:: Installing and Compiling - @command{gawk} on MS-DOS and OS/2. +* PC Installation:: Installing and Compiling @command{gawk} on + Microsoft Windows. * PC Binary Installation:: Installing a prepared distribution. -* PC Compiling:: Compiling @command{gawk} for MS-DOS, - Windows32, and OS/2. -* PC Testing:: Testing @command{gawk} on PC systems. -* PC Using:: Running @command{gawk} on MS-DOS, - Windows32 and OS/2. +* PC Compiling:: Compiling @command{gawk} for Windows32. +* PC Using:: Running @command{gawk} on Windows32. * Cygwin:: Building and running @command{gawk} for Cygwin. * MSYS:: Using @command{gawk} In The MSYS @@ -1372,12 +1369,7 @@ ranging from Intel-architecture PC-based computers up through large-scale systems. @command{gawk} has also been ported to Mac OS X, Microsoft Windows -@ifset FOR_PRINT (all versions), -@end ifset -@ifclear FOR_PRINT -(all versions) and OS/2 PCs, -@end ifclear and OpenVMS.@footnote{Some other, obsolete systems to which @command{gawk} was once ported are no longer supported and the code for those systems has been removed.} @@ -2454,13 +2446,7 @@ awk '@var{program}' @command{awk} applies the @var{program} to the @dfn{standard input}, which usually means whatever you type on the keyboard. This continues until you indicate end-of-file by typing @kbd{Ctrl-d}. -@ifset FOR_PRINT (On non-POSIX operating systems, the end-of-file character may be different.) -@end ifset -@ifclear FOR_PRINT -(On non-POSIX operating systems, the end-of-file character may be different. -For example, on OS/2, it is @kbd{Ctrl-z}.) -@end ifclear @cindex files, input, See input files @cindex input files, running @command{awk} without @@ -4341,7 +4327,7 @@ directories (called the @dfn{search path}) one by one, looking for a file with the specified name. The search path is a string consisting of directory names -separated by colons.@footnote{Semicolons on MS-Windows and MS-DOS.} +separated by colons.@footnote{Semicolons on MS-Windows.} @command{gawk} gets its search path from the @env{AWKPATH} environment variable. If that variable does not exist, or if it has an empty value, @@ -22076,7 +22062,6 @@ is as follows: * December 2010, move to ANSI C definition for main(). */ -/* For OS/2, do nothing. */ #if HAVE_CONFIG_H #include <config.h> #endif @@ -37094,9 +37079,6 @@ Files needed for building @command{gawk} on POSIX-compliant systems. @item pc/* Files needed for building @command{gawk} under MS-Windows -@ifclear FOR_PRINT -and OS/2 -@end ifclear (@pxref{PC Installation} for details). @item vms/* @@ -37354,108 +37336,48 @@ various non-Unix systems. @menu * PC Installation:: Installing and Compiling @command{gawk} on - MS-DOS and OS/2. + Microsoft Windows. * VMS Installation:: Installing @command{gawk} on VMS. @end menu -@c Rewritten by Scott Deifik <scottd.mail@sbcglobal.net> -@c and Darrel Hankerson <hankedr@mail.auburn.edu> - @node PC Installation -@appendixsubsec Installation on PC Operating Systems +@appendixsubsec Installation on MS-Windows @cindex PC operating systems@comma{} @command{gawk} on, installing @cindex operating systems, PC@comma{} @command{gawk} on, installing This @value{SECTION} covers installation and usage of @command{gawk} -on Intel architecture machines -@ifclear FOR_PRINT -running MS-DOS, any version of MS-Windows, or OS/2. -@end ifclear -@ifset FOR_PRINT -running MS-DOS and any version of MS-Windows. -@end ifset +on Intel architecture machines running any version of MS-Windows. In this @value{SECTION}, the term ``Windows32'' -refers to any of Microsoft Windows 95/98/ME/NT/2000/XP/Vista/7/8. +refers to any of Microsoft Windows 95/98/ME/NT/2000/XP/Vista/7/8/10. -The limitations of MS-DOS (and MS-DOS shells under the other operating -systems) have meant that various ``DOS extenders'' are often used with -programs such as @command{gawk}. The varying capabilities of Microsoft -Windows 3.1 and Windows32 can add to the confusion. For an overview -of the considerations, refer to @file{README_d/README.pc} in -the distribution. +See also the @file{README_d/README.pc} file in the distribution. @menu * PC Binary Installation:: Installing a prepared distribution. -* PC Compiling:: Compiling @command{gawk} for MS-DOS, - Windows32, and OS/2. -* PC Testing:: Testing @command{gawk} on PC systems. -* PC Using:: Running @command{gawk} on MS-DOS, Windows32 - and OS/2. +* PC Compiling:: Compiling @command{gawk} for Windows32. +* PC Using:: Running @command{gawk} on Windows32. * Cygwin:: Building and running @command{gawk} for Cygwin. * MSYS:: Using @command{gawk} In The MSYS Environment. @end menu -@ifclear FOR_PRINT @node PC Binary Installation -@appendixsubsubsec Installing a Prepared Distribution for PC Systems - -If you have received a binary distribution prepared by the MS-DOS -maintainers, then @command{gawk} and the necessary support files appear -under the @file{gnu} directory, with executables in @file{gnu/bin}, -libraries in @file{gnu/lib/awk}, and manual pages under @file{gnu/man}. -This is designed for easy installation to a @file{/gnu} directory on your -drive---however, the files can be installed anywhere provided @env{AWKPATH} is -set properly. Regardless of the installation directory, the first line of -@file{igawk.cmd} and @file{igawk.bat} (in @file{gnu/bin}) may need to be -edited. - -The binary distribution contains a separate file describing the -contents. In particular, it may include more than one version of the -@command{gawk} executable. - -OS/2 (32 bit, EMX) binary distributions are prepared for the @file{/usr} -directory of your preferred drive. Set @env{UNIXROOT} to your installation -drive (e.g., @samp{e:}) if you want to install @command{gawk} onto another drive -than the hardcoded default @samp{c:}. Executables appear in @file{/usr/bin}, -libraries under @file{/usr/share/awk}, manual pages under @file{/usr/man}, -Texinfo documentation under @file{/usr/info}, and NLS files -under @file{/usr/share/locale}. -Note that the files can be installed anywhere provided @env{AWKPATH} is -set properly. - -If you already have a file @file{/usr/info/dir} from another package -@emph{do not overwrite it!} Instead enter the following commands at your prompt -(replace @samp{x:} by your installation drive): - -@example -install-info --info-dir=x:/usr/info x:/usr/info/gawk.info -install-info --info-dir=x:/usr/info x:/usr/info/gawkinet.info -@end example - -The binary distribution may contain a separate file containing additional -or more detailed installation instructions. -@end ifclear +@appendixsubsubsec Installing a Prepared Distribution for MS-Windows Systems + +The only supported binary distribution for MS-Windows systems +is that provided by Eli Zaretskii's @uref{https://sourceforge.net/projects/ezwinports/, +``ezwinports''} project. Install the compiled @command{gawk} from there. @node PC Compiling @appendixsubsubsec Compiling @command{gawk} for PC Operating Systems -@ifclear FOR_PRINT -@command{gawk} can be compiled for MS-DOS, Windows32, and OS/2 using -MinGW (Windows32) or Eberhard -Mattes (EMX: MS-DOS, Windows32 and OS/2). -@end ifclear -@ifset FOR_PRINT -@command{gawk} can be compiled for Windows32 using -MinGW. -@end ifset -The file -@file{README_d/README.pc} in the @command{gawk} distribution contains -additional notes, and @file{pc/Makefile} contains important information on -compilation options. +@command{gawk} can be compiled for Windows32 using MinGW (Windows32). +The file @file{README_d/README.pc} in the @command{gawk} distribution +contains additional notes, and @file{pc/Makefile} contains important +information on compilation options. -@cindex compiling @command{gawk} for MS-DOS and MS-Windows -To build @command{gawk} for MS-DOS and Windows32, copy the files in +@cindex compiling @command{gawk} for MS-Windows +To build @command{gawk} for Windows32, copy the files in the @file{pc} directory (@emph{except} for @file{ChangeLog}) to the directory with the rest of the @command{gawk} sources, then invoke @command{make} with the appropriate target name as an argument to @@ -37466,177 +37388,35 @@ to be edited in order to work with your @command{make} utility. The @file{Makefile} supports a number of targets for building various MS-DOS and Windows32 versions. A list of targets is printed if the @command{make} command is given without a target. As an example, -to build a -native MS-Windows binary of @command{gawk} using the MinGW tools, +to build a native MS-Windows binary of @command{gawk} using the MinGW tools, type @samp{make mingw32}. -@ifclear FOR_PRINT -@cindex compiling @command{gawk} with EMX for OS/2 -The 32 bit EMX version of @command{gawk} works ``out of the box'' under OS/2. -However, it is highly recommended to use GCC 2.95.3 for the compilation. -In principle, it is possible to compile @command{gawk} the following way: - -@example -$ @kbd{./configure} -$ @kbd{make} -@end example - -This is not recommended, though. To get an OMF executable you should -use the following commands at your @command{sh} prompt: - -@example -$ @kbd{CFLAGS="-O2 -Zomf -Zmt"} -$ @kbd{export CFLAGS} -$ @kbd{LDFLAGS="-s -Zcrtdll -Zlinker /exepack:2 -Zlinker /pm:vio -Zstack 0x6000"} -$ @kbd{export LDFLAGS} -$ @kbd{RANLIB="echo"} -$ @kbd{export RANLIB} -$ @kbd{./configure --prefix=c:/usr} -$ @kbd{make AR=emxomfar} -@end example - -These are just suggestions for use with GCC 2.x. You may use any other set of -(self-consistent) environment variables and compiler flags. - -@ignore -To get an FHS-compliant file hierarchy it is recommended to use the additional -@command{configure} options @option{--infodir=c:/usr/share/info}, @option{--mandir=c:/usr/share/man} -and @option{--libexecdir=c:/usr/lib}. -@end ignore - -@ignore -The internal @command{gettext} library tends to be problematic. It is therefore recommended -to use either an external one (@option{--without-included-gettext}) or to disable -NLS entirely (@option{--disable-nls}). -@end ignore - -If you use GCC 2.95 it is recommended to use also: - -@example -$ @kbd{LIBS="-lgcc"} -$ @kbd{export LIBS} -@end example - -You can also get an @code{a.out} executable if you prefer: - -@example -$ @kbd{CFLAGS="-O2 -Zmt"} -$ @kbd{export CFLAGS} -$ @kbd{LDFLAGS="-s -Zstack 0x6000"} -$ @kbd{LIBS="-lgcc"} -$ @kbd{unset RANLIB} -@c $ ./configure --prefix=c:/usr --without-included-gettext -$ @kbd{./configure --prefix=c:/usr} -$ @kbd{make} -@end example - -@quotation NOTE -Compilation of @code{a.out} executables also works with GCC 3.2. -Versions later than GCC 3.2 have not been tested successfully. -@end quotation - -@samp{make install} works as expected with the EMX build. - -@quotation NOTE -Ancient OS/2 ports of GNU @command{make} are not able to handle -the Makefiles of this package. If you encounter any problems with -@command{make}, try GNU Make 3.79.1 or later versions. You should -find the latest version on -@uref{ftp://hobbes.nmsu.edu/pub/os2/}.@footnote{As of November 2014, -this site is still there, but the author could not find a package -for GNU Make.} -@end quotation -@end ifclear - -@node PC Testing -@appendixsubsubsec Testing @command{gawk} on PC Operating Systems - -Using @command{make} to run the standard tests and to install @command{gawk} -requires additional Unix-like tools, including @command{sh}, @command{sed}, and -@command{cp}. In order to run the tests, the @file{test/*.ok} files may need to -be converted so that they have the usual MS-DOS-style end-of-line markers. -Alternatively, run @command{make check CMP="diff -a"} to use GNU @command{diff} -in text mode instead of @command{cmp} to compare the resulting files. - -@ifclear FOR_PRINT -Most -of the tests work properly with Stewartson's shell along with the -companion utilities or appropriate GNU utilities. However, some editing of -@file{test/Makefile} is required. It is recommended that you copy the file -@file{pc/Makefile.tst} over the file @file{test/Makefile} as a -replacement. Details can be found in @file{README_d/README.pc} -and in the file @file{pc/Makefile.tst}. - -On OS/2 the @code{pid} test fails because @code{spawnl()} is used instead of -@code{fork()}/@code{execl()} to start child processes. -Also the @code{mbfw1} and @code{mbprintf1} tests fail because the needed -multibyte functionality is not available. -@end ifclear - @node PC Using @appendixsubsubsec Using @command{gawk} on PC Operating Systems @cindex operating systems, PC, @command{gawk} on @cindex PC operating systems, @command{gawk} on -Under MS-DOS and MS-Windows, the Cygwin and MinGW environments support +Under MS-Windows, the Cygwin and MinGW environments support both the @samp{|&} operator and TCP/IP networking (@pxref{TCP/IP Networking}). -@ifclear FOR_PRINT -EMX (OS/2 only) supports at least the @samp{|&} operator. -@end ifclear @cindex search paths @cindex search paths, for source files -@cindex @command{gawk}, MS-DOS version of @cindex @command{gawk}, MS-Windows version of @cindex @code{;} (semicolon), @env{AWKPATH} variable and @cindex semicolon (@code{;}), @env{AWKPATH} variable and @cindex @env{AWKPATH} environment variable -The MS-DOS and MS-Windows versions of @command{gawk} search for +The MS-Windows version of @command{gawk} searches for program files as described in @ref{AWKPATH Variable}. However, semicolons (rather than colons) separate elements in the @env{AWKPATH} variable. If @env{AWKPATH} is not set or is empty, then the default search path is @samp{@w{.;c:/lib/awk;c:/gnu/lib/awk}}. -@ifclear FOR_PRINT -@cindex @command{gawk}, OS/2 version of -@cindex @code{UNIXROOT} variable, on OS/2 systems -The search path for OS/2 (32 bit, EMX) is determined by the prefix directory -(most likely @file{/usr} or @file{c:/usr}) that has been specified as an option of -the @command{configure} script as is the case for the Unix versions. -If @file{c:/usr} is the prefix directory then the default search path contains @file{.} -and @file{c:/usr/share/awk}. -Additionally, to support binary distributions of @command{gawk} for OS/2 -systems whose drive @samp{c:} might not support long @value{FN}s or might not exist -at all, there is a special environment variable. If @env{UNIXROOT} specifies -a drive then this specific drive is also searched for program files. -E.g., if @env{UNIXROOT} is set to @file{e:} the complete default search path is -@samp{@w{.;c:/usr/share/awk;e:/usr/share/awk}}. - -An @command{sh}-like shell (as opposed to @command{command.com} under MS-DOS -or @command{cmd.exe} under MS-Windows or OS/2) may be useful for @command{awk} programming. -The DJGPP collection of tools@footnote{Available from -@uref{ftp://ftp.delorie.com/pub/djgpp/current/v2gnu/}.} -includes an MS-DOS port of Bash, -and several shells are available for OS/2, including @command{ksh}. -@end ifclear -@ifset FOR_PRINT -An @command{sh}-like shell (as opposed to @command{command.com} under MS-DOS -or @command{cmd.exe} under MS-Windows) may be useful for @command{awk} programming. -The DJGPP collection of tools@footnote{Available from -@uref{ftp://ftp.delorie.com/pub/djgpp/current/v2gnu/}.} includes an MS-DOS port of Bash. -@end ifset - @cindex common extensions, @code{BINMODE} variable @cindex extensions, common@comma{} @code{BINMODE} variable @cindex differences in @command{awk} and @command{gawk}, @code{BINMODE} variable @cindex @code{BINMODE} variable -@ifclear FOR_PRINT -Under MS-Windows, OS/2 and MS-DOS, -@end ifclear -@ifset FOR_PRINT -Under MS-Windows and MS-DOS, -@end ifset +Under MS-Windows, @command{gawk} (and many other text programs) silently translates end-of-line @samp{\r\n} to @samp{\n} on input and @samp{\n} to @samp{\r\n} on output. A special @code{BINMODE} variable @value{COMMONEXT} @@ -38268,8 +38048,8 @@ The people maintaining the various @command{gawk} ports are: @item MS-Windows with MinGW @tab Eli Zaretskii, @EMAIL{eliz@@gnu.org,eliz at gnu dot org} -@c Leave this in the print version on purpose. -@c OS/2 is not mentioned anywhere else in the print version though. +@c Leave this in the document on purpose. +@c OS/2 is not mentioned anywhere else though. @item OS/2 @tab Andreas Buening, @EMAIL{andreas.buening@@nexgo.de,andreas dot buening at nexgo dot de} @item VMS @tab John Malmberg, @EMAIL{wb8tyw@@qsl.net,wb8tyw at qsl.net} @@ -38529,9 +38309,6 @@ cd gawk-@value{VERSION}.@value{PATCHLEVEL} @command{gawk} may be built on non-POSIX systems as well. The currently supported systems are MS-Windows using MSYS, MinGW, and Cygwin, -@ifclear FOR_PRINT -OS/2 using EMX, -@end ifclear and both Vax/VMS and OpenVMS. Instructions for each system are included in this @value{APPENDIX}. @@ -42024,7 +41801,7 @@ Consistency issues: Use @code{xxx} for the xxx operator in indexing statements, not @samp. Use MS-Windows not MS Windows - Use MS-DOS not MS-DOS + Use MS-DOS not MS DOS Use an empty set of parentheses after built-in and awk function names. Use "multiFOO" without a hyphen. @@ -1,23 +1,23 @@ /* - * eval.c - gawk bytecode interpreter + * eval.c - gawk bytecode interpreter */ -/* +/* * Copyright (C) 1986, 1988, 1989, 1991-2016 the Free Software Foundation, Inc. - * + * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. - * + * * GAWK is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. - * + * * GAWK is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA @@ -53,7 +53,7 @@ static NODE *node_Boolean[2]; #ifdef C #undef C #endif -#define C(c) ((char)c) +#define C(c) ((char)c) /* * This table is used by the regexp routines to do case independent * matching. Basically, every ascii character maps to itself, except @@ -314,7 +314,7 @@ static struct optypetab { { "Op_match", " ~ " }, { "Op_match_rec", NULL }, { "Op_nomatch", " !~ " }, - { "Op_rule", NULL }, + { "Op_rule", NULL }, { "Op_K_case", "case" }, { "Op_K_default", "default" }, { "Op_K_break", "break" }, @@ -639,7 +639,7 @@ push_frame(NODE *f) } if (fcall_count > 1) - memmove(fcall_list + 2, fcall_list + 1, (fcall_count - 1) * sizeof(NODE *)); + memmove(fcall_list + 2, fcall_list + 1, (fcall_count - 1) * sizeof(NODE *)); fcall_list[1] = f; } @@ -650,7 +650,7 @@ static void pop_frame() { if (fcall_count > 1) - memmove(fcall_list + 1, fcall_list + 2, (fcall_count - 1) * sizeof(NODE *)); + memmove(fcall_list + 1, fcall_list + 2, (fcall_count - 1) * sizeof(NODE *)); fcall_count--; assert(fcall_count >= 0); if (do_debug) @@ -1069,7 +1069,7 @@ STACK_ITEM *stack_bottom; STACK_ITEM *stack_top; static unsigned long STACK_SIZE = 256; /* initial size of stack */ int max_args = 0; /* maximum # of arguments to printf, print, sprintf, - * or # of array subscripts, or adjacent strings + * or # of array subscripts, or adjacent strings * to be concatenated. */ NODE **args_array = NULL; @@ -1141,7 +1141,7 @@ r_get_lhs(NODE *n, bool reference) /* r_get_field --- get the address of a field node */ - + NODE ** r_get_field(NODE *n, Func_ptr *assign, bool reference) { @@ -1213,7 +1213,7 @@ calc_exp(AWKNUM x1, AWKNUM x2) } -/* setup_frame --- setup new frame for function call */ +/* setup_frame --- setup new frame for function call */ static INSTRUCTION * setup_frame(INSTRUCTION *pc) @@ -1255,7 +1255,7 @@ setup_frame(INSTRUCTION *pc) } - /* check for extra args */ + /* check for extra args */ if (arg_count > pcount) { warning( _("function `%s' called with more arguments than declared"), @@ -1349,7 +1349,7 @@ setup_frame(INSTRUCTION *pc) /* setup new frame */ getnode(frame_ptr); - frame_ptr->type = Node_frame; + frame_ptr->type = Node_frame; frame_ptr->stack = sp; frame_ptr->prev_frame_size = (stack_ptr - stack_bottom); /* size of the previous stack frame */ frame_ptr->func_node = f; @@ -1467,7 +1467,7 @@ unwind_stack(long n) if (in_main_context() && ! exiting) fatal(_("unwind_stack: unexpected type `%s'"), nodetype2str(r->type)); - /* else + /* else * Node_var_array, * Node_param_list, * Node_var (e.g: trying to use scalar for array) @@ -1481,7 +1481,7 @@ unwind_stack(long n) break; } return cp; -} +} /* pop_fcall --- pop off the innermost frame */ @@ -1529,7 +1529,7 @@ cmp_scalars(scalar_cmp_t comparison_type) } /* op_assign --- assignment operators excluding = */ - + static void op_assign(OPCODE op) { @@ -1631,9 +1631,9 @@ POP_CODE() typedef struct exec_state { struct exec_state *next; - INSTRUCTION *cptr; /* either getline (Op_K_getline) or the + INSTRUCTION *cptr; /* either getline (Op_K_getline) or the * implicit "open-file, read-record" loop (Op_newfile). - */ + */ int rule; /* rule for the INSTRUCTION */ @@ -1699,7 +1699,7 @@ register_exec_hook(Func_pre_exec preh, Func_post_exec posth) /* * multiple post-exec hooks aren't supported. post-exec hook is mainly * for use by the debugger. - */ + */ if (! preh || (post_execute && posth)) return false; @@ -1727,7 +1727,7 @@ register_exec_hook(Func_pre_exec preh, Func_post_exec posth) } -/* interpreter routine when not debugging */ +/* interpreter routine when not debugging */ #include "interpret.h" /* interpreter routine with exec hook(s). Used when debugging and/or with MPFR. */ @@ -1775,6 +1775,6 @@ init_interpret() if (num_exec_hook > 0) interpret = h_interpret; else - interpret = r_interpret; + interpret = r_interpret; } @@ -9,20 +9,20 @@ /* * Copyright (C) 1995 - 2001, 2003-2014, 2016, * the Free Software Foundation, Inc. - * + * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. - * + * * GAWK is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. - * + * * GAWK is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA @@ -120,15 +120,15 @@ make_builtin(const awk_ext_func_t *funcinfo) /* user-defined function */ fatal(_("make_builtin: can't redefine function `%s'"), name); } else if (f->type == Node_ext_func) { - /* multiple extension() calls etc. */ + /* multiple extension() calls etc. */ if (do_lint) lintwarn(_("make_builtin: function `%s' already defined"), name); return awk_false; } else - /* variable name etc. */ + /* variable name etc. */ fatal(_("make_builtin: function name `%s' previously defined"), name); } else if (check_special(name) >= 0) - fatal(_("make_builtin: can't use gawk built-in `%s' as function name"), name); + fatal(_("make_builtin: can't use gawk built-in `%s' as function name"), name); if (count < 0) fatal(_("make_builtin: negative argument count for function `%s'"), @@ -154,7 +154,7 @@ get_argument(int i) NODE *t; int arg_count; INSTRUCTION *pc; - + pc = TOP()->code_ptr; /* Op_ext_builtin instruction */ arg_count = pc->expr_count; /* # of arguments supplied */ @@ -167,7 +167,7 @@ get_argument(int i) if (t->type == Node_array_ref) { if (t->orig_array->type == Node_var) { - /* already a scalar, can no longer use it as array */ + /* already a scalar, can no longer use it as array */ t->type = Node_var; t->var_value = Nnull_string; return t; @@ -191,10 +191,10 @@ get_actual_argument(NODE *t, int i, bool want_array) { char *fname; INSTRUCTION *pc; - + pc = TOP()->code_ptr; /* Op_ext_builtin instruction */ fname = (pc + 1)->func_name; - + if (t->type == Node_var_new) { if (want_array) return force_array(t, false); @@ -239,7 +239,7 @@ close_extensions() if (srcfiles == NULL) return; - for (s = srcfiles->next; s != srcfiles; s = s->next) + for (s = srcfiles->next; s != srcfiles; s = s->next) if (s->stype == SRC_EXTLIB && s->fini_func) (*s->fini_func)(); } diff --git a/extension/ChangeLog b/extension/ChangeLog index d179b8e4..52d4ddb5 100644 --- a/extension/ChangeLog +++ b/extension/ChangeLog @@ -1,3 +1,7 @@ +2016-10-23 Arnold D. Robbins <arnold@skeeve.com> + + * General: Remove trailing whitespace from all relevant files. + 2016-08-25 Arnold D. Robbins <arnold@skeeve.com> * 4.1.4: Release tar ball made. diff --git a/extension/filefuncs.c b/extension/filefuncs.c index 00387cf9..a074de53 100644 --- a/extension/filefuncs.c +++ b/extension/filefuncs.c @@ -12,20 +12,20 @@ /* * Copyright (C) 2001, 2004, 2005, 2010-2016 * the Free Software Foundation, Inc. - * + * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. - * + * * GAWK is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. - * + * * GAWK is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA @@ -484,7 +484,7 @@ do_stat(int nargs, awk_value_t *result) warning(ext_id, _("stat: bad parameters")); return make_number(-1, result); } - + if (nargs == 3) { statfunc = stat; } @@ -561,7 +561,7 @@ do_statvfs(int nargs, awk_value_t *result) #endif array_set_numeric(array, "flag", vfsbuf.f_flag); /* mount flags */ array_set_numeric(array, "namemax", vfsbuf.f_namemax); /* maximum filename length */ - + return make_number(ret, result); } diff --git a/extension/fnmatch.c b/extension/fnmatch.c index a85bcc78..f5fb02c6 100644 --- a/extension/fnmatch.c +++ b/extension/fnmatch.c @@ -8,20 +8,20 @@ /* * Copyright (C) 2012, 2013 the Free Software Foundation, Inc. - * + * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. - * + * * GAWK is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. - * + * * GAWK is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/extension/fork.c b/extension/fork.c index 0ca0a0e0..82593b7f 100644 --- a/extension/fork.c +++ b/extension/fork.c @@ -7,20 +7,20 @@ /* * Copyright (C) 2001, 2004, 2011, 2012, 2013 the Free Software Foundation, Inc. - * + * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. - * + * * GAWK is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. - * + * * GAWK is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/extension/inplace.c b/extension/inplace.c index c7eb5564..26c37922 100644 --- a/extension/inplace.c +++ b/extension/inplace.c @@ -4,20 +4,20 @@ /* * Copyright (C) 2013-2015 the Free Software Foundation, Inc. - * + * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. - * + * * GAWK is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. - * + * * GAWK is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA @@ -132,7 +132,7 @@ do_inplace_begin(int nargs, awk_value_t *result) if (nargs != 2) fatal(ext_id, _("inplace_begin: expects 2 arguments but called with %d"), nargs); - + if (! get_argument(0, AWK_STRING, &filename)) fatal(ext_id, _("inplace_begin: cannot retrieve 1st argument as a string filename")); diff --git a/extension/ordchr.c b/extension/ordchr.c index 8ec9de3f..4f9cd616 100644 --- a/extension/ordchr.c +++ b/extension/ordchr.c @@ -10,20 +10,20 @@ /* * Copyright (C) 2001, 2004, 2011, 2012, 2013 the Free Software Foundation, Inc. - * + * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. - * + * * GAWK is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. - * + * * GAWK is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/extension/readdir.c b/extension/readdir.c index 4578b864..6106a44b 100644 --- a/extension/readdir.c +++ b/extension/readdir.c @@ -11,20 +11,20 @@ /* * Copyright (C) 2012-2014 the Free Software Foundation, Inc. - * + * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. - * + * * GAWK is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. - * + * * GAWK is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/extension/readfile.c b/extension/readfile.c index 7673589f..fbe25748 100644 --- a/extension/readfile.c +++ b/extension/readfile.c @@ -14,20 +14,20 @@ /* * Copyright (C) 2002, 2003, 2004, 2011, 2012, 2013, 2014 * the Free Software Foundation, Inc. - * + * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. - * + * * GAWK is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. - * + * * GAWK is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/extension/revoutput.c b/extension/revoutput.c index 69257167..84d0aaa5 100644 --- a/extension/revoutput.c +++ b/extension/revoutput.c @@ -8,20 +8,20 @@ /* * Copyright (C) 2012, 2013, 2015 the Free Software Foundation, Inc. - * + * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. - * + * * GAWK is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. - * + * * GAWK is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/extension/revtwoway.c b/extension/revtwoway.c index dfe58a1e..82fabb2b 100644 --- a/extension/revtwoway.c +++ b/extension/revtwoway.c @@ -8,20 +8,20 @@ /* * Copyright (C) 2012-2014, 2016 the Free Software Foundation, Inc. - * + * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. - * + * * GAWK is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. - * + * * GAWK is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/extension/rwarray.c b/extension/rwarray.c index e751ea2c..15e121af 100644 --- a/extension/rwarray.c +++ b/extension/rwarray.c @@ -8,20 +8,20 @@ /* * Copyright (C) 2009-2014 the Free Software Foundation, Inc. - * + * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. - * + * * GAWK is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. - * + * * GAWK is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA @@ -80,7 +80,7 @@ static awk_bool_t read_value(FILE *fp, awk_value_t *value); * Minor version 4 bytes - network order * Element count 4 bytes - network order * Elements - * + * * For each element: * Length of index val: 4 bytes - network order * Index val as characters (N bytes) @@ -436,7 +436,7 @@ read_value(FILE *fp, awk_value_t *value) awk_array_t array = create_array(); if (! read_array(fp, array)) - return awk_false; + return awk_false; /* hook into value */ value->val_type = AWK_ARRAY; diff --git a/extension/rwarray0.c b/extension/rwarray0.c index ec3663cc..00289cad 100644 --- a/extension/rwarray0.c +++ b/extension/rwarray0.c @@ -8,20 +8,20 @@ /* * Copyright (C) 2009, 2010, 2011, 2012, 2013 the Free Software Foundation, Inc. - * + * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. - * + * * GAWK is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. - * + * * GAWK is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA @@ -76,7 +76,7 @@ static awk_bool_t read_value(int fd, awk_value_t *value); * Minor version 4 bytes - network order * Element count 4 bytes - network order * Elements - * + * * For each element: * Length of index val: 4 bytes - network order * Index val as characters (N bytes) @@ -431,7 +431,7 @@ read_value(int fd, awk_value_t *value) awk_array_t array = create_array(); if (read_array(fd, array) != 0) - return awk_false; + return awk_false; /* hook into value */ value->val_type = AWK_ARRAY; diff --git a/extension/stack.c b/extension/stack.c index 6150442c..637378e2 100644 --- a/extension/stack.c +++ b/extension/stack.c @@ -2,22 +2,22 @@ * stack.c -- Implementation for stack functions for use by extensions. */ -/* +/* * Copyright (C) 2012, 2013 the Free Software Foundation, Inc. - * + * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. - * + * * GAWK is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. - * + * * GAWK is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/extension/testext.c b/extension/testext.c index e2ddbe87..9216d64a 100644 --- a/extension/testext.c +++ b/extension/testext.c @@ -5,20 +5,20 @@ /* * Copyright (C) 2012, 2013, 2014, 2015 * the Free Software Foundation, Inc. - * + * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. - * + * * GAWK is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. - * + * * GAWK is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA @@ -918,22 +918,22 @@ do_get_file(int nargs, awk_value_t *result) if (ibuf) { awk_value_t idx, val; - set_array_element(res.array_cookie, + set_array_element(res.array_cookie, make_const_string("input", 5, & idx), make_number(ibuf->fd, & val)); if (ibuf->name) - set_array_element(res.array_cookie, + set_array_element(res.array_cookie, make_const_string("input_name", 10, & idx), make_const_string(ibuf->name, strlen(ibuf->name), & val)); } if (obuf) { awk_value_t idx, val; - set_array_element(res.array_cookie, + set_array_element(res.array_cookie, make_const_string("output", 6, & idx), make_number(obuf->fp ? fileno(obuf->fp) : -1, & val)); if (obuf->name) - set_array_element(res.array_cookie, + set_array_element(res.array_cookie, make_const_string("output_name", 11, & idx), make_const_string(obuf->name, strlen(obuf->name), & val)); } @@ -2,22 +2,22 @@ * field.c - routines for dealing with fields and record parsing */ -/* +/* * Copyright (C) 1986, 1988, 1989, 1991-2016 the Free Software Foundation, Inc. - * + * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. - * + * * GAWK is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. - * + * * GAWK is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA @@ -287,7 +287,7 @@ set_record(const char *buf, int cnt) memcpy(databuf, buf, cnt); /* - * Add terminating '\0' so that C library routines + * Add terminating '\0' so that C library routines * will know when to stop. */ databuf[cnt] = '\0'; @@ -363,7 +363,7 @@ set_NF() assert(NF != -1); (void) force_number(NF_node->var_value); - nf = get_number_si(NF_node->var_value); + nf = get_number_si(NF_node->var_value); if (nf < 0) fatal(_("NF set to negative value")); NF = nf; @@ -431,7 +431,7 @@ re_parse_field(long up_to, /* parse only up to this field number */ sep = scan; while (scan < end && (*scan == ' ' || *scan == '\t' || *scan == '\n')) scan++; - if (sep_arr != NULL && sep < scan) + if (sep_arr != NULL && sep < scan) set_element(nf, sep, (long)(scan - sep), sep_arr); } @@ -463,8 +463,8 @@ re_parse_field(long up_to, /* parse only up to this field number */ } (*set)(++nf, field, (long)(scan + RESTART(rp, scan) - field), n); - if (sep_arr != NULL) - set_element(nf, scan + RESTART(rp, scan), + if (sep_arr != NULL) + set_element(nf, scan + RESTART(rp, scan), (long) (REEND(rp, scan) - RESTART(rp, scan)), sep_arr); scan += REEND(rp, scan); field = scan; @@ -528,7 +528,7 @@ def_parse_field(long up_to, /* parse only up to this field number */ sep = scan; for (; nf < up_to; scan++) { /* - * special case: fs is single space, strip leading whitespace + * special case: fs is single space, strip leading whitespace */ while (scan < end && (*scan == ' ' || *scan == '\t' || *scan == '\n')) scan++; @@ -810,11 +810,11 @@ get_field(long requested, Func_ptr *assign) /* * Keep things uniform. Also, mere intention of assigning something * to $n should not make $0 invalid. Makes sense to invalidate $0 - * after the actual assignment is performed. Not a real issue in + * after the actual assignment is performed. Not a real issue in * the interpreter otherwise, but causes problem in the * debugger when watching or printing fields. */ - + if (assign != NULL) *assign = invalidate_field0; /* $0 needs reconstruction */ #endif @@ -930,12 +930,12 @@ do_split(int nargs) if (sep_arr != NULL) { if (sep_arr == arr) - fatal(_("split: cannot use the same array for second and fourth args")); + fatal(_("split: cannot use the same array for second and fourth args")); /* This checks need to be done before clearing any of the arrays */ for (tmp = sep_arr->parent_array; tmp != NULL; tmp = tmp->parent_array) if (tmp == arr) - fatal(_("split: cannot use a subarray of second arg for fourth arg")); + fatal(_("split: cannot use a subarray of second arg for fourth arg")); for (tmp = arr->parent_array; tmp != NULL; tmp = tmp->parent_array) if (tmp == sep_arr) fatal(_("split: cannot use a subarray of fourth arg for second arg")); @@ -1021,7 +1021,7 @@ do_patsplit(int nargs) if (sep_arr != NULL) { if (sep_arr == arr) - fatal(_("patsplit: cannot use the same array for second and fourth args")); + fatal(_("patsplit: cannot use the same array for second and fourth args")); /* These checks need to be done before clearing any of the arrays */ for (tmp = sep_arr->parent_array; tmp != NULL; tmp = tmp->parent_array) @@ -1115,7 +1115,7 @@ set_FIELDWIDTHS() || (*end != '\0' && ! is_blank(*end)) || !(0 < tmp && tmp <= INT_MAX) ) { - fatal_error = true; + fatal_error = true; break; } FIELDWIDTHS[i] = tmp; @@ -1186,7 +1186,7 @@ set_FS() * FS_regexp will be NULL with a non-null FS_re_yes_case. * refree() handles null argument; no need for `if (FS_regexp != NULL)' below. * Please do not remerge. - */ + */ refree(FS_re_yes_case); refree(FS_re_no_case); FS_re_yes_case = FS_re_no_case = FS_regexp = NULL; @@ -1429,19 +1429,19 @@ incr_scan(char **scanp, size_t len, mbstate_t *mbs) * BEGIN { * false = 0 * true = 1 - * + * * fpat[1] = "([^,]*)|(\"[^\"]+\")" * fpat[2] = fpat[1] * fpat[3] = fpat[1] * fpat[4] = "aa+" * fpat[5] = fpat[4] - * + * * data[1] = "Robbins,,Arnold," * data[2] = "Smith,,\"1234 A Pretty Place, NE\",Sometown,NY,12345-6789,USA" * data[3] = "Robbins,Arnold,\"1234 A Pretty Place, NE\",Sometown,NY,12345-6789,USA" * data[4] = "bbbaaacccdddaaaaaqqqq" * data[5] = "bbbaaacccdddaaaaaqqqqa" # should get trailing qqqa - * + * * for (i = 1; i in data; i++) { * printf("Splitting: <%s>\n", data[i]) * n = mypatsplit(data[i], fields, fpat[i], seps) @@ -1452,7 +1452,7 @@ incr_scan(char **scanp, size_t len, mbstate_t *mbs) * printf("seps[%s] = <%s>\n", j, seps[j]) * } * } - * + * * function mypatsplit(string, array, pattern, seps, * eosflag, non_empty, nf) # locals * { @@ -1460,7 +1460,7 @@ incr_scan(char **scanp, size_t len, mbstate_t *mbs) * delete seps * if (length(string) == 0) * return 0 - * + * * eosflag = non_empty = false * nf = 0 * while (match(string, pattern)) { @@ -1511,7 +1511,7 @@ incr_scan(char **scanp, size_t len, mbstate_t *mbs) * } * if (length(string) > 0) * seps[nf] = string - * + * * return length(array) * } */ @@ -1584,7 +1584,7 @@ fpat_parse_field(long up_to, /* parse only up to this field number */ * last match was non-empty, and at the * current character we get a zero length match, * which we don't want, so skip over it - */ + */ non_empty = false; if (sep_arr != NULL) { need_to_set_sep = false; diff --git a/floatcomp.c b/floatcomp.c index 9ba169a4..7317fa75 100644 --- a/floatcomp.c +++ b/floatcomp.c @@ -2,23 +2,23 @@ * floatcomp.c - Isolate floating point details. */ -/* +/* * Copyright (C) 1986, 1988, 1989, 1991-2011, 2016 * the Free Software Foundation, Inc. - * + * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. - * + * * GAWK is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. - * + * * GAWK is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/floatmagic.h b/floatmagic.h index c6aabd92..cb22b611 100644 --- a/floatmagic.h +++ b/floatmagic.h @@ -1,23 +1,23 @@ /* - * floatmagic.h -- Definitions of isnan and isinf for gawk. + * floatmagic.h -- Definitions of isnan and isinf for gawk. */ -/* +/* * Copyright (C) 2009 the Free Software Foundation, Inc. - * + * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. - * + * * GAWK is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. - * + * * GAWK is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA @@ -2,22 +2,22 @@ * gawkapi.c -- Implement the functions defined for gawkapi.h */ -/* +/* * Copyright (C) 2012-2016 the Free Software Foundation, Inc. - * + * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. - * + * * GAWK is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. - * + * * GAWK is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA @@ -76,7 +76,7 @@ api_get_argument(awk_ext_id_t id, size_t count, goto scalar; } } - + /* at this point, we have real type */ if (arg->type == Node_var_array || arg->type == Node_array_ref) { if (wanted != AWK_ARRAY && wanted != AWK_UNDEFINED) @@ -543,7 +543,7 @@ node_to_awk_value(NODE *node, awk_value_t *val, awk_valtype_t wanted) * - No access to special variables (NF, etc.) * - One special exception: PROCINFO. * - Use sym_update() to change a value, including from UNDEFINED - * to scalar or array. + * to scalar or array. */ /* * Lookup a variable, fills in value. No messing with the value @@ -855,7 +855,7 @@ api_set_array_element(awk_ext_id_t id, awk_array_t a_cookie, } /* - * remove_element --- remove an array element + * remove_element --- remove an array element * common code used by multiple functions */ @@ -2,22 +2,22 @@ * gawkapi.h -- Definitions for use by extension functions calling into gawk. */ -/* +/* * Copyright (C) 2012-2016 the Free Software Foundation, Inc. - * + * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. - * + * * GAWK is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. - * + * * GAWK is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA @@ -53,7 +53,7 @@ * This API purposely restricts itself to ISO C 90 features. In particular, no * bool, no // comments, no use of the restrict keyword, or anything else, * in order to provide maximal portability. - * + * * Exception: the "inline" keyword is used below in the "constructor" * functions. If your compiler doesn't support it, you should either * -Dinline='' on your command line, or use the autotools and include a @@ -136,7 +136,7 @@ typedef struct awk_input { * parser is responsible for managing its own memory buffer. * Similarly, gawk will make its own copy of RT, so the parser * is also responsible for managing this memory. - * + * * It is guaranteed that errcode is a valid pointer, so there is * no need to test for a NULL value. Gawk sets *errcode to 0, * so there is no need to set it unless an error occurs. @@ -165,7 +165,7 @@ typedef struct awk_input { /* put last, for alignment. bleah */ struct stat sbuf; /* stat buf */ - + } awk_input_buf_t; typedef struct awk_input_parser { @@ -527,7 +527,7 @@ typedef struct gawk_api { * - Read-only access to special variables (NF, etc.) * - One special exception: PROCINFO. * - Use sym_update() to change a value, including from UNDEFINED - * to scalar or array. + * to scalar or array. */ /* * Lookup a variable, fill in value. No messing with the value @@ -688,7 +688,7 @@ typedef struct gawk_api { * Look up a file. If the name is NULL or name_len is 0, it returns * data for the currently open input file corresponding to FILENAME * (and it will not access the filetype argument, so that may be - * undefined). + * undefined). * If the file is not already open, it tries to open it. * The "filetype" argument should be one of: * ">", ">>", "<", "|>", "|<", and "|&" @@ -2,23 +2,23 @@ * gawkmisc.c --- miscellanious gawk routines that are OS specific. */ -/* +/* * Copyright (C) 1986, 1988, 1989, 1991-2004, 2010, 2011 * the Free Software Foundation, Inc. - * + * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. - * + * * GAWK is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. - * + * * GAWK is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/helpers/ChangeLog b/helpers/ChangeLog index 47062233..d29071e3 100644 --- a/helpers/ChangeLog +++ b/helpers/ChangeLog @@ -1,3 +1,7 @@ +2016-10-23 Arnold D. Robbins <arnold@skeeve.com> + + * General: Remove trailing whitespace from all relevant files. + 2016-09-08 Paul Eggert <eggert@cs.ucla.edu> * testdfa.c: Adjust to DFA API changes. diff --git a/helpers/testdfa.c b/helpers/testdfa.c index fa7715f9..72b97907 100644 --- a/helpers/testdfa.c +++ b/helpers/testdfa.c @@ -2,22 +2,22 @@ * testdfa.c --- abstracted from gawk. */ -/* +/* * Copyright (C) 1986, 1988, 1989, 1991-2013 the Free Software Foundation, Inc. - * + * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. - * + * * GAWK is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. - * + * * GAWK is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA @@ -395,7 +395,7 @@ setup_pattern(const char *pattern, size_t *len) /* * Build a copy of the string (in buf) with the * escaped characters translated, and generate the regex - * from that. + * from that. */ buf = (char *) malloc(*len + 1); if (buf == NULL) { @@ -499,16 +499,16 @@ setup_pattern(const char *pattern, size_t *len) * * Parse a C escape sequence. STRING_PTR points to a variable containing a * pointer to the string to parse. That pointer is updated past the - * characters we use. The value of the escape sequence is returned. + * characters we use. The value of the escape sequence is returned. * * A negative value means the sequence \ newline was seen, which is supposed to - * be equivalent to nothing at all. + * be equivalent to nothing at all. * * If \ is followed by a null character, we return a negative value and leave - * the string pointer pointing at the null character. + * the string pointer pointing at the null character. * * If \ is followed by 000, we return 0 and leave the string pointer after the - * zeros. A value of 0 does not mean end of string. + * zeros. A value of 0 does not mean end of string. * * POSIX doesn't allow \x. */ @@ -597,7 +597,7 @@ parse_escape(const char **string_ptr) #ifdef C #undef C #endif -#define C(c) ((char)c) +#define C(c) ((char)c) /* * This table is used by the regexp routines to do case independent * matching. Basically, every ascii character maps to itself, except diff --git a/helpers/testnet.c b/helpers/testnet.c index feda38b4..cbe2d97e 100644 --- a/helpers/testnet.c +++ b/helpers/testnet.c @@ -220,9 +220,9 @@ devopen(const char *name, const char *mode) localpname = cp; while (*cp != '/' && *cp != '\0') cp++; - /* + /* * Require a port, let them explicitly put 0 if - * they don't care. + * they don't care. */ if (*cp != '/' || cp == localpname) { fprintf(stderr, _("special file name `%s' is incomplete"), name); @@ -241,7 +241,7 @@ devopen(const char *name, const char *mode) cp++; hostname = cp; while (*cp != '/' && *cp != '\0') - cp++; + cp++; if (*cp != '/' || cp == hostname) { *localpnamelastcharp = '/'; fprintf(stderr, _("must supply a remote hostname to `/inet'")); @@ -278,7 +278,7 @@ devopen(const char *name, const char *mode) char *cp, *end; unsigned long count = 0; char *ms2; - + first_time = false; if ((cp = getenv("GAWK_SOCK_RETRIES")) != NULL) { count = strtoul(cp, & end, 10); diff --git a/int_array.c b/int_array.c index 9055515f..0014a81f 100644 --- a/int_array.c +++ b/int_array.c @@ -2,23 +2,23 @@ * int_array.c - routines for arrays of integer indices. */ -/* +/* * Copyright (C) 1986, 1988, 1989, 1991-2013, 2016, * the Free Software Foundation, Inc. - * + * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. - * + * * GAWK is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. - * + * * GAWK is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA @@ -175,7 +175,7 @@ is_integer(NODE *symbol, NODE *subs) if (len == 0 || (! isdigit((unsigned char) *cp) && *cp != '-')) return NULL; - if (len > 1 && + if (len > 1 && ((*cp == '0') /* "00", "011" .. */ || (*cp == '-' && *(cp + 1) == '0') /* "-0", "-011" .. */ ) @@ -242,7 +242,7 @@ int_lookup(NODE *symbol, NODE *subs) if (! is_integer(symbol, subs)) { - xn = symbol->xarray; + xn = symbol->xarray; if (xn == NULL) { xn = symbol->xarray = make_array(); xn->vname = symbol->vname; /* shallow copy */ @@ -260,9 +260,9 @@ int_lookup(NODE *symbol, NODE *subs) hash1 = int_hash(k, symbol->array_size); if ((lhs = int_find(symbol, k, hash1)) != NULL) return lhs; - + /* It's not there, install it */ - + symbol->table_size++; /* first see if we would need to grow the array, before installing */ @@ -276,7 +276,7 @@ int_lookup(NODE *symbol, NODE *subs) /* have to recompute hash value for new size */ hash1 = int_hash(k, symbol->array_size); } - + return int_insert(symbol, k, hash1); } @@ -330,7 +330,7 @@ int_clear(NODE *symbol, NODE *subs ATTRIBUTE_UNUSED) r = b->aivalue[j]; if (r->type == Node_var_array) { assoc_clear(r); /* recursively clear all sub-arrays */ - efree(r->vname); + efree(r->vname); freenode(r); } else unref(r); @@ -456,7 +456,7 @@ int_copy(NODE *symbol, NODE *newsymb) /* find the current hash size */ cursize = symbol->array_size; - + /* allocate new table */ emalloc(new, BUCKET **, cursize * sizeof(BUCKET *), "int_copy"); memset(new, '\0', cursize * sizeof(BUCKET *)); @@ -495,7 +495,7 @@ int_copy(NODE *symbol, NODE *newsymb) newchain->ainext = NULL; pnew = & newchain->ainext; } - } + } if (symbol->xarray != NULL) { NODE *xn, *n; @@ -541,7 +541,7 @@ int_list(NODE *symbol, NODE *t) if ((assoc_kind & (AINDEX|AVALUE)) == (AINDEX|AVALUE)) elem_size = 2; list_size = elem_size * num_elems; - + if (symbol->xarray != NULL) { xn = symbol->xarray; list = xn->alist(xn, t); @@ -561,7 +561,7 @@ int_list(NODE *symbol, NODE *t) /* index */ num = b->ainum[j]; if ((assoc_kind & AISTR) != 0) { - sprintf(buf, "%ld", num); + sprintf(buf, "%ld", num); subs = make_string(buf, strlen(buf)); subs->numbr = num; subs->flags |= (NUMCUR|NUMINT); @@ -606,7 +606,7 @@ int_kilobytes(NODE *symbol) for (b = symbol->buckets[i]; b != NULL; b = b->ainext) bucket_cnt++; } - kb = (((AWKNUM) bucket_cnt) * sizeof (BUCKET) + + kb = (((AWKNUM) bucket_cnt) * sizeof (BUCKET) + ((AWKNUM) symbol->array_size) * sizeof (BUCKET *)) / 1024.0; if (symbol->xarray != NULL) @@ -740,7 +740,7 @@ int_hash(uint32_t k, uint32_t hsize) */ /* This is the final mixing function used by Paul Hsieh in SuperFastHash. */ - + k ^= k << 3; k += k >> 5; k ^= k << 4; @@ -782,7 +782,7 @@ int_insert(NODE *symbol, long k, uint32_t hash1) b = symbol->buckets[hash1]; - /* Only the first bucket in the chain can be partially full, but is never empty. */ + /* Only the first bucket in the chain can be partially full, but is never empty. */ if (b == NULL || (i = b->aicount) == 2) { getbucket(b); @@ -822,7 +822,7 @@ grow_int_table(NODE *symbol) static const unsigned long sizes[] = { 13, 127, 1021, 8191, 16381, 32749, 65497, 131101, 262147, 524309, 1048583, 2097169, - 4194319, 8388617, 16777259, 33554467, + 4194319, 8388617, 16777259, 33554467, 67108879, 134217757, 268435459, 536870923, 1073741827 }; diff --git a/interpret.h b/interpret.h index c514a591..56d2e060 100644 --- a/interpret.h +++ b/interpret.h @@ -2,22 +2,22 @@ * interpret.h --- run a list of instructions. */ -/* +/* * Copyright (C) 1986, 1988, 1989, 1991-2015 the Free Software Foundation, Inc. - * + * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. - * + * * GAWK is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. - * + * * GAWK is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA @@ -105,7 +105,7 @@ top: /* avoid false source indications */ source = NULL; sourceline = 0; - (void) nextfile(& curfile, true); /* close input data file */ + (void) nextfile(& curfile, true); /* close input data file */ /* * This used to be: * @@ -167,7 +167,7 @@ top: m = m->orig_array; } } - + switch (m->type) { case Node_var: if (do_lint && var_uninitialized(m)) @@ -209,7 +209,7 @@ uninitialized_scalar: cant_happen(); } } - break; + break; case Op_push_param: /* function argument */ m = pc->memory; @@ -247,7 +247,7 @@ uninitialized_scalar: /* for FUNCTAB, get the name as the element value */ if (t1 == func_table) { static bool warned = false; - + if (do_lint && ! warned) { warned = true; lintwarn(_("FUNCTAB is a gawk extension")); @@ -265,7 +265,7 @@ uninitialized_scalar: /* for SYMTAB, step through to the actual variable */ if (t1 == symbol_table) { static bool warned = false; - + if (do_lint && ! warned) { warned = true; lintwarn(_("SYMTAB is a gawk extension")); @@ -310,7 +310,7 @@ uninitialized_scalar: t1 = POP_ARRAY(); if (do_lint && in_array(t1, t2) == NULL) { t2 = force_string(t2); - if (pc->do_reference) + if (pc->do_reference) lintwarn(_("reference to uninitialized element `%s[\"%.*s\"]'"), array_vname(t1), (int) t2->stlen, t2->stptr); if (t2->stlen == 0) @@ -410,7 +410,7 @@ uninitialized_scalar: case Op_jmp_true: r = POP_SCALAR(); di = eval_condition(r); - DEREF(r); + DEREF(r); if (di) JUMPTO(pc->target_jmp); break; @@ -501,7 +501,7 @@ plus: case Op_minus: t2 = POP_NUMBER(); x2 = t2->numbr; - DEREF(t2); + DEREF(t2); minus: t1 = TOP_NUMBER(); r = make_number(t1->numbr - x2); @@ -551,7 +551,7 @@ quotient: r = make_number(t1->numbr / x2); DEREF(t1); REPLACE(r); - break; + break; case Op_mod_i: x2 = force_number(pc->memory)->numbr; @@ -675,7 +675,7 @@ mod: * simple variable assignment optimization, * see awkgram.y (optimize_assignment) */ - + lhs = get_lhs(pc->memory, false); unref(*lhs); r = pc->initval; /* constant initializer */ @@ -739,7 +739,7 @@ mod: } else free_wstr(*lhs); } else { - size_t nlen = t1->stlen + t2->stlen; + size_t nlen = t1->stlen + t2->stlen; char *p; emalloc(p, char *, nlen + 1, "r_interpret"); @@ -747,7 +747,7 @@ mod: memcpy(p + t1->stlen, t2->stptr, t2->stlen); /* N.B. No NUL-termination required, since make_str_node will do it. */ unref(*lhs); - t1 = *lhs = make_str_node(p, nlen, ALREADY_MALLOCED); + t1 = *lhs = make_str_node(p, nlen, ALREADY_MALLOCED); } DEREF(t2); break; @@ -762,7 +762,7 @@ mod: break; case Op_subscript_assign: - /* conditionally execute post-assignment routine for an array element */ + /* conditionally execute post-assignment routine for an array element */ if (set_idx != NULL) { di = true; @@ -997,7 +997,7 @@ arrayfor: } PUSH(m); break; - + case Op_match_rec: m = pc->memory; t1 = *get_field(0, (Func_ptr *) 0); @@ -1058,7 +1058,7 @@ match_re: } else if (f->type == Node_builtin_func) { int arg_count = (pc + 1)->expr_count; builtin_func_t the_func = lookup_builtin(t1->stptr); - + assert(the_func != NULL); /* call it */ @@ -1091,11 +1091,11 @@ match_re: npc[1] = pc[1]; npc[1].func_name = fname; /* name of the builtin */ npc[1].expr_count = bc->expr_count; /* defined max # of arguments */ - ni = npc; + ni = npc; JUMPTO(ni); } else fatal(_("function called indirectly through `%s' does not exist"), - pc->func_name); + pc->func_name); } pc->func_body = f; /* save for next call */ @@ -1129,7 +1129,7 @@ match_re: pc->expr_count = arg_count; /* actual argument count */ (pc + 1)->func_name = fname; /* name of the builtin */ (pc + 1)->expr_count = bc->expr_count; /* defined max # of arguments */ - ni = pc; + ni = pc; JUMPTO(ni); } @@ -1141,7 +1141,7 @@ match_re: m = POP_SCALAR(); /* return value */ ni = pop_fcall(); - + /* put the return value back on stack */ PUSH(m); @@ -1166,7 +1166,7 @@ match_re: /* Save execution state so that we can return to it * from Op_after_beginfile or Op_after_endfile. - */ + */ push_exec_state(pc, currule, source, stack_ptr); @@ -1224,8 +1224,8 @@ match_re: execute beginfile block */ } break; - - case Op_get_record: + + case Op_get_record: { int errcode = 0; @@ -1283,13 +1283,13 @@ match_re: JUMPTO(ni); } else { /* do run ENDFILE block(s) first. */ - + /* Execution state to return to in Op_after_endfile. */ push_exec_state(ni, currule, source, stack_ptr); JUMPTO(pc->target_endfile); - } - } /* else + } + } /* else Start over with the first rule. */ /* empty the run-time stack to avoid memory leak */ @@ -1380,7 +1380,7 @@ match_re: /* not already triggered and left expression is true */ decr_sp(); ip->triggered = true; - JUMPTO(ip->target_jmp); /* evaluate right expression */ + JUMPTO(ip->target_jmp); /* evaluate right expression */ } result = ip->triggered || di; @@ -2,23 +2,23 @@ * io.c --- routines for dealing with input and output and records */ -/* +/* * Copyright (C) 1986, 1988, 1989, 1991-2016, * the Free Software Foundation, Inc. - * + * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. - * + * * GAWK is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. - * + * * GAWK is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA @@ -357,7 +357,7 @@ init_io() * PROCINFO entries for timeout are dynamic; * We can't be any more specific than this. */ - if (PROCINFO_node != NULL) + if (PROCINFO_node != NULL) read_can_timeout = true; } @@ -417,7 +417,7 @@ after_beginfile(IOBUF **curfile) bool valid; fname = iop->public.name; - errcode = iop->errcode; + errcode = iop->errcode; valid = iop->valid; errno = 0; update_ERRNO_int(errcode); @@ -466,12 +466,12 @@ nextfile(IOBUF **curfile, bool skipping) (void) iop_close(iop); *curfile = NULL; return 1; /* run endfile block */ - } else + } else return 0; } argc = get_number_si(ARGC_node->var_value); - + for (; i < argc; i++) { tmp = make_number((AWKNUM) i); (void) force_string(tmp); @@ -596,7 +596,7 @@ inrec(IOBUF *iop, int *errcode) cnt = EOF; else if ((iop->flag & IOP_CLOSED) != 0) cnt = EOF; - else + else cnt = get_a_record(& begin, iop, errcode); /* Note that get_a_record may return -2 when I/O would block */ @@ -1021,7 +1021,7 @@ redirect_string(const char *str, size_t explen, bool not_string, #ifdef VMS /* Alpha/VMS V7.1+ C RTL is returning these instead of EMFILE (haven't tried other post-V6.2 systems) */ - else if ((errno == EIO || errno == EVMSERR) && + else if ((errno == EIO || errno == EVMSERR) && (vaxc$errno == SS$_EXQUOTA || vaxc$errno == SS$_EXBYTLM || vaxc$errno == RMS$_ACC || @@ -1167,7 +1167,7 @@ close_one() } if (rp == NULL) /* surely this is the only reason ??? */ - fatal(_("too many pipes or input files open")); + fatal(_("too many pipes or input files open")); } /* do_close --- completely close an open file or pipe */ @@ -1746,7 +1746,7 @@ devopen(const char *name, const char *mode) char *cp, *end; unsigned long count = 0; char *ms2; - + first_time = false; if ((cp = getenv("GAWK_SOCK_RETRIES")) != NULL) { count = strtoul(cp, & end, 10); @@ -1885,7 +1885,7 @@ two_way_open(const char *str, struct redirect *rp, int extfd) char c; int master, dup_master; int slave; - int save_errno; + int save_errno; pid_t pid; struct stat statb; struct termios st; @@ -2140,7 +2140,7 @@ use_pipes: #if defined(__EMX__) || defined(__MINGW32__) save_stdin = dup(0); /* duplicate stdin */ save_stdout = dup(1); /* duplicate stdout */ - + if (save_stdout == -1 || save_stdin == -1) { /* if an error occurs close all open file handles */ save_errno = errno; @@ -2153,7 +2153,7 @@ use_pipes: errno = save_errno; return false; } - + /* connect pipes to stdin and stdout */ close(1); /* close stdout */ if (dup(ctop[1]) != 1) { /* connect pipe input to stdout */ @@ -2173,7 +2173,7 @@ use_pipes: /* none of these handles must be inherited by the child process */ (void) close(ptoc[0]); /* close pipe output, child will use stdin instead */ (void) close(ctop[1]); /* close pipe input, child will use stdout instead */ - + os_close_on_exec(ptoc[1], str, "pipe", "from"); /* pipe input: output of the parent process */ os_close_on_exec(ctop[0], str, "pipe", "from"); /* pipe output: input of the parent process */ os_close_on_exec(save_stdin, str, "pipe", "from"); /* saved stdin of the parent process */ @@ -2187,7 +2187,7 @@ use_pipes: qcmd = quote_cmd(str), NULL); efree(qcmd); #endif - + /* restore stdin and stdout */ close(1); if (dup(save_stdout) != 1) { @@ -2196,7 +2196,7 @@ use_pipes: fatal(_("restoring stdout in parent process failed\n")); } close(save_stdout); - + close(0); if (dup(save_stdin) != 0) { close(save_stdin); @@ -2222,7 +2222,7 @@ use_pipes: errno = save_errno; return false; } - + if (pid == 0) { /* child */ if (close(1) == -1) fatal(_("close of stdout in child failed (%s)"), @@ -2443,10 +2443,10 @@ gawk_popen(const char *cmd, struct redirect *rp) fatal(_("moving pipe to stdout in child failed (dup: %s)"), strerror(errno)); } - + /* none of these handles must be inherited by the child process */ close(p[1]); /* close pipe input */ - + os_close_on_exec(p[0], cmd, "pipe", "from"); /* pipe output: input of the parent process */ os_close_on_exec(save_stdout, cmd, "pipe", "from"); /* saved stdout of the parent process */ @@ -2457,7 +2457,7 @@ gawk_popen(const char *cmd, struct redirect *rp) qcmd = quote_cmd(cmd), NULL); efree(qcmd); #endif - + /* restore stdout */ close(1); if (dup(save_stdout) != 1) { @@ -2685,7 +2685,7 @@ do_getline(int into_variable, IOBUF *iop) update_ERRNO_int(errcode); if (into_variable) (void) POP_ADDRESS(); - return make_number((AWKNUM) cnt); + return make_number((AWKNUM) cnt); } if (cnt == EOF) @@ -2708,8 +2708,8 @@ do_getline(int into_variable, IOBUF *iop) typedef struct { const char *envname; char **dfltp; /* pointer to address of default path */ - char **awkpath; /* array containing library search paths */ - int max_pathlen; /* length of the longest item in awkpath */ + char **awkpath; /* array containing library search paths */ + int max_pathlen; /* length of the longest item in awkpath */ } path_info; static path_info pi_awkpath = { @@ -2778,7 +2778,7 @@ init_awkpath(path_info *pi) #undef INC_PATH } -/* do_find_source --- search $AWKPATH for file, return NULL if not found */ +/* do_find_source --- search $AWKPATH for file, return NULL if not found */ static char * do_find_source(const char *src, struct stat *stb, int *errcode, path_info *pi) @@ -2802,7 +2802,7 @@ do_find_source(const char *src, struct stat *stb, int *errcode, path_info *pi) if (pi->awkpath == NULL) init_awkpath(pi); - emalloc(path, char *, pi->max_pathlen + strlen(src) + 1, "do_find_source"); + emalloc(path, char *, pi->max_pathlen + strlen(src) + 1, "do_find_source"); for (i = 0; pi->awkpath[i] != NULL; i++) { if (strcmp(pi->awkpath[i], "./") == 0 || strcmp(pi->awkpath[i], ".") == 0) *path = '\0'; @@ -2819,7 +2819,7 @@ do_find_source(const char *src, struct stat *stb, int *errcode, path_info *pi) return NULL; } -/* find_source --- find source file with default file extension handling */ +/* find_source --- find source file with default file extension handling */ char * find_source(const char *src, struct stat *stb, int *errcode, int is_extlib) @@ -3287,51 +3287,51 @@ rs1scan(IOBUF *iop, struct recmatch *recm, SCANSTATE *state) * Subject: Re: multibyte locales: any way to find if a character isn't multibyte? * Date: Mon, 23 Jun 2003 12:20:16 +0200 * Cc: isamu@yamato.ibm.com - * + * * Hi, - * + * * > Is there any way to make the following query to the current locale? * > * > Given an 8-bit value, can this value ever appear as part of * > a multibyte character? - * + * * There is no simple answer here. The easiest solution I see is to * get the current locale's codeset (via locale_charset() which is a * wrapper around nl_langinfo(CODESET)), and then perform a case-by-case * treatment of the known multibyte encodings, from GB2312 to EUC-JISX0213; * for the unibyte encodings, a single btowc() call will tell you. - * + * * > This is particularly critical for me for ASCII newline ('\n'). If I * > can be guaranteed that it never shows up as part of a multibyte character, * > I can speed up gawk considerably in mulitbyte locales. - * + * * This is much simpler to answer! * In all ASCII based multibyte encodings used for locales today (this * excludes EBCDIC based doublebyte encodings from IBM, and also excludes * ISO-2022-JP which is used for email exchange but not as a locale encoding) * ALL bytes in the range 0x00..0x2F occur only as a single character, not * as part of a multibyte character. - * + * * So it's safe to assume, but deserves a comment in the source. - * + * * Bruno *************************************************************** * From: Bruno Haible <bruno@clisp.org> * To: Aharon Robbins <arnold@skeeve.com> * Subject: Re: multibyte locales: any way to find if a character isn't multibyte? * Date: Mon, 23 Jun 2003 14:27:49 +0200 - * + * * On Monday 23 June 2003 14:11, you wrote: - * + * * > if (rs != '\n' && MB_CUR_MAX > 1) { - * + * * If you assume ASCII, you can even write - * + * * if (rs >= 0x30 && MB_CUR_MAX > 1) { - * + * * (this catches also the space character) but if portability to EBCDIC * systems is desired, your code is fine as is. - * + * * Bruno */ /* Thus, the check for \n here; big speedup ! */ @@ -3664,7 +3664,7 @@ get_a_record(char **out, /* pointer to pointer to data */ *errcode = errno; if (errno_io_retry() && retryable(iop)) return -2; - iop->flag |= IOP_AT_EOF; + iop->flag |= IOP_AT_EOF; return EOF; } else { iop->dataend = iop->buf + iop->count; @@ -3852,7 +3852,7 @@ set_RS() * in case of fatal error in make_regexp. */ refree(RS_re_yes_case); /* NULL argument is ok */ - refree(RS_re_no_case); + refree(RS_re_no_case); RS_re_yes_case = RS_re_no_case = RS_regexp = NULL; if (RS->stlen == 0) { @@ -3977,9 +3977,9 @@ inetfile(const char *str, struct inet_socket_info *isi) isi->localport.offset = cp-str; while (*cp != '/' && *cp != '\0') cp++; - /* + /* * Require a port, let them explicitly put 0 if - * they don't care. + * they don't care. */ if (*cp != '/' || ((isi->localport.len = (cp-str)-isi->localport.offset) == 0)) return false; @@ -3988,7 +3988,7 @@ inetfile(const char *str, struct inet_socket_info *isi) cp++; isi->remotehost.offset = cp-str; while (*cp != '/' && *cp != '\0') - cp++; + cp++; if (*cp != '/' || ((isi->remotehost.len = (cp-str)-isi->remotehost.offset) == 0)) return false; @@ -4004,7 +4004,7 @@ inetfile(const char *str, struct inet_socket_info *isi) */ isi->remoteport.offset = cp-str; while (*cp != '/' && *cp != '\0') - cp++; + cp++; if (*cp != '\0' || ((isi->remoteport.len = (cp-str)-isi->remoteport.offset) == 0)) return false; @@ -4020,14 +4020,14 @@ inetfile(const char *str, struct inet_socket_info *isi) /* * in_PROCINFO --- return value for a PROCINFO element with * SUBSEP seperated indices. - */ + */ static NODE * in_PROCINFO(const char *pidx1, const char *pidx2, NODE **full_idx) { char *str; size_t str_len; - NODE *r, *sub = NULL; + NODE *r, *sub = NULL; NODE *subsep = SUBSEP_node->var_value; if (PROCINFO_node == NULL || (pidx1 == NULL && pidx2 == NULL)) @@ -1,23 +1,23 @@ /* - * main.c -- Code generator and main program for gawk. + * main.c -- Code generator and main program for gawk. */ -/* +/* * Copyright (C) 1986, 1988, 1989, 1991-2016 the Free Software Foundation, Inc. - * + * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. - * + * * GAWK is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. - * + * * GAWK is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA @@ -357,7 +357,7 @@ main(int argc, char **argv) init_debug(); #ifdef HAVE_MPFR - /* Set up MPFR defaults, and register pre-exec hook to process arithmetic opcodes */ + /* Set up MPFR defaults, and register pre-exec hook to process arithmetic opcodes */ if (do_mpfr) init_mpfr(DEFAULT_PREC, DEFAULT_ROUNDMODE); #endif @@ -458,7 +458,7 @@ main(int argc, char **argv) /* Read in the program */ if (parse_program(& code_block) != 0) exit(EXIT_FAILURE); - + if (do_intl) exit(EXIT_SUCCESS); @@ -520,7 +520,7 @@ main(int argc, char **argv) if (do_tidy_mem) release_all_vars(); - + /* keep valgrind happier */ if (extra_stack) efree(extra_stack); @@ -663,7 +663,7 @@ GNU General Public License for more details.\n\ static const char blurb_part3[] = N_("You should have received a copy of the GNU General Public License\n\ along with this program. If not, see http://www.gnu.org/licenses/.\n"); - + /* multiple blurbs are needed for some brain dead compilers. */ printf(_(blurb_part1), UPDATE_YEAR); /* Last update year */ fputs(_(blurb_part2), stdout); @@ -774,7 +774,7 @@ static const struct varinit varinit[] = { {&FPAT_node, "FPAT", "[^[:space:]]+", 0, NULL, set_FPAT, false, NON_STANDARD }, {&IGNORECASE_node, "IGNORECASE", NULL, 0, NULL, set_IGNORECASE, false, NON_STANDARD }, {&LINT_node, "LINT", NULL, 0, NULL, set_LINT, false, NON_STANDARD }, -{&PREC_node, "PREC", NULL, DEFAULT_PREC, NULL, set_PREC, false, NON_STANDARD}, +{&PREC_node, "PREC", NULL, DEFAULT_PREC, NULL, set_PREC, false, NON_STANDARD}, {&NF_node, "NF", NULL, -1, update_NF, set_NF, false, 0 }, {&NR_node, "NR", NULL, 0, update_NR, set_NR, true, 0 }, {&OFMT_node, "OFMT", "%.6g", 0, NULL, set_OFMT, true, 0 }, @@ -1153,7 +1153,7 @@ arg_assign(char *arg, bool initing) if (! initing) { var = lookup(arg); if (var != NULL && var->type == Node_func) - fatal(_("cannot use function `%s' as variable name"), arg); + fatal(_("cannot use function `%s' as variable name"), arg); } /* @@ -1275,7 +1275,7 @@ version() #ifdef HAVE_MPFR printf(" (GNU MPFR %s, GNU MP %s)", mpfr_get_version(), gmp_version); #endif - printf("\n"); + printf("\n"); print_ext_versions(); /* @@ -1358,7 +1358,7 @@ estrdup(const char *str, size_t len) s[len] = '\0'; return s; } - + #if defined(HAVE_LOCALE_H) /* init_locale --- initialize locale info. */ @@ -1428,7 +1428,7 @@ long getenv_long(const char *name) { const char *val; - long newval; + long newval; if ((val = getenv(name)) != NULL && isdigit((unsigned char) *val)) { for (newval = 0; *val && isdigit((unsigned char) *val); val++) newval = (newval * 10) + *val - '0'; @@ -1454,7 +1454,7 @@ parse_args(int argc, char **argv) /* we do error messages ourselves on invalid options */ opterr = false; - /* copy argv before getopt gets to it; used to restart the debugger */ + /* copy argv before getopt gets to it; used to restart the debugger */ save_argv(argc, argv); /* option processing. ready, set, go! */ @@ -1604,7 +1604,7 @@ parse_args(int argc, char **argv) case 'r': do_flags |= DO_INTERVALS; break; - + case 's': do_optimize = false; break; diff --git a/mbsupport.h b/mbsupport.h index 37dd219d..e7b40423 100644 --- a/mbsupport.h +++ b/mbsupport.h @@ -2,23 +2,23 @@ * mbsupport.h --- Localize determination of whether we have multibyte stuff. */ -/* +/* * Copyright (C) 2004, 2005, 2011, 2012, 2015, 2016 * the Free Software Foundation, Inc. - * + * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. - * + * * GAWK is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. - * + * * GAWK is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/missing_d/ChangeLog b/missing_d/ChangeLog index 0c87aa05..83f5b93e 100644 --- a/missing_d/ChangeLog +++ b/missing_d/ChangeLog @@ -1,3 +1,7 @@ +2016-10-23 Arnold D. Robbins <arnold@skeeve.com> + + * General: Remove trailing whitespace from all relevant files. + 2016-09-07 Arnold D. Robbins <arnold@skeeve.com> * setenv.c: Update license text in setenv.c. Thanks diff --git a/missing_d/snprintf.c b/missing_d/snprintf.c index 6cee2bed..9d692d5a 100644 --- a/missing_d/snprintf.c +++ b/missing_d/snprintf.c @@ -2,22 +2,22 @@ * snprintf.c - Implement snprintf and vsnprintf on platforms that need them. */ -/* +/* * Copyright (C) 2006, 2007 the Free Software Foundation, Inc. - * + * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. - * + * * GAWK is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. - * + * * GAWK is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA @@ -2,22 +2,22 @@ * mpfr.c - routines for arbitrary-precision number support in gawk. */ -/* +/* * Copyright (C) 2012, 2013, 2015 the Free Software Foundation, Inc. - * + * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. - * + * * GAWK is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. - * + * * GAWK is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA @@ -118,7 +118,7 @@ mpg_node(unsigned int tp) mpz_init(r->mpg_i); r->flags = MPZN; } - + r->valref = 1; r->flags |= MALLOC|NUMBER|NUMCUR; r->stptr = NULL; @@ -151,7 +151,7 @@ mpg_make_number(double x) return r; } -/* mpg_strtoui --- assign arbitrary-precision integral value from a string */ +/* mpg_strtoui --- assign arbitrary-precision integral value from a string */ int mpg_strtoui(mpz_ptr zi, char *str, size_t len, char **end, int base) @@ -264,7 +264,7 @@ mpg_zero(NODE *n) n->flags &= ~MPFN; } if (! is_mpg_integer(n)) { - mpz_init(n->mpg_i); /* this also sets its value to 0 */ + mpz_init(n->mpg_i); /* this also sets its value to 0 */ n->flags |= MPZN; } else mpz_set_si(n->mpg_i, 0); @@ -335,7 +335,7 @@ done: if (errno == 0 && ptr == cpend) return true; errno = 0; - return false; + return false; } /* mpg_force_number --- force a value to be a multiple-precision number */ @@ -385,7 +385,7 @@ mpg_format_val(const char *format, int index, NODE *s) efree(s->stptr); s->stptr = r->stptr; freenode(r); /* Do not unref(r)! We want to keep s->stptr == r->stpr. */ - + s->flags |= STRCUR; free_wstr(s); return s; @@ -428,8 +428,8 @@ mpg_cmp(const NODE *t1, const NODE *t2) /* - * mpg_update_var --- update NR or FNR. - * NR_node->var_value(mpz_t) = MNR(mpz_t) * LONG_MAX + NR(long) + * mpg_update_var --- update NR or FNR. + * NR_node->var_value(mpz_t) = MNR(mpz_t) * LONG_MAX + NR(long) */ NODE * @@ -483,7 +483,7 @@ mpg_set_var(NODE *n) if (is_mpg_integer(val)) r = val->mpg_i; else { - /* convert float to integer */ + /* convert float to integer */ mpfr_get_z(mpzval, val->mpg_numbr, MPFR_RNDZ); r = mpzval; } @@ -549,7 +549,7 @@ set_PREC() if (prec <= 0) { force_number(val); - prec = get_number_si(val); + prec = get_number_si(val); if (prec < MPFR_PREC_MIN || prec > MPFR_PREC_MAX) { force_string(val); warning(_("PREC value `%.*s' is invalid"), (int) val->stlen, val->stptr); @@ -684,7 +684,7 @@ do_mpfr_atan2(int nargs) p1 = MP_FLOAT(t1); p2 = MP_FLOAT(t2); res = mpg_float(); - /* See MPFR documentation for handling of special values like +inf as an argument */ + /* See MPFR documentation for handling of special values like +inf as an argument */ tval = mpfr_atan2(res->mpg_numbr, p1, p2, ROUND_MODE); IEEE_FMT(res->mpg_numbr, tval); @@ -824,11 +824,11 @@ do_mpfr_compl(int nargs) mpg_fmt(_("comp(%Rg): fractional value will be truncated"), p) ); } - + mpfr_get_z(mpzval, p, MPFR_RNDZ); /* float to integer conversion */ zptr = mpzval; } else { - /* (tmp->flags & MPZN) != 0 */ + /* (tmp->flags & MPZN) != 0 */ zptr = tmp->mpg_i; if (do_lint) { if (mpz_sgn(zptr) < 0) @@ -889,8 +889,8 @@ get_intval(NODE *t1, int argnum, const char *op) mpz_init(pz); mpfr_get_z(pz, left, MPFR_RNDZ); /* float to integer conversion */ return pz; /* should be freed */ - } - /* (t1->flags & MPZN) != 0 */ + } + /* (t1->flags & MPZN) != 0 */ pz = t1->mpg_i; if (do_lint) { if (mpz_sgn(pz) < 0) @@ -923,7 +923,7 @@ do_mpfr_lshift(int nargs) NODE *t1, *t2, *res; unsigned long shift; mpz_ptr pz1, pz2; - + t2 = POP_SCALAR(); t1 = POP_SCALAR(); @@ -955,7 +955,7 @@ do_mpfr_rshift(int nargs) NODE *t1, *t2, *res; unsigned long shift; mpz_ptr pz1, pz2; - + t2 = POP_SCALAR(); t1 = POP_SCALAR(); @@ -965,7 +965,7 @@ do_mpfr_rshift(int nargs) /* N.B: See do_mpfp_lshift. */ shift = mpz_get_ui(pz2); /* GMP integer => unsigned long conversion */ res = mpg_integer(); - mpz_fdiv_q_2exp(res->mpg_i, pz1, shift); /* res = pz1 / 2^shift, round towards −inf */ + mpz_fdiv_q_2exp(res->mpg_i, pz1, shift); /* res = pz1 / 2^shift, round towards -inf */ free_intval(t1, pz1); free_intval(t2, pz2); @@ -1286,13 +1286,13 @@ mpg_tofloat(mpfr_ptr mf, mpz_ptr mz) /* * When implicitely converting a GMP integer operand to a MPFR float, use * a precision sufficiently large to hold the converted value exactly. - * + * * $ ./gawk -M 'BEGIN { print 13 % 2 }' * 1 * If the user-specified precision is used to convert the integer 13 to a * float, one will get: * $ ./gawk -M 'BEGIN { PREC=2; print 13 % 2.0 }' - * 0 + * 0 */ prec = mpz_sizeinbase(mz, 2); /* most significant 1 bit position starting at 1 */ @@ -1306,7 +1306,7 @@ mpg_tofloat(mpfr_ptr mf, mpz_ptr mz) else prec = PRECISION_MIN; /* - * Always set the precision to avoid hysteresis, since do_mpfr_func + * Always set the precision to avoid hysteresis, since do_mpfr_func * may copy our precision. */ if (prec != mpfr_get_prec(mf)) @@ -1317,7 +1317,7 @@ mpg_tofloat(mpfr_ptr mf, mpz_ptr mz) } -/* mpg_add --- add arbitrary-precision numbers */ +/* mpg_add --- add arbitrary-precision numbers */ static NODE * mpg_add(NODE *t1, NODE *t2) @@ -1400,7 +1400,7 @@ mpg_mul(NODE *t1, NODE *t2) } -/* mpg_pow --- exponentiation involving arbitrary-precision numbers */ +/* mpg_pow --- exponentiation involving arbitrary-precision numbers */ static NODE * mpg_pow(NODE *t1, NODE *t2) @@ -1499,11 +1499,11 @@ mpg_mod(NODE *t1, NODE *t2) } return r; } - + /* * mpg_interpret --- pre-exec hook in the interpreter. Handles * arithmetic operations with MPFR/GMP numbers. - */ + */ static int mpg_interpret(INSTRUCTION **cp) @@ -1584,7 +1584,7 @@ quotient: if (op == Op_quotient) DEREF(t2); REPLACE(r); - break; + break; case Op_mod_i: t2 = force_number(pc->memory); @@ -2,23 +2,23 @@ * msg.c - routines for error messages. */ -/* +/* * Copyright (C) 1986, 1988, 1989, 1991-2001, 2003, 2010-2013 * the Free Software Foundation, Inc. - * + * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. - * + * * GAWK is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. - * + * * GAWK is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA @@ -2,23 +2,23 @@ * node.c -- routines for node management */ -/* +/* * Copyright (C) 1986, 1988, 1989, 1991-2001, 2003-2015, * the Free Software Foundation, Inc. - * + * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. - * + * * GAWK is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. - * + * * GAWK is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA @@ -174,7 +174,7 @@ goodnum: /* * The following lookup table is used as an optimization in force_string; - * (more complicated) variations on this theme didn't seem to pay off, but + * (more complicated) variations on this theme didn't seem to pay off, but * systematic testing might be in order at some point. */ static const char *values[] = { @@ -323,7 +323,7 @@ r_dupnode(NODE *n) r->flags |= WSTRCUR; } } - + return r; } @@ -394,7 +394,7 @@ make_str_node(const char *s, size_t len, int flags) memcpy(r->stptr, s, len); } r->stptr[len] = '\0'; - + if ((flags & SCAN) != 0) { /* scan for escape sequences */ const char *pf; char *ptm; @@ -478,16 +478,16 @@ r_unref(NODE *tmp) * * Parse a C escape sequence. STRING_PTR points to a variable containing a * pointer to the string to parse. That pointer is updated past the - * characters we use. The value of the escape sequence is returned. + * characters we use. The value of the escape sequence is returned. * * A negative value means the sequence \ newline was seen, which is supposed to - * be equivalent to nothing at all. + * be equivalent to nothing at all. * * If \ is followed by a null character, we return a negative value and leave - * the string pointer pointing at the null character. + * the string pointer pointing at the null character. * * If \ is followed by 000, we return 0 and leave the string pointer after the - * zeros. A value of 0 does not mean end of string. + * zeros. A value of 0 does not mean end of string. * * POSIX doesn't allow \x. */ @@ -981,7 +981,7 @@ void init_btowc_cache() #define BLOCKCHUNK 100 BLOCK nextfree[BLOCK_MAX] = { - { 0, NULL}, /* invalid */ + { 0, NULL}, /* invalid */ { sizeof(NODE), NULL }, { sizeof(BUCKET), NULL }, }; @@ -2,22 +2,22 @@ * nonposix.h --- definitions needed on non-POSIX systems. */ -/* +/* * Copyright (C) 2012, 2013, 2016 the Free Software Foundation, Inc. - * + * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. - * + * * GAWK is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. - * + * * GAWK is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA diff --git a/old-extension/ChangeLog b/old-extension/ChangeLog index 3c91b7cd..bd848f9a 100644 --- a/old-extension/ChangeLog +++ b/old-extension/ChangeLog @@ -1,3 +1,7 @@ +2016-10-23 Arnold D. Robbins <arnold@skeeve.com> + + * General: Remove trailing whitespace from all relevant files. + 2015-04-09 Andrew J. Schorr <aschorr@telemetry-investments.com> * bindarr.c (do_bind_array): Undo Arnold's change of 2014-12-18. diff --git a/old-extension/bindarr.c b/old-extension/bindarr.c index 41467425..1a0104db 100644 --- a/old-extension/bindarr.c +++ b/old-extension/bindarr.c @@ -3,22 +3,22 @@ * to array and array elements. */ -/* +/* * Copyright (C) 1986, 1988, 1989, 1991-2011 the Free Software Foundation, Inc. - * + * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. - * + * * GAWK is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. - * + * * GAWK is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA @@ -286,7 +286,7 @@ do_unbind_array(int nargs) *symbol = *xn; freenode(xn); - return make_number(0); + return make_number(0); } diff --git a/old-extension/fileop.c b/old-extension/fileop.c index d76a7ded..97a51c81 100644 --- a/old-extension/fileop.c +++ b/old-extension/fileop.c @@ -5,20 +5,20 @@ /* * Copyright (C) 2012 the Free Software Foundation, Inc. - * + * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. - * + * * GAWK is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. - * + * * GAWK is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA @@ -379,7 +379,7 @@ dlload(NODE *tree, void *dl) } -/* dlunload --- routine called when exiting */ +/* dlunload --- routine called when exiting */ void dlunload() diff --git a/old-extension/sparr.c b/old-extension/sparr.c index a3d06e66..1e8642dd 100644 --- a/old-extension/sparr.c +++ b/old-extension/sparr.c @@ -5,20 +5,20 @@ /* * Copyright (C) 2012 the Free Software Foundation, Inc. - * + * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. - * + * * GAWK is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. - * + * * GAWK is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA @@ -75,7 +75,7 @@ static void store_SYS(NODE *symbol, NODE *subs, NODE *val, void *data) { sdata_t *sd = (sdata_t *) data; - + if (subs != NULL && val != NULL && val->type == Node_val) { force_string(subs); if (strcmp(subs->stptr, "readline") == 0) { @@ -98,7 +98,7 @@ load_READLINE(NODE *symbol, void *data) int i; bool long_line = false; - if (! sd->load_file) /* non-existent SYS["readline"] or already loaded */ + if (! sd->load_file) /* non-existent SYS["readline"] or already loaded */ return; file = sd->filename; @@ -145,7 +145,7 @@ load_READLINE(NODE *symbol, void *data) } fclose(fp); sd->load_file = false; /* don't load this file again */ -} +} /* dlload --- load this library */ diff --git a/old-extension/spec_array.c b/old-extension/spec_array.c index 34d15fc5..f933aa35 100644 --- a/old-extension/spec_array.c +++ b/old-extension/spec_array.c @@ -4,20 +4,20 @@ /* * Copyright (C) 2012, 2014 the Free Software Foundation, Inc. - * + * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. - * + * * GAWK is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. - * + * * GAWK is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA @@ -52,7 +52,7 @@ typedef struct spec_array { * void load_func(NODE *array, void *data) * * Use register_deferred_array(array, load_func, void *data) to - * bind an array to the load routine. + * bind an array to the load routine. */ static NODE **deferred_array_init(NODE *, NODE *); @@ -72,7 +72,7 @@ static afunc_t deferred_array_func[] = { deferred_array_exists, deferred_array_clear, deferred_array_remove, - deferred_array_list, + deferred_array_list, deferred_array_copy, null_afunc, /* dump */ (afunc_t) 0, /* store */ @@ -86,7 +86,7 @@ deferred_array_init(NODE *symbol, NODE *subs) { if (symbol != NULL) { array_t *av = (array_t *) symbol->xarray; - symbol->xarray = NULL; /* this is to avoid an assertion failure in null_array */ + symbol->xarray = NULL; /* this is to avoid an assertion failure in null_array */ null_array(symbol); /* typeless empty array */ if (symbol->parent_array == NULL) { /* main array */ @@ -141,7 +141,7 @@ static NODE ** deferred_array_remove(NODE *symbol, NODE *subs) { array_t *av = (array_t *) symbol->xarray; - + (void) SUPER(aremove)(symbol, subs); if (av) { symbol->xarray = NULL; @@ -157,7 +157,7 @@ static NODE ** deferred_array_clear(NODE *symbol, NODE *subs) { array_t *av = (array_t *) symbol->xarray; - + (void) SUPER(aclear)(symbol, subs); if (av) { symbol->xarray = NULL; @@ -181,7 +181,7 @@ deferred_array_clear(NODE *symbol, NODE *subs) * The store routine must take an additional argument for the * value. The value can be NULL if the specific element is * removed from the array. The subscript (and the value) is NULL - * when the entire array is deleted. + * when the entire array is deleted. * * void store_func(NODE *array, NODE *subs, NODE *value, void *data) * @@ -207,7 +207,7 @@ static afunc_t dyn_array_func[] = { dyn_array_exists, dyn_array_clear, dyn_array_remove, - dyn_array_list, + dyn_array_list, dyn_array_copy, null_afunc, /* dump */ dyn_array_store, diff --git a/pc/ChangeLog b/pc/ChangeLog index 8d844018..2b4b1183 100644 --- a/pc/ChangeLog +++ b/pc/ChangeLog @@ -1,3 +1,7 @@ +2016-10-23 Arnold D. Robbins <arnold@skeeve.com> + + * General: Remove trailing whitespace from all relevant files. + 2016-09-24 Eli Zaretskii <eliz@gnu.org> Fix compilation warnings on MinGW with the latest runtime. @@ -104,7 +104,7 @@ scriptify(const char *command) free(cmd); cmd = NULL; } - if (fp) fclose(fp); + if (fp) fclose(fp); return(cmd); } diff --git a/posix/ChangeLog b/posix/ChangeLog index c5ce0340..cd1a2f68 100644 --- a/posix/ChangeLog +++ b/posix/ChangeLog @@ -1,3 +1,7 @@ +2016-10-23 Arnold D. Robbins <arnold@skeeve.com> + + * General: Remove trailing whitespace from all relevant files. + 2016-08-25 Arnold D. Robbins <arnold@skeeve.com> * 4.1.4: Release tar ball made. diff --git a/posix/gawkmisc.c b/posix/gawkmisc.c index d422bd0f..40950826 100644 --- a/posix/gawkmisc.c +++ b/posix/gawkmisc.c @@ -1,5 +1,5 @@ /* gawkmisc.c --- miscellaneous gawk routines that are OS specific. - + Copyright (C) 1986, 1988, 1989, 1991 - 1998, 2001 - 2004, 2011 the Free Software Foundation, Inc. @@ -40,7 +40,7 @@ char * gawk_name(const char *filespec) { char *p; - + /* "path/name" -> "name" */ p = strrchr(filespec, '/'); return (p == NULL ? (char *) filespec : p + 1); @@ -272,7 +272,7 @@ os_isatty(int fd) { return isatty(fd); } - + /* files_are_same --- return true if files are identical */ int @@ -2,22 +2,22 @@ * profile.c - gawk bytecode pretty-printer with counts */ -/* +/* * Copyright (C) 1999-2016 the Free Software Foundation, Inc. - * + * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. - * + * * GAWK is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. - * + * * GAWK is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA @@ -225,10 +225,10 @@ pprint(INSTRUCTION *startp, INSTRUCTION *endp, int flags) case Op_rule: /* * Rules are three instructions long. - * See append_rule in awkgram.y. - * The first has the Rule Op Code, nexti etc. + * See append_rule in awkgram.y. + * The first has the Rule Op Code, nexti etc. * The second, (pc + 1) has firsti and lasti: - * the first/last ACTION instructions for this rule. + * the first/last ACTION instructions for this rule. * The third has first_line and last_line: * the first and last source line numbers. */ @@ -265,7 +265,7 @@ pprint(INSTRUCTION *startp, INSTRUCTION *endp, int flags) t1 = pp_pop(); fprintf(prof_fp, "%s {", t1->pp_str); pp_free(t1); - } else + } else fprintf(prof_fp, "{"); ip1 = (pc + 1)->firsti; ip2 = (pc + 1)->lasti; @@ -347,7 +347,7 @@ pprint(INSTRUCTION *startp, INSTRUCTION *endp, int flags) cant_happen(); } - switch (pc->opcode) { + switch (pc->opcode) { case Op_store_var: t2 = pp_pop(); /* l.h.s. */ t1 = pp_pop(); /* r.h.s. */ @@ -390,7 +390,7 @@ cleanup: efree(tmp); pp_free(t1); pp_push(pc->opcode, str, CAN_FREE); - break; + break; case Op_and: case Op_or: @@ -503,7 +503,7 @@ cleanup: pp_free(t1); if ((flags & IN_FOR_HEADER) == 0) pc = end_line(pc); - break; + break; case Op_concat: str = pp_concat(pc->expr_count); @@ -520,7 +520,7 @@ cleanup: sub = pp_list(pc->expr_count, NULL, pc->expr_count > 1 ? "][" : ", "); fprintf(prof_fp, "%s %s[%s]", op2str(Op_K_delete), array, sub); efree(sub); - } else + } else fprintf(prof_fp, "%s %s", op2str(Op_K_delete), array); if ((flags & IN_FOR_HEADER) == 0) pc = end_line(pc); @@ -532,7 +532,7 @@ cleanup: /* Efficency hack not in effect because of exec_count instruction */ cant_happen(); break; - + case Op_in_array: { char *array, *sub; @@ -561,7 +561,7 @@ cleanup: case Op_field_assign: case Op_subscript_assign: case Op_arrayfor_init: - case Op_arrayfor_incr: + case Op_arrayfor_incr: case Op_arrayfor_final: case Op_newfile: case Op_get_record: @@ -622,7 +622,7 @@ cleanup: else { tmp = pp_list(pc->expr_count, " ", ", "); tmp[strlen(tmp) - 1] = '\0'; /* remove trailing space */ - } + } if (pc->redir_type != 0) { t1 = pp_pop(); @@ -641,7 +641,7 @@ cleanup: case Op_push_re: if (pc->memory->type != Node_regex) break; - /* else + /* else fall through */ case Op_match_rec: { @@ -716,7 +716,7 @@ cleanup: if (pc->opcode == Op_indirect_func_call) pre = "@"; else - pre = ""; + pre = ""; pcount = (pc + 1)->expr_count; if (pcount > 0) { tmp = pp_list(pcount, "()", ", "); @@ -812,7 +812,7 @@ cleanup: case Op_K_for: ip1 = pc + 1; indent(ip1->forloop_body->exec_count); - fprintf(prof_fp, "%s (", op2str(pc->opcode)); + fprintf(prof_fp, "%s (", op2str(pc->opcode)); /* If empty for looop header, print it a little more nicely. */ if ( pc->nexti->opcode == Op_no_op @@ -990,7 +990,7 @@ cleanup: pc = ip1->nexti; assert(pc->opcode == Op_cond_exp); - pprint(pc->nexti, pc->branch_end, NO_PPRINT_FLAGS); + pprint(pc->nexti, pc->branch_end, NO_PPRINT_FLAGS); f = pp_pop(); t = pp_pop(); @@ -1006,7 +1006,7 @@ cleanup: pp_push(Op_cond_exp, str, CAN_FREE); pc = pc->branch_end; } - break; + break; case Op_exec_count: if (flags == NO_PPRINT_FLAGS) @@ -1042,7 +1042,7 @@ end_line(INSTRUCTION *ip) print_comment(ip->nexti, -1); ret = ip->nexti; } - else + else fprintf(prof_fp, "\n"); return ret; @@ -1554,7 +1554,7 @@ pp_list(int nargs, const char *paren, const char *delim) emalloc(str, char *, len + 1, "pp_list"); s = str; if (paren != NULL) - *s++ = paren[0]; + *s++ = paren[0]; if (nargs > 0) { r = pp_args[nargs]; memcpy(s, r->pp_str, r->pp_len); @@ -1574,7 +1574,7 @@ pp_list(int nargs, const char *paren, const char *delim) if (paren != NULL) *s++ = paren[1]; *s = '\0'; - return str; + return str; } /* is_unary_minus --- return true if string starts with unary minus */ @@ -1649,7 +1649,7 @@ pp_concat(int nargs) *s++ = ' '; } } - + pl_l = prec_level(pp_args[nargs-1]->type); pl_r = prec_level(pp_args[nargs]->type); r = pp_args[nargs]; @@ -1665,7 +1665,7 @@ pp_concat(int nargs) pp_free(r); *s = '\0'; - return str; + return str; } /* pp_group3 --- string together up to 3 strings */ @@ -2,22 +2,22 @@ * protos.h -- function prototypes for when the headers don't have them. */ -/* +/* * Copyright (C) 1991 - 2002, 2011 the Free Software Foundation, Inc. - * + * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. - * + * * GAWK is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. - * + * * GAWK is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA @@ -64,7 +64,7 @@ extern size_t strftime(char *, size_t, const char *, const struct tm *); extern time_t time(time_t *); extern FILE *fdopen(int, const char *); -extern int fprintf(FILE *, const char *, ...); +extern int fprintf(FILE *, const char *, ...); #if ! defined(__GNU_LIBRARY__) extern size_t fwrite(const aptr_t, size_t, size_t, FILE *); #endif @@ -124,7 +124,7 @@ extern unsigned long int strtoul(const char *, char **endptr, int base); #ifndef HAVE_TZSET extern void tzset(); #endif - + #ifndef HAVE_MKTIME extern time_t mktime(struct tm *tp); #endif @@ -2,22 +2,22 @@ * random.h - redefine name of random lib routines to avoid conflicts */ -/* +/* * Copyright (C) 1996, 2001, 2004, 2005, 2013 the Free Software Foundation, Inc. - * + * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. - * + * * GAWK is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. - * + * * GAWK is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA @@ -2,22 +2,22 @@ * re.c - compile regular expressions. */ -/* +/* * Copyright (C) 1991-2016 the Free Software Foundation, Inc. - * + * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. - * + * * GAWK is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. - * + * * GAWK is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA @@ -75,7 +75,7 @@ make_regexp(const char *s, size_t len, bool ignorecase, bool dfa, bool canfatal) /* * Build a copy of the string (in buf) with the * escaped characters translated, and generate the regex - * from that. + * from that. */ if (buf == NULL) { emalloc(buf, char *, len + 1, "make_regexp"); @@ -243,7 +243,7 @@ make_regexp(const char *s, size_t len, bool ignorecase, bool dfa, bool canfatal) break; } } - + return rp; } @@ -315,7 +315,7 @@ void refree(Regexp *rp) { if (rp == NULL) - return; + return; rp->pat.translate = NULL; regfree(& rp->pat); if (rp->regs.start) @@ -216,7 +216,7 @@ static const size_t __re_error_msgid_idx[] = #ifndef HAVE_BTOWC -wchar_t +wchar_t btowc (int c) { wchar_t wtmp[2]; @@ -2,22 +2,22 @@ * replace.c -- Get replacement versions of functions. */ -/* +/* * Copyright (C) 1989, 1991-2013 the Free Software Foundation, Inc. - * + * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. - * + * * GAWK is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. - * + * * GAWK is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA @@ -84,7 +84,7 @@ #ifndef HAVE_TZSET #include "missing_d/tzset.c" #endif /* HAVE_TZSET */ - + #ifndef HAVE_MKTIME /* mktime.c defines main() if DEBUG is set */ #undef DEBUG diff --git a/str_array.c b/str_array.c index e8ce973e..d832380d 100644 --- a/str_array.c +++ b/str_array.c @@ -2,23 +2,23 @@ * str_array.c - routines for associative arrays of string indices. */ -/* +/* * Copyright (C) 1986, 1988, 1989, 1991-2013, 2016, * the Free Software Foundation, Inc. - * + * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. - * + * * GAWK is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. - * + * * GAWK is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA @@ -126,7 +126,7 @@ str_array_init(NODE *symbol ATTRIBUTE_UNUSED, NODE *subs ATTRIBUTE_UNUSED) * isn't there. Returns a pointer ala get_lhs to where its value is stored. * * SYMBOL is the address of the node (or other pointer) being dereferenced. - * SUBS is a number or string used as the subscript. + * SUBS is a number or string used as the subscript. */ static NODE ** @@ -192,7 +192,7 @@ str_lookup(NODE *symbol, NODE *subs) } subs = tmp; } else { - /* string value already "frozen" */ + /* string value already "frozen" */ subs = dupnode(subs); } @@ -241,7 +241,7 @@ str_clear(NODE *symbol, NODE *subs ATTRIBUTE_UNUSED) r = b->ahvalue; if (r->type == Node_var_array) { assoc_clear(r); /* recursively clear all sub-arrays */ - efree(r->vname); + efree(r->vname); freenode(r); } else unref(r); @@ -318,7 +318,7 @@ str_copy(NODE *symbol, NODE *newsymb) BUCKET **old, **new, **pnew; BUCKET *chain, *newchain; unsigned long cursize, i; - + assert(symbol->table_size > 0); /* find the current hash size */ @@ -364,7 +364,7 @@ str_copy(NODE *symbol, NODE *newsymb) newchain->ahnext = NULL; pnew = & newchain->ahnext; } - } + } newsymb->table_size = symbol->table_size; newsymb->buckets = new; @@ -398,9 +398,9 @@ str_list(NODE *symbol, NODE *t) if ((assoc_kind & (AINDEX|AVALUE|ADELETE)) == (AINDEX|ADELETE)) num_elems = 1; list_size = elem_size * num_elems; - + emalloc(list, NODE **, list_size * sizeof(NODE *), "str_list"); - + /* populate it */ for (i = 0; i < symbol->array_size; i++) { @@ -424,7 +424,7 @@ str_list(NODE *symbol, NODE *t) } if (k >= list_size) return list; - } + } } return list; } @@ -441,7 +441,7 @@ str_kilobytes(NODE *symbol) bucket_cnt = symbol->table_size; /* This does not include extra memory for indices with stfmt != -1 */ - kb = (((AWKNUM) bucket_cnt) * sizeof (BUCKET) + + kb = (((AWKNUM) bucket_cnt) * sizeof (BUCKET) + ((AWKNUM) symbol->array_size) * sizeof (BUCKET *)) / 1024.0; return kb; } @@ -529,7 +529,7 @@ str_dump(NODE *symbol, NODE *ndump) return NULL; #undef HCNT -} +} /* awk_hash --- calculate the hash function of the string in subs */ @@ -642,11 +642,11 @@ grow_table(NODE *symbol) * very large (> 8K), we just double more or less, instead of * just jumping from 8K to 64K. */ - + static const unsigned long sizes[] = { 13, 127, 1021, 8191, 16381, 32749, 65497, 131101, 262147, 524309, 1048583, 2097169, - 4194319, 8388617, 16777259, 33554467, + 4194319, 8388617, 16777259, 33554467, 67108879, 134217757, 268435459, 536870923, 1073741827 }; @@ -2,22 +2,22 @@ * symbol.c - routines for symbol table management and code allocation */ -/* +/* * Copyright (C) 1986, 1988, 1989, 1991-2015 the Free Software Foundation, Inc. - * + * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. - * + * * GAWK is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. - * + * * GAWK is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA @@ -71,7 +71,7 @@ init_symbol_table() /* * install_symbol: * Install a global name in the symbol table, even if it is already there. - * Caller must check against redefinition if that is desired. + * Caller must check against redefinition if that is desired. */ NODE * @@ -129,7 +129,7 @@ make_params(char **pnames, int pcount) { NODE *p, *parms; int i; - + if (pcount <= 0 || pnames == NULL) return NULL; @@ -242,12 +242,12 @@ destroy_symbol(NODE *r) NODE *n; int i; int pcount = r->param_cnt; - - /* function parameters of type Node_param_list */ + + /* function parameters of type Node_param_list */ for (i = 0; i < pcount; i++) { n = r->fparms + i; efree(n->param); - } + } efree(r->fparms); } break; @@ -260,7 +260,7 @@ destroy_symbol(NODE *r) assoc_clear(r); break; - case Node_var: + case Node_var: unref(r->var_value); break; @@ -369,7 +369,7 @@ comp_symbol(const void *v1, const void *v2) typedef enum { FUNCTION = 1, VARIABLE } SYMBOL_TYPE; /* get_symbols --- return a list of optionally sorted symbols */ - + static NODE ** get_symbols(SYMBOL_TYPE what, bool sort) { @@ -448,7 +448,7 @@ function_list(bool sort) return get_symbols(FUNCTION, sort); } -/* print_vars --- print names and values of global variables */ +/* print_vars --- print names and values of global variables */ void print_vars(NODE **table, int (*print_func)(FILE *, const char *, ...), FILE *fp) @@ -708,7 +708,7 @@ bcfree(INSTRUCTION *cp) cp->opcode = 0; cp->nexti = pool_list->freei; pool_list->freei = cp; -} +} /* bcalloc --- allocate a new instruction */ @@ -804,7 +804,7 @@ push_context(AWK_CONTEXT *ctxt) ctxt_level++; } -/* pop_context --- switch to previous execution context. */ +/* pop_context --- switch to previous execution context. */ void pop_context() @@ -831,7 +831,7 @@ in_main_context() return (ctxt_level == 1); } -/* free_context --- free context structure and related data. */ +/* free_context --- free context structure and related data. */ void free_context(AWK_CONTEXT *ctxt, bool keep_globals) @@ -864,7 +864,7 @@ free_context(AWK_CONTEXT *ctxt, bool keep_globals) efree(ctxt); } -/* free_bc_internal --- free internal memory of an instruction. */ +/* free_bc_internal --- free internal memory of an instruction. */ static void free_bc_internal(INSTRUCTION *cp) @@ -888,7 +888,7 @@ free_bc_internal(INSTRUCTION *cp) if (m->re_text != NULL) unref(m->re_text); freenode(m); - break; + break; case Op_token: /* token lost during error recovery in yyparse */ if (cp->lextok != NULL) @@ -906,7 +906,7 @@ free_bc_internal(INSTRUCTION *cp) case Op_illegal: cant_happen(); default: - break; + break; } } diff --git a/vms/ChangeLog b/vms/ChangeLog index 710a35f8..29f0363a 100644 --- a/vms/ChangeLog +++ b/vms/ChangeLog @@ -1,3 +1,7 @@ +2016-10-23 Arnold D. Robbins <arnold@skeeve.com> + + * General: Remove trailing whitespace from all relevant files. + 2016-08-25 Arnold D. Robbins <arnold@skeeve.com> * 4.1.4: Release tar ball made. diff --git a/vms/vms_gawk.c b/vms/vms_gawk.c index 4080e1db..0caab21f 100644 --- a/vms/vms_gawk.c +++ b/vms/vms_gawk.c @@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - + /* * vms_gawk.c - routines to parse the command line as a native DCL command |