I am experiencing problems using tgetent() and tgetstr(). Has anyone had the
same problems as I have outlined in my program below? I think it has something
to do with allocating memory for the second argument of tgetstr(*id, **area);
basically, my program exits with either code 012 or code 0364 under gdb.
* Compiled using: cc this_program.c -ltermcap
char *term = (char *)getenv("TERM");
char *area = (char *)malloc( 252);
/* I was advised NOT to malloc the area pointer; however, when I do no
allocate memory for it, my program exits with a Bus Error. I also
tried to declare it as area, but I still got a Bus Error.
if(!term) strcpy(term, "unknown");
printf("\n%s\n%s\n", term, termcap);
/* If I do not debug my program, it appears that everything worked.
Sure, I got my terminal attribues like I wanted, but there is an
annoying (malloc-related?) side-effect: my program exits with a
code other than 0 (zero) in gdb: "Program exited with code 0364".
Thanks! E-MAIL WOULD BE APPRECIATED...Quote:}
"Dance with the dead in my dreams
Listen to their hollowed screams
The dead have taken my soul
Temptation's lost all control" -- Slayer (Dead Skin Mask)