programming a "terminal"?

A

Arjun

Hi,

I wasn't sure quite what to title this, so I just chose something that
sounded reasonably correct. If I butcher and/or misuse any terms in
this post, then I apologize, please correct me.

My problem is this: I want to program a GNU Screen - like application,
though not _nearly_ on the same scale. The only thing I really want it
to be able to do is support multiple "windows", as it were, and
automatically notify the user when one of them is free for usage - that
is, the task in it is over. Originally, I had the bright idea to use
C's built-in system(command) function to do the actual code execution,
but it turns out system(command) executes command and then kills that
"session", for lack of a better term. So if I type something like "cd
/var/www", it will cd the user into the /var/www directory, then kill
that "session", thus resetting all environment variables and putting
the user back in /home/$user. So if I type "cd /var/www" and then I
type "pwd", i get /home/$user, but if I do "cd /var/www; pwd", i get
/var/www.

I know this can be done correctly, as programs like screen, xterm, and
so on have to have the terminal functionality, or else they'd be
worthless. The problem is, I can't make head or tail of screen's code,
and xterm's is a nightmare. So here's my plea: Does anyone know of
either 1) a resource that gives insight into the building of a
"terminal" application such as the aforementioned, or 2) a very simple
terminal program whose source I can dissect and preferably ask
questions about?

Thanks,
Arjun

By the way, this is being programmed C using ncurses.
 
C

Chuck F.

Arjun said:
My problem is this: I want to program a GNU Screen - like
application, though not _nearly_ on the same scale. The only
thing I really want it to be able to do is support multiple
"windows", as it were, and automatically notify the user when
one of them is free for usage - that is, the task in it is over.
Originally, I had the bright idea to use C's built-in
system(command) function to do the actual code execution, but it
turns out system(command) executes command and then kills that
> "session", for lack of a better term. So if I type something
like "cd /var/www", it will cd the user into the /var/www
directory, then kill that "session", thus resetting all
environment variables and putting the user back in /home/$user.
So if I type "cd /var/www" and then I type "pwd", i get
/home/$user, but if I do "cd /var/www; pwd", i get /var/www.
.... snip ...

By the way, this is being programmed C using ncurses.

Screens are system dependent. There is no guarantee a C system has
such a thing. Thus they are off-topic in c.l.c. You should try a
newsgroup that deals with your actual system. c.l.c deals ONLY
with the portable, system independent, C language as specified in
the various standards, especially C90 and C99.

Similarly directories, sessions, ncurses are all system dependent,
and off-topic here.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top