By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,655 Members | 1,005 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,655 IT Pros & Developers. It's quick & easy.

programming a "terminal"?

P: n/a
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.

Dec 13 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Arjun wrote:

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.

--
Read about the Sony stealthware that is a security leak, phones
home, and is generally illegal in most parts of the world. Also
the apparent connivance of the various security software firms.
http://www.schneier.com/blog/archive...drm_rootk.html
Dec 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.