diff options
author | ache <ache@FreeBSD.org> | 1999-02-12 20:39:06 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 1999-02-12 20:39:06 +0000 |
commit | 1c697612c00b349f6ef445f24c8384238ed2c2f5 (patch) | |
tree | da35e051ce812e7145f2b54134cf39ed3873cffb /usr.bin/colldef | |
parent | 35ae892d35e97cc238430bf3e32169128149f546 (diff) | |
download | FreeBSD-src-1c697612c00b349f6ef445f24c8384238ed2c2f5.zip FreeBSD-src-1c697612c00b349f6ef445f24c8384238ed2c2f5.tar.gz |
fix English
detect recursive substitutions
allow substituted character not present in the order
Diffstat (limited to 'usr.bin/colldef')
-rw-r--r-- | usr.bin/colldef/parse.y | 15 | ||||
-rw-r--r-- | usr.bin/colldef/scan.l | 30 |
2 files changed, 26 insertions, 19 deletions
diff --git a/usr.bin/colldef/parse.y b/usr.bin/colldef/parse.y index cfc5642..ca37743 100644 --- a/usr.bin/colldef/parse.y +++ b/usr.bin/colldef/parse.y @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: parse.y,v 1.10 1997/06/30 11:24:18 charnier Exp $ + * $Id: parse.y,v 1.11 1998/12/06 22:58:17 archie Exp $ */ #include <err.h> @@ -84,7 +84,11 @@ charmap : DEFN CHAR { } ; substitute : SUBSTITUTE STRING WITH STRING { - strcpy(__collate_substitute_table[$2[0]], $4); + u_char ch = $2[0]; + + if (strchr($4, ch) != NULL) + yyerror("Char 0x%02x substitution is recursive", ch); + strcpy(__collate_substitute_table[ch], $4); } ; order : ORDER order_list { @@ -92,8 +96,11 @@ order : ORDER order_list { int ch; for (ch = 0; ch < UCHAR_MAX + 1; ch++) - if (!__collate_char_pri_table[ch].prim) - yyerror("Char 0x%02x not present", ch); + if ( !__collate_char_pri_table[ch].prim + && __collate_substitute_table[ch][0] == ch + && __collate_substitute_table[ch][1] == '\0' + ) + yyerror("Char 0x%02x not found", ch); fp = fopen(out_file, "w"); if(!fp) diff --git a/usr.bin/colldef/scan.l b/usr.bin/colldef/scan.l index 3e7dd6b..27439f4 100644 --- a/usr.bin/colldef/scan.l +++ b/usr.bin/colldef/scan.l @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id$ + * $Id: scan.l,v 1.7 1997/02/22 19:54:32 peter Exp $ */ #include <ctype.h> @@ -101,7 +101,7 @@ YYSTYPE yylval; return CHAR; } if(yyleng > STR_LEN - 1) - errx(EX_UNAVAILABLE, "chain buffer overflaw near line %u", + errx(EX_UNAVAILABLE, "chain buffer overflow near line %u", line_no); strcpy(yylval.str, yytext); return CHAIN; @@ -121,19 +121,19 @@ YYSTYPE yylval; } <name>\/\/ { if(ptr >= buf + sizeof(buf) - 1) - errx(EX_UNAVAILABLE, "name buffer overflaw near line %u, character '/'", + errx(EX_UNAVAILABLE, "name buffer overflow near line %u, character '/'", line_no); *ptr++ = '/'; } <name>\/\> { if(ptr >= buf + sizeof(buf) - 1) - errx(EX_UNAVAILABLE, "name buffer overflaw near line %u, character '>'", + errx(EX_UNAVAILABLE, "name buffer overflow near line %u, character '>'", line_no); *ptr++ = '>'; } <string>\\\" { if(ptr >= buf + sizeof(buf) - 1) - errx(EX_UNAVAILABLE, "string buffer overflaw near line %u, character '\"'", + errx(EX_UNAVAILABLE, "string buffer overflow near line %u, character '\"'", line_no); *ptr++ = '"'; } @@ -167,49 +167,49 @@ YYSTYPE yylval; errx(EX_UNAVAILABLE, "non-ASCII or non-printable character 0x%02x not allowed in the map/name near line %u of %s", *yytext, line_no, s); if(ptr >= buf + sizeof(buf) - 1) - errx(EX_UNAVAILABLE, "map/name buffer overflaw near line %u of %s, character '%c'", + errx(EX_UNAVAILABLE, "map/name buffer overflow near line %u of %s, character '%c'", line_no, s, *yytext); *ptr++ = *yytext; } <string>\\t { if(ptr >= buf + sizeof(buf) - 1) - errx(EX_UNAVAILABLE, "string buffer overflaw near line %u, character '\\t'", + errx(EX_UNAVAILABLE, "string buffer overflow near line %u, character '\\t'", line_no); *ptr++ = '\t'; } <string>\\b { if(ptr >= buf + sizeof(buf) - 1) - errx(EX_UNAVAILABLE, "string buffer overflaw near line %u, character '\\b'", + errx(EX_UNAVAILABLE, "string buffer overflow near line %u, character '\\b'", line_no); *ptr++ = '\b'; } <string>\\f { if(ptr >= buf + sizeof(buf) - 1) - errx(EX_UNAVAILABLE, "string buffer overflaw near line %u, character '\\f'", + errx(EX_UNAVAILABLE, "string buffer overflow near line %u, character '\\f'", line_no); *ptr++ = '\f'; } <string>\\v { if(ptr >= buf + sizeof(buf) - 1) - errx(EX_UNAVAILABLE, "string buffer overflaw near line %u, character '\\v'", + errx(EX_UNAVAILABLE, "string buffer overflow near line %u, character '\\v'", line_no); *ptr++ = '\v'; } <string>\\n { if(ptr >= buf + sizeof(buf) - 1) - errx(EX_UNAVAILABLE, "string buffer overflaw near line %u, character '\\n'", + errx(EX_UNAVAILABLE, "string buffer overflow near line %u, character '\\n'", line_no); *ptr++ = '\n'; } <string>\\r { if(ptr >= buf + sizeof(buf) - 1) - errx(EX_UNAVAILABLE, "string buffer overflaw near line %u, character '\\r'", + errx(EX_UNAVAILABLE, "string buffer overflow near line %u, character '\\r'", line_no); *ptr++ = '\r'; } <string>\\a { if(ptr >= buf + sizeof(buf) - 1) - errx(EX_UNAVAILABLE, "string buffer overflaw near line %u, character '\\a'", + errx(EX_UNAVAILABLE, "string buffer overflow near line %u, character '\\a'", line_no); *ptr++ = '\a'; } @@ -237,13 +237,13 @@ YYSTYPE yylval; } <string>\\. { if(ptr >= buf + sizeof(buf) - 1) - errx(EX_UNAVAILABLE, "string buffer overflaw near line %u, character '%c'", + errx(EX_UNAVAILABLE, "string buffer overflow near line %u, character '%c'", line_no, yytext[1]); *ptr++ = yytext[1]; } <string>. { if(ptr >= buf + sizeof(buf) - 1) - errx(EX_UNAVAILABLE, "string buffer overflaw near line %u, character '%c'", + errx(EX_UNAVAILABLE, "string buffer overflow near line %u, character '%c'", line_no, *yytext); *ptr++ = *yytext; } |