LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-18-2006, 02:38 PM   #1
Anno
LQ Newbie
 
Registered: Jun 2006
Location: I live somewhere?
Distribution: What do you offer?
Posts: 6

Rep: Reputation: 0
Virtual Terminals in C++


This is my first post and this forum looks like
the place I would get an intelligent answer.

I would like to know where to look for info on
programming Vtty's in C++. Meaning how to go about
opening one within C++ and redirecting their
STDIN/STDOUT/STDERR.

So as can be seen. I would like to open a vtty,
execute a shell in the new-vtty and communicate
with the STDIN/OUT&ERR.

Thanks!
 
Old 06-19-2006, 08:57 AM   #2
taylor_venable
Member
 
Registered: Jun 2005
Location: Indiana, USA
Distribution: OpenBSD, Ubuntu
Posts: 892

Rep: Reputation: 43
I'm not sure I can help, but I think some more information would be useful if I could. What exactly do you mean by "virtual terminal"? You mean like the virtual terminals provided by most Unix systems and accessible via the function keys from the console (text-mode)? Or do you mean a pseudo-terminal like xterm? What's the goal / purpose of your program?

I think you're working through three levels of abstraction / execution here: (1) terminal (2) shell (3) user's commands. If what I understand about your goals is correct, my "programmer's intuition" says this is going to be pretty hard.

First, I believe the shell's standard input comes from the terminal, which knows how to interpret keystrokes delivered to it either from the keyboard driver via the kernel, or from the X window system. Second, if you try to redirect this stream, the shell won't get it, in which case there's no point in having a shell at all. Maybe you want to duplicate the file descriptor so both you and the shell can get the input from the terminal. The same goes with the output and error streams, if you want those to actually show up on the screen.
 
Old 06-20-2006, 01:26 AM   #3
Anno
LQ Newbie
 
Registered: Jun 2006
Location: I live somewhere?
Distribution: What do you offer?
Posts: 6

Original Poster
Rep: Reputation: 0
Thanks for the reply. And yes, you do bring up some valueble points.

Quote:
Originally Posted by taylor_venable
Or do you mean a pseudo-terminal like xterm? What's the goal / purpose of your program?
The task was givin to me to write an "ssh-like" program that runs straight over TCP-IP connections. And will later be able to call X-applications.
That is why I'would like to redirect the display (STDOUT) and make it possible to change the STDIN to not come from the keyboard, but from another source, example the connection setup between the two systems.

I did a bit of searching and it would seem that I'm looking at working with pseudo-terminals. As it sould not have to be a tty.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Virtual Terminals ThoughtWielder Linux - Newbie 1 12-07-2005 04:23 PM
Virtual terminals rnicholus Linux - Software 1 09-21-2005 01:30 PM
Virtual Terminals Kruncher Slackware 9 04-25-2005 06:19 AM
Virtual Terminals sadiboyz Linux - Newbie 1 04-23-2003 04:43 PM
Virtual Terminals moger Linux - General 2 09-29-2002 10:34 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:54 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration