source: vendor/gawk/3.1.5/test/igncdym.awk@ 3076

Last change on this file since 3076 was 3076, checked in by bird, 19 years ago

gawk 3.1.5

File size: 1.2 KB
Line 
1#From [email protected] Mon Feb 21 09:33:32 2000
2#Message-id: <[email protected]>
3#Date: 20 Feb 2000 18:14:11 EST
4#From: [email protected] (Jeffrey B. Woodward)
5#Subject: gawk 3.0.4 bug
6#To: [email protected]
7#Cc: [email protected]
8#
9#O/S: Digital UNIX 4.0D
10#
11#C Compiler: DEC C
12#
13#gawk version: 3.0.4
14#
15#Sample Program:
16#gawk '
17 BEGIN {
18 pattern[1] = "bar" ; ignore[1] = 1
19 pattern[2] = "foo" ; ignore[2] = 0
20 }
21
22 {
23 for (i = 1 ; i <= 2 ; i++) {
24 IGNORECASE = ignore[i]
25 print match($0, pattern[i]) " " pattern[i] ":" $0
26 }
27 }
28#' << -EOF-
29#This is foo
30#This is bar
31#-EOF-
32#
33#Program Output:
34#0 bar:This is foo
35#0 foo:This is foo
36#9 bar:This is bar
37#9 foo:This is bar
38#
39#
40#**Expected** Output:
41#0 bar:This is foo
42#9 foo:This is foo
43#9 bar:This is bar
44#0 foo:This is bar
45#
46#
47#This problem appears to be directly related to IGNORECASE. If
48#IGNORECASE remains constant, the program behaves as expected;
49#however, switching IGNORECASE seems to causes problems - it is
50#almost as though the pattern stored in the variable is treated
51#as a constant and the regexp() is not recompiled(?) - just a
52#guess...
53#
54#
55#Thanks,
56#-Jeff Woodward
Note: See TracBrowser for help on using the repository browser.