NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/43981: awk: too small limit on number -f options



>Number:         43981
>Category:       bin
>Synopsis:       awk: too small limit on number -f options
>Confidential:   no
>Severity:       non-critical
>Priority:       high
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Oct 17 20:20:01 +0000 2010
>Originator:     Aleksey Cheusov
>Release:        NetBSD 5.1_RC3
>Organization:
>Environment:
System: NetBSD asrock.chizhovka.net 5.1_RC3 NetBSD 5.1_RC3 (GENERIC) #1: Mon 
Jun 28 00:06:07 EEST 2010 
cheusov%asrock.chizhovka.net@localhost:/srv/obj/sys/arch/amd64/compile/GENERIC 
amd64
Architecture: x86_64
Machine: amd64
>Description:
I extensively use AWK for programming under NetBSD and some of my programs pass
lots of -f arguments to awk interpreter. That is

   awk -f module1.awk -f module2.awk ... -f program

When a number of modules exceeds 20. AWK fails with exit status 2 and
the following message on stderr

   myprogram: too many -f options

Fix is below.

>How-To-Repeat:
awk -f 1.awk -f 2.awk ... -f 21.awk
>Fix:
Index: main.c
===================================================================
RCS file: /cvsroot/src/dist/nawk/main.c,v
retrieving revision 1.8
diff -u -r1.8 main.c
--- main.c      19 Oct 2008 19:33:47 -0000      1.8
+++ main.c      17 Oct 2010 20:15:11 -0000
@@ -50,7 +50,7 @@
 int    compile_time = 2;       /* for error printing: */
                                /* 2 = cmdline, 1 = compile, 0 = running */
 
-#define        MAX_PFILE       20      /* max number of -f's */
+#define        MAX_PFILE       200     /* max number of -f's */
 
 char   *pfile[MAX_PFILE];      /* program filenames from -f's */
 int    npfile = 0;     /* number of filenames */



Home | Main Index | Thread Index | Old Index