Opened 14 years ago
Closed 13 years ago
#29410 closed enhancement (fixed)
gawk @3.1.8: add --enable-switch
Reported by: | axkibe@… | Owned by: | Schamschula (Marius Schamschula) |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | 1.9.2 |
Keywords: | haspatch | Cc: | ryandesign (Ryan Carsten Schmidt) |
Port: | gawk |
Description (last modified by mf2k (Frank Schima))
--enable-switch is not enabled for gawks macport build. It is necessary to work with scripts that have a switch statement in them. Both Linux and Windows version I tested have this enabled by default, so people just assume it to be widely avaiable.
Please enable it by default.
Simple patch makes it work:
--- release/ports/lang/gawk/Portfile.orig 2011-05-09 17:26:34.000000000 +0200 +++ release/ports/lang/gawk/Portfile 2011-05-09 17:58:10.000000000 +0200 @@ -27,8 +27,10 @@ port:gettext configure.args --with-libiconv-prefix=${prefix} \ + --enable-switch \ ac_cv_libsigsegv=no test.run yes test.target check
Change History (4)
comment:1 Changed 14 years ago by mf2k (Frank Schima)
Description: | modified (diff) |
---|---|
Owner: | changed from macports-tickets@… to mschamschula@… |
Port: | gawk added |
comment:2 Changed 13 years ago by ryandesign (Ryan Carsten Schmidt)
Cc: | ryandesign@… added |
---|---|
Keywords: | haspatch added |
Summary: | gawk @3.1.8 --enable-switch not enabled. → gawk @3.1.8: add --enable-switch |
Type: | defect → enhancement |
Replying to axkibe@…:
--enable-switch [...] is necessary to work with scripts that have a switch statement in them.
I am not familiar with this option. Can you please provide a test case -- a script I can run through gawk that will fail now but will succeed with your changes?
comment:3 follow-up: 4 Changed 13 years ago by axkibe@…
Any script that has a switch statement in it.
E.g. Run this with:
$ gawk -f switch.awk -v time="year"
See also http://www.gnu.org/software/gawk/manual/html_node/Switch-Statement.html
BEGIN { IGNORECASE = 1 switch(time) { case "year": timeformat = "%Y" break case "month": timeformat = "%Y-%b" break case "day": timeformat = "%Y-%b-%d" break case "hour": timeformat = "%Y-%b-%d %H" break case "minute": timeformat = "%Y-%b-%d %H:%M" break default: print "missing timeformat" exit } print timeformat exit }
comment:4 Changed 13 years ago by ryandesign (Ryan Carsten Schmidt)
Resolution: | → fixed |
---|---|
Status: | new → closed |
Fixed in r79954 by updating the port to version 4.0.0. Switch support is now always on. From the NEWS file:
10. switch / case is now enabled by default. There's no longer a need for a configure-time option.
It would be more helpful to attach the patch to the ticket rather than pasting the text inline in the description.