Deleted Added
full compact
parse.y (43940) parse.y (43943)
1%{
2/*-
3 * Copyright (c) 1995 Alex Tatmanjants <alex@elvisti.kiev.ua>
4 * at Electronni Visti IA, Kiev, Ukraine.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 11 unchanged lines hidden (view full) ---

20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 *
1%{
2/*-
3 * Copyright (c) 1995 Alex Tatmanjants <alex@elvisti.kiev.ua>
4 * at Electronni Visti IA, Kiev, Ukraine.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 11 unchanged lines hidden (view full) ---

20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 *
28 * $Id: parse.y,v 1.11 1998/12/06 22:58:17 archie Exp $
28 * $Id: parse.y,v 1.12 1999/02/12 20:39:05 ache Exp $
29 */
30
31#include <err.h>
32#include <stdarg.h>
33#include <stdio.h>
34#include <string.h>
35#include <stdlib.h>
36#include <unistd.h>

--- 44 unchanged lines hidden (view full) ---

81;
82charmap : DEFN CHAR {
83 strcpy(charmap_table[$2], $1);
84}
85;
86substitute : SUBSTITUTE STRING WITH STRING {
87 u_char ch = $2[0];
88
29 */
30
31#include <err.h>
32#include <stdarg.h>
33#include <stdio.h>
34#include <string.h>
35#include <stdlib.h>
36#include <unistd.h>

--- 44 unchanged lines hidden (view full) ---

81;
82charmap : DEFN CHAR {
83 strcpy(charmap_table[$2], $1);
84}
85;
86substitute : SUBSTITUTE STRING WITH STRING {
87 u_char ch = $2[0];
88
89 if (strlen($2) > 1)
90 yyerror("Only characters can be substituted, not strings");
91 if (ch == '\0')
92 yyerror("NUL character can't be substituted");
89 if (strchr($4, ch) != NULL)
90 yyerror("Char 0x%02x substitution is recursive", ch);
91 strcpy(__collate_substitute_table[ch], $4);
92}
93;
94order : ORDER order_list {
95 FILE *fp;
93 if (strchr($4, ch) != NULL)
94 yyerror("Char 0x%02x substitution is recursive", ch);
95 strcpy(__collate_substitute_table[ch], $4);
96}
97;
98order : ORDER order_list {
99 FILE *fp;
96 int ch;
100 int ch, substed, ordered;
97
101
98 for (ch = 0; ch < UCHAR_MAX + 1; ch++)
99 if ( !__collate_char_pri_table[ch].prim
100 && __collate_substitute_table[ch][0] == ch
101 && __collate_substitute_table[ch][1] == '\0'
102 )
102 for (ch = 0; ch < UCHAR_MAX + 1; ch++) {
103 substed = (__collate_substitute_table[ch][0] != ch);
104 ordered = !!__collate_char_pri_table[ch].prim;
105 if (!ordered && !substed)
103 yyerror("Char 0x%02x not found", ch);
106 yyerror("Char 0x%02x not found", ch);
107 if (substed && ordered)
108 yyerror("Char 0x%02x can't be ordered since substituted", ch);
109 }
104
105 fp = fopen(out_file, "w");
106 if(!fp)
107 err(EX_UNAVAILABLE, "can't open destination file %s",
108 out_file);
109
110 strcpy(__collate_version, COLLATE_VERSION);
111 fwrite(__collate_version, sizeof(__collate_version), 1, fp);

--- 189 unchanged lines hidden ---
110
111 fp = fopen(out_file, "w");
112 if(!fp)
113 err(EX_UNAVAILABLE, "can't open destination file %s",
114 out_file);
115
116 strcpy(__collate_version, COLLATE_VERSION);
117 fwrite(__collate_version, sizeof(__collate_version), 1, fp);

--- 189 unchanged lines hidden ---