summaryrefslogtreecommitdiff
path: root/zwgc/tty_filter.c
diff options
context:
space:
mode:
authorGravatar John Kohl <jtkohl@mit.edu>1989-11-14 13:50:45 +0000
committerGravatar John Kohl <jtkohl@mit.edu>1989-11-14 13:50:45 +0000
commit3619605f0785ca9ee80e216cd2f4a6c72d7625a1 (patch)
treee870793fc7f5cb9fcdb68b59ccb1a5d3cdba998e /zwgc/tty_filter.c
parentb7bd2a5427f3e84ef21b47e7ba3d6ed817825a8a (diff)
fix null pointer bug (info)
return same value for initialization of all the drivers through this routine set isbeep for all cases
Diffstat (limited to 'zwgc/tty_filter.c')
-rw-r--r--zwgc/tty_filter.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/zwgc/tty_filter.c b/zwgc/tty_filter.c
index bfb1005..1c6a192 100644
--- a/zwgc/tty_filter.c
+++ b/zwgc/tty_filter.c
@@ -70,17 +70,18 @@ int tty_filter_init()
char tc_buf[1024], *p = st_buf, *tmp, *term;
int ex;
string_dictionary_binding *b;
- static int inited_once = 0;
+ static int inited_retval = -1;
- if (inited_once)
- return(0);
+ if (inited_retval != -1)
+ return(inited_retval);
else
- inited_once = 1;
+ inited_retval = 0;
termcap_dict = string_dictionary_Create(7);
if (!(term = getenv("TERM"))) { /* Only use termcap if $TERM. */
fputs("zwgc: $TERM not set. tty mode not functional.\n",stderr);
+ inited_retval = 1;
return(1);
}
tgetent(tc_buf, term);
@@ -239,6 +240,7 @@ static tty_str_info *convert_desc_to_tty_str_info(desc)
for (; desc->code!=DT_EOF; desc=desc->next) {
/* Handle environments: */
+ isbeep = 0;
if (desc->code == DT_ENV) {
/* PUSH! */
temp = (tty_str_info *)malloc(sizeof(struct _tty_str_info));
@@ -463,7 +465,7 @@ string tty_filter(text, use_fonts)
result_so_far = string_Concat2(result_so_far, right);
free(left); free(center); free(right);
- if (info->alignment == ' ') {
+ if (info && info->alignment == ' ') {
info = info->next;
result_so_far = string_Concat2(result_so_far, "\n");
}