X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=ncurses%2Ftinfo%2Fcomp_scan.c;h=a860c77ad81c0b7fe768b193b0205945a7f79824;hp=5c67ffc872277c3a74f8a308c4c15f849b60f22e;hb=70e1890695998ac225c5a2a3006500372e1987a1;hpb=8e25fff6a5f576b6dc35eb02b9783fa58680d07b diff --git a/ncurses/tinfo/comp_scan.c b/ncurses/tinfo/comp_scan.c index 5c67ffc8..a860c77a 100644 --- a/ncurses/tinfo/comp_scan.c +++ b/ncurses/tinfo/comp_scan.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. * + * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -50,7 +50,7 @@ #include #include -MODULE_ID("$Id: comp_scan.c,v 1.92 2011/07/30 21:36:33 tom Exp $") +MODULE_ID("$Id: comp_scan.c,v 1.97 2012/03/24 22:24:19 tom Exp $") /* * Maximum length of string capability we'll accept before raising an error. @@ -196,7 +196,8 @@ next_char(void) result = typeRealloc(char, allocated, result); if (result == 0) return (EOF); - bufstart = result; + if (bufstart) + bufstart = result; } if (used == 0) _nc_curr_file_pos = ftell(yyin); @@ -213,7 +214,7 @@ next_char(void) } } else { if (used != 0) - strcat(result, "\n"); + _nc_STRCAT(result, "\n", allocated); } if ((bufptr = bufstart) != 0) { used = strlen(bufptr); @@ -257,12 +258,12 @@ next_char(void) } static void -push_back(char c) +push_back(int c) /* push a character back onto the input stream */ { if (bufptr == bufstart) _nc_syserr_abort("Can't backspace off beginning of line"); - *--bufptr = c; + *--bufptr = (char) c; _nc_curr_col--; } @@ -750,7 +751,7 @@ _nc_trans_string(char *ptr, char *last) if (!(is7bits(c) && isprint(c))) { _nc_warning("Illegal ^ character - '%s'", unctrl(UChar(c))); } - if (c == '?') { + if (c == '?' && (_nc_syntax != SYN_TERMCAP)) { *(ptr++) = '\177'; if (_nc_tracing) _nc_warning("Allow ^? as synonym for \\177"); @@ -782,7 +783,7 @@ _nc_trans_string(char *ptr, char *last) /* allow the digit; it'll do less harm */ } } else { - push_back((char) c); + push_back(c); break; } } @@ -878,7 +879,7 @@ _nc_trans_string(char *ptr, char *last) if (!ignored) { if (_nc_curr_col <= 1) { - push_back((char) c); + push_back(c); c = '\n'; break; }