#include <ctype.h>
#include <tic.h>
-MODULE_ID("$Id: captoinfo.c,v 1.17 1998/02/11 12:13:54 tom Exp $")
+MODULE_ID("$Id: captoinfo.c,v 1.24 1999/07/24 20:06:13 tom Exp $")
#define MAX_PUSHED 16 /* max # args we can push onto the stack */
#define MAX_ENTRY 2048 /* maximum chars in a translated capability */
/* initialize 'my_string', 'my_length' */
{
if (my_string == 0)
- my_string = malloc(my_length = 256);
+ my_string = typeMalloc(char, my_length = 256);
if (my_string == 0)
_nc_err_abort("Out of memory");
size_t have = (d - my_string);
size_t need = have + strlen(s) + 2;
if (need > my_length) {
- my_string = realloc(my_string, my_length = (need + need));
+ my_string = (char *)realloc(my_string, my_length = (need + need));
+ if (my_string == 0)
+ _nc_err_abort("Out of memory");
d = my_string + have;
}
(void) strcpy(d, s);
static void pop(void)
/* pop the top of the stack into onstack */
{
- if (stackptr == 0)
+ if (stackptr == 0) {
if (onstack == 0)
_nc_warning("I'm confused");
else
onstack = 0;
+ }
else
onstack = stack[--stackptr];
param++;
*dp++ = '%'; *dp++ = '/';
break;
case '=':
- if (seenr)
+ if (seenr) {
if (param == 1)
onstack = 2;
else if (param == 2)
onstack = 1;
else
onstack = param;
+ }
else
onstack = param;
break;
pop();
break;
case '0': /* not clear any of the historical termcaps did this */
- if (*s == '3')
+ if (*s == '3')
goto see03;
else if (*s != '2')
goto invalid;
for (; *str && str != trimmed; str++)
{
int c1, c2;
- char *cp;
+ char *cp = 0;
if (str[0] == '\\' && (str[1] == '^' || str[1] == ','))
{
else if (sscanf(str, "%%?%%{%d}%%>%%t%%{%d}%%+%%;", &c1,&c2) == 2)
{
str = strchr(str, ';');
- (void) sprintf(temp, "%%>");
- (void) strcat(temp, unctrl(c1));
- (void) strcat(temp, unctrl(c2));
+ (void) sprintf(temp, "%%>%s%s", unctrl(c1), unctrl(c2));
bufptr = save_string(bufptr, temp);
}
else if (sscanf(str, "%%?%%{%d}%%>%%t%%'%c'%%+%%;", &c1,&ch2) == 2)