]> CyberLeo.Net >> Repos - FreeBSD/releng/8.0.git/blob - usr.bin/awk/b.c.diff
Adjust to reflect 8.0-RELEASE.
[FreeBSD/releng/8.0.git] / usr.bin / awk / b.c.diff
1 $FreeBSD$
2
3 Index: b.c
4 ===================================================================
5 RCS file: /home/ncvs/src/contrib/one-true-awk/b.c,v
6 retrieving revision 1.1.1.8
7 diff -u -p -r1.1.1.8 b.c
8 --- b.c 16 May 2005 19:11:31 -0000      1.1.1.8
9 +++ b.c 16 May 2005 19:12:40 -0000
10 @@ -282,9 +282,21 @@ int quoted(char **pp)      /* pick up next th
11         return c;
12  }
13  
14 +static int collate_range_cmp(int a, int b)
15 +{
16 +       static char s[2][2];
17 +
18 +       if ((uschar)a == (uschar)b)
19 +               return 0;
20 +       s[0][0] = a;
21 +       s[1][0] = b;
22 +       return (strcoll(s[0], s[1]));
23 +}
24 +
25  char *cclenter(const char *argp)       /* add a character class */
26  {
27         int i, c, c2;
28 +       int j;
29         uschar *p = (uschar *) argp;
30         uschar *op, *bp;
31         static uschar *buf = 0;
32 @@ -303,15 +315,18 @@ char *cclenter(const char *argp)  /* add 
33                                 c2 = *p++;
34                                 if (c2 == '\\')
35                                         c2 = quoted((char **) &p);
36 -                               if (c > c2) {   /* empty; ignore */
37 +                               if (collate_range_cmp(c, c2) > 0) {
38                                         bp--;
39                                         i--;
40                                         continue;
41                                 }
42 -                               while (c < c2) {
43 +                               for (j = 0; j < NCHARS; j++) {
44 +                                       if ((collate_range_cmp(c, j) > 0) ||
45 +                                           collate_range_cmp(j, c2) > 0)
46 +                                               continue;
47                                         if (!adjbuf((char **) &buf, &bufsz, bp-buf+2, 100, (char **) &bp, "cclenter1"))
48                                                 FATAL("out of space for character class [%.10s...] 2", p);
49 -                                       *bp++ = ++c;
50 +                                       *bp++ = j;
51                                         i++;
52                                 }
53                                 continue;