~ubuntu-branches/ubuntu/raring/maradns/raring

« back to all changes in this revision

Viewing changes to update/1.3.03/maradns-1.3.02-tilde_wks_loc.patch

  • Committer: Bazaar Package Importer
  • Author(s): Kai Hendry
  • Date: 2010-01-24 12:17:40 UTC
  • mfrom: (1.1.13 upstream) (10.1.4 sid)
  • Revision ID: james.westby@ubuntu.com-20100124121740-a4e1fjobwaouz443
Tags: 1.4.02-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
--- maradns-1.3.02/parse/Csv2_rr_wks.c  2006-10-08 16:32:42.000000000 -0700
2
 
+++ maradns-1.3.03/parse/Csv2_rr_wks.c  2007-02-04 19:53:08.000000000 -0800
3
 
@@ -1,4 +1,4 @@
4
 
-/* Copyright (c) 2004-2006 Sam Trenholme
5
 
+/* Copyright (c) 2004-2007 Sam Trenholme
6
 
  *
7
 
  * TERMS
8
 
  *
9
 
@@ -86,22 +86,38 @@
10
 
 
11
 
        /* Read the port numbers, putting them in the ports
12
 
         * array */
13
 
+       /* Allow the tilde to end a list */
14
 
+       if(stream->tilde_handling == 103) {
15
 
+               csv2_allow_tilde(stream);
16
 
+       }
17
 
        look = csv2_justread(stream);
18
 
        num = 0;
19
 
-       for(x = 0; x < 100; x++) {
20
 
-               /* This is one of the few places where we treat a newline
21
 
-                * differently than a space or tab; a newline (or EOF) ends
22
 
-                * the WKS list of ports */
23
 
-               if(look == -2 || look == '\n' || look == '\r') {
24
 
-                       break;
25
 
-               }
26
 
-               /* Comments also end the WKS list of ports */
27
 
-               else if(csv2_is_hash(look)) {
28
 
-                       process_comment(stream);
29
 
-                       break;
30
 
+       for(x = 0; x < 1000; x++) {
31
 
+               if(stream->tilde_handling != 103) {
32
 
+                       /* This is one of the few places where we treat a 
33
 
+                         * newline differently than a space or tab; a newline 
34
 
+                         * (or EOF) ends the WKS list of ports */
35
 
+                       if(look == -2 || look == '\n' || look == '\r') {
36
 
+                               break;
37
 
+                       }
38
 
+                       /* Comments also end the WKS list of ports */
39
 
+                       else if(csv2_is_hash(look)) {
40
 
+                               process_comment(stream);
41
 
+                               break;
42
 
+                       }
43
 
+                } else { /* If we use the tilde as a record separator, 
44
 
+                          * no need to use hacks to determine when we
45
 
+                          * are at the end of the record */
46
 
+                       if(look == '~') {
47
 
+                               break;
48
 
+                       } else if(csv2_is_hash(look)) {
49
 
+                               process_comment(stream);
50
 
+                               look = csv2_read_unicode(stream);
51
 
+                               continue;
52
 
+                       }       
53
 
                }
54
 
                /* Numbers are processed one byte at a time */
55
 
-               else if(csv2_is_number(look)) {
56
 
+               if(csv2_is_number(look)) {
57
 
                        num *= 10; /* Decimal */
58
 
                        num += look - '0'; /* Random thought: It would have
59
 
                                             * made hexadecimal processing
60
 
@@ -113,8 +129,10 @@
61
 
                                return 0;
62
 
                        }
63
 
                }
64
 
-               /* If it's a space, tab, or comma... */
65
 
-               else if(csv2_is_wks(look)) {
66
 
+               /* If it's a space, tab, or comma... (or newline 
67
 
+                 * if we use the tilde to separate records) */
68
 
+               else if(csv2_is_wks(look) || (stream->tilde_handling == 103
69
 
+                        && (look == '\r' || look == '\n'))) {
70
 
                        /* Take the number we've been processing and add it
71
 
                         * to the list of ports */
72
 
                        if(portindex >= CSV2_WKS_PORTS_MAX) {
73
 
@@ -502,7 +520,13 @@
74
 
        /* (optionally) get the size, horizontal precision, and vertical 
75
 
          * precision */        
76
 
        get = -2;
77
 
-       for(x = 0; x < 100; x++) {
78
 
+
79
 
+       /* Allow the tilde to end a list */
80
 
+       if(stream->tilde_handling == 103) {
81
 
+               csv2_allow_tilde(stream);
82
 
+       }
83
 
+
84
 
+       for(x = 0; x < 1000; x++) {
85
 
                if(csv2_is_wks(look) || look == '\r' || look == '\n' ||
86
 
                    look == -2 || csv2_is_hash(look)) {
87
 
                        int q = 1;
88
 
@@ -534,22 +558,40 @@
89
 
                                get = -2;
90
 
                        }
91
 
                }
92
 
-               if(look == -2 || look == '\n' || look == '\r') {
93
 
-                       break;
94
 
-               }
95
 
-               else if(csv2_is_hash(look)) {
96
 
-                       process_comment(stream);
97
 
-                       break;
98
 
+               /* If we are not using the ~ to separate records */
99
 
+               if(stream->tilde_handling != 103) {
100
 
+                       if(look == -2 || look == '\n' || look == '\r') {
101
 
+                               break;
102
 
+                       }
103
 
+                       else if(csv2_is_hash(look)) {
104
 
+                               process_comment(stream);
105
 
+                               break;
106
 
+                       }
107
 
+               } else { /* When we use the tilde to separate records, we 
108
 
+                          * don't need hacks to determine when we are at the
109
 
+                          * end of a record */
110
 
+                       if(look == '~') {
111
 
+                               break;
112
 
+                       } else if(csv2_is_hash(look)) {
113
 
+                               process_comment(stream);
114
 
+                               look = csv2_read_unicode(stream);
115
 
+                               continue;
116
 
+                       }
117
 
                }
118
 
-               else if(csv2_is_number(look)) {
119
 
+               /* Numbers are processed one character at a time */
120
 
+               if(csv2_is_number(look)) {
121
 
                        if(get < 0) {
122
 
                                get = 0;
123
 
                        }
124
 
                        get *= 10;
125
 
                        get += look - '0';
126
 
                }
127
 
-               else if(!csv2_is_wks(look) && look != 'm') {
128
 
-                       return 0;
129
 
+               /* Error if not space, 'm', or, optionally, newline
130
 
+                 * if we're using tildes (~) to separate records */
131
 
+               else if(!csv2_is_wks(look) && look != 'm' &&
132
 
+                        !(stream->tilde_handling == 103 &&
133
 
+                        (look == '\r' || look == '\n'))) {
134
 
+                       return 0; /* Error */
135
 
                }
136
 
                look = csv2_read_unicode(stream);
137
 
        }       
138
 
--- maradns-1.3.03/parse/Csv2_parse.c.orig      2007-02-04 19:29:19.000000000 -0800
139
 
+++ maradns-1.3.03/parse/Csv2_parse.c   2007-02-04 19:29:19.000000000 -0800
140
 
@@ -453,7 +453,8 @@
141
 
        /* If this character is not OK (is not a character we're looking for)
142
 
          * and is not a delimiter (whitespace, comment, or |), then it's an 
143
 
          * error */
144
 
-       if(in != -328 && !csv2_is_delimiter(in)) {
145
 
+       if(in != -328 && !csv2_is_delimiter(in) && !(in == '~' && 
146
 
+           stream->tilde_handling == 103)) {
147
 
                csv2_error(stream,"Unexpected character");
148
 
                return FATAL_CSV2_READ;
149
 
        }
150
 
@@ -476,6 +477,10 @@
151
 
                }
152
 
        /* Reset the count of the number of tildes we have seen */
153
 
        csv2_reset_tilde_seen(stream);
154
 
+       /* If the current character is a tilde, increment the count */
155
 
+        if(in == '~') {
156
 
+               stream->tilde_seen++;
157
 
+               }
158
 
        }
159
 
 
160
 
        for(x = 0; x < 10000; x++) {