summaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2009-01-25 01:00:15 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2009-01-25 01:00:15 +0000
commit41d5ebee17a977c9ea34933f9dfe12b0fa1a9836 (patch)
tree8778f8f8f50cad595ace6e9f407a73c16d19e4b2 /editors
parentbdea2c06dc7144de67fbadce9a7f8fc07cf57c34 (diff)
downloadbusybox-w32-41d5ebee17a977c9ea34933f9dfe12b0fa1a9836.tar.gz
busybox-w32-41d5ebee17a977c9ea34933f9dfe12b0fa1a9836.tar.bz2
busybox-w32-41d5ebee17a977c9ea34933f9dfe12b0fa1a9836.zip
awk: in BEGIN section $0 should be "", not "0".
Diffstat (limited to 'editors')
-rw-r--r--editors/awk.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/editors/awk.c b/editors/awk.c
index 1d0792e19..bac580497 100644
--- a/editors/awk.c
+++ b/editors/awk.c
@@ -366,25 +366,22 @@ static const uint32_t tokeninfo[] = {
366enum { 366enum {
367 CONVFMT, OFMT, FS, OFS, 367 CONVFMT, OFMT, FS, OFS,
368 ORS, RS, RT, FILENAME, 368 ORS, RS, RT, FILENAME,
369 SUBSEP, ARGIND, ARGC, ARGV, 369 SUBSEP, F0, ARGIND, ARGC,
370 ERRNO, FNR, 370 ARGV, ERRNO, FNR, NR,
371 NR, NF, IGNORECASE, 371 NF, IGNORECASE, ENVIRON, NUM_INTERNAL_VARS
372 ENVIRON, F0, NUM_INTERNAL_VARS
373}; 372};
374 373
375static const char vNames[] ALIGN1 = 374static const char vNames[] ALIGN1 =
376 "CONVFMT\0" "OFMT\0" "FS\0*" "OFS\0" 375 "CONVFMT\0" "OFMT\0" "FS\0*" "OFS\0"
377 "ORS\0" "RS\0*" "RT\0" "FILENAME\0" 376 "ORS\0" "RS\0*" "RT\0" "FILENAME\0"
378 "SUBSEP\0" "ARGIND\0" "ARGC\0" "ARGV\0" 377 "SUBSEP\0" "$\0*" "ARGIND\0" "ARGC\0"
379 "ERRNO\0" "FNR\0" 378 "ARGV\0" "ERRNO\0" "FNR\0" "NR\0"
380 "NR\0" "NF\0*" "IGNORECASE\0*" 379 "NF\0*" "IGNORECASE\0*" "ENVIRON\0" "\0";
381 "ENVIRON\0" "$\0*" "\0";
382 380
383static const char vValues[] ALIGN1 = 381static const char vValues[] ALIGN1 =
384 "%.6g\0" "%.6g\0" " \0" " \0" 382 "%.6g\0" "%.6g\0" " \0" " \0"
385 "\n\0" "\n\0" "\0" "\0" 383 "\n\0" "\n\0" "\0" "\0"
386 "\034\0" 384 "\034\0" "\0" "\377";
387 "\377";
388 385
389/* hash size may grow to these values */ 386/* hash size may grow to these values */
390#define FIRST_PRIME 61 387#define FIRST_PRIME 61
@@ -1856,7 +1853,6 @@ static int fmt_num(char *b, int size, const char *format, double n, int int_as_i
1856 return r; 1853 return r;
1857} 1854}
1858 1855
1859
1860/* formatted output into an allocated buffer, return ptr to buffer */ 1856/* formatted output into an allocated buffer, return ptr to buffer */
1861static char *awk_printf(node *n) 1857static char *awk_printf(node *n)
1862{ 1858{
@@ -2866,18 +2862,18 @@ int awk_main(int argc, char **argv)
2866 parse_program(s + 1); 2862 parse_program(s + 1);
2867 free(s); 2863 free(s);
2868 } while (list_f); 2864 } while (list_f);
2865 argc++;
2869 } else { // no -f: take program from 1st parameter 2866 } else { // no -f: take program from 1st parameter
2870 if (!argc) 2867 if (!argc)
2871 bb_show_usage(); 2868 bb_show_usage();
2872 g_progname = "cmd. line"; 2869 g_progname = "cmd. line";
2873 parse_program(*argv++); 2870 parse_program(*argv++);
2874 argc--;
2875 } 2871 }
2876 if (opt & 0x8) // -W 2872 if (opt & 0x8) // -W
2877 bb_error_msg("warning: unrecognized option '-W %s' ignored", opt_W); 2873 bb_error_msg("warning: unrecognized option '-W %s' ignored", opt_W);
2878 2874
2879 /* fill in ARGV array */ 2875 /* fill in ARGV array */
2880 setvar_i(intvar[ARGC], argc + 1); 2876 setvar_i(intvar[ARGC], argc);
2881 setari_u(intvar[ARGV], 0, "awk"); 2877 setari_u(intvar[ARGV], 0, "awk");
2882 i = 0; 2878 i = 0;
2883 while (*argv) 2879 while (*argv)