On Wed, Mar 10, 2010 at 09:34:45PM +0100, Harald Becker wrote: > > > dunno about \"original awk specification\" but i know that we should > > adhere to: > > http://www.opengroup.org/onlinepubs/9699919799/utilities/awk.html > > > This doesn't specify how for loops are implemented. Allocating temporary > for-in loop variables is a pure gnu extension I assume. I have never > seen any specification that says that the loop variables has to be > protected against invalid recursive function usage.
Actually the spec says "Function parameter names shall be local to the function; all other variable names shall be global." -> no special handling for loop variable names, they are global And looking at the script, it should work correctly with that: for (l in libs) output(l); output() changes l, but that should not be a problem for the given script; consider this: for (l in libs) { cnt++; print "XXX: " cnt, l; output(l); print "YYY: " cnt, l; } I tried mawk (1.3.3) and the script works fine but it prints a changed l at YYY. I also tried gawk (3.1.7) and it also uses a global l. Johannes _______________________________________________ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox