More questions about how to issue a C-SHELL command within a C program
Guy Harris
guy at auspex.auspex.com
Fri Aug 17 05:22:26 AEST 1990
>Would someone point me another way to change terminal type within a C program
>or give me some hints what I did wrong. I would appreciate any helps.
As noted, the environment isn't "global", so setting an environment
variable such as TERM in one process won't affect its value in any other
existing processes; it'll only affect its initial value in processes
forked from that process.
If you want to change the value of an environment variable in a process
running some arbitrary C program, check whether your system has the
"putenv" routine (look for PUTENV(3) in the manual - unless you have
some SCO system wherein they "improved" the manuals by changing the
names of the sections, in which case I've no idea what the name would
be). If not, see whether it has the "setenv" routine.
If it has one or the other of those routines, the manual page should
show you how to set an environment variable using the routine.
Why do you need to change the setting of TERM within a program? The
ultimate problem may lie deeper. (Also bear in mind that you should set
TERM *before* you call *any* "curses" or "termcap" routines; otherwise,
"curses" or "termcap" will start out using the old value of TERM, not
the new value.)
More information about the Comp.unix.questions
mailing list