Terminal emulator from scratch.


 
Thread Tools Search this Thread
Top Forums Programming Terminal emulator from scratch.
# 1  
Old 07-30-2010
Terminal emulator from scratch.

I wanna write a terminal emulator program from scratch. I downloaded the sources of xterm but they are too complex...
I did not found any documentation on the Internet, so I asking you where I have to start.

I learnt only C, and I have the basics of GTK library.

Thanks for any reply.

Last edited by mghis; 07-30-2010 at 06:54 PM.. Reason: Minstake
# 2  
Old 07-31-2010
You might want to break that big project into a bunch of smaller parts, or you'll never know where to begin!
  • Displaying the characters.

    How difficult do you want to make it? You could make a simple ASCII-only terminal with an image mosaic as the "font", all the way up to a unicode terminal using unicode fonts...
  • Virtual Terminal.

    A lot of terminal behavior is actually handled by the terminal device, not the user-mode program. Things like sending SIGINT on ctrl-C, EOF on ctrl-D, and so forth are handled not by your code but by kernel code controlling the device. In particular if you want programs in your terminal to get a "yes" when they ask the kernel if they're in a terminal, you'll need to use a virtual terminal. I've written a short example here when I was figuring out how to use virtual terminals myself.
  • Terminal Emulation

    What terminal do you want to emulate? (Probably VT100 or related, right?) What features do you want? Should it support color? Repositioning the cursor? Multiple buffers? etc, etc, etc.

Since you'll need to build around virtual terminals in any case that's where I'd start, get virtual terminals working with no GUI element at all then build on it from there.
# 3  
Old 07-31-2010
Have a look at the source code for Kermit 95. It contains a nice terminal emulator which supports over 40 emulations and is fairly easy to understand.
# 4  
Old 08-03-2010
Thanks for the answers.
I wanna write a basic terminal emulator: no color, no bold, no double-width.
I wanna wrote the terminal emulator only for learning propouses!

I'm using KERMIT (the dos version), but I'd prefere to the /dev/pts/x files, just like a basic version of the gnome-terminal.

Thanks for the link, Corona688. The file is really useful! Smilie But i have a problem! I compiled with 'gcc -o vterm vterm.c' but there are some errors!
Code:
> gcc -o vtterm vterm.c 
vterm.c: In function ‘system_noshell’:
vterm.c:162: warning: passing argument 2 of ‘execvp’ from incompatible pointer type
/usr/include/unistd.h:545: note: expected ‘char * const*’ but argument is of type ‘const char **’
/tmp/ccMAPeR5.o: In function `main':
vterm.c:(.text+0x257): undefined reference to `login_tty'
collect2: ld returned 1 exit status
>

Thanks for any help

PS: I started learning the FLTK toolkit! It may be useful!

Last edited by mghis; 08-03-2010 at 08:40 PM.. Reason: Adding
# 5  
Old 08-04-2010
From man login_tty:

Code:
...
       Link with -lutil.
...

And from the source code, above login_tty:
Code:
                // This function needs compilation with -lutil

# 6  
Old 08-04-2010
Thanks!
# 7  
Old 09-01-2010
This is a very interesting post. I want to do a similar project but have discovered documentation on the subject is either too limited or much too complex for someone not so experienced with c++.

Corona688, your input was especially helpful. I wonder whether you could breakdown the steps you highlighted or give reference documentation (beginner friendly) for the different categories you mentioned. Apparently this is not a going to be a simple undertaking as I had hoped.
Login or Register to Ask a Question

Previous Thread | Next Thread

5 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Terminal Emulator

Hi, I was just wondering how to distinguish between the two terms: 1. Terminal emulator (vt100, vt220 and so on) 2. shell command line Then i decided to conclude myself that these 2 are very equivalent. am I right? this actually came to my mind when I was using my HP-UX terminal. I am... (1 Reply)
Discussion started by: messi777
1 Replies

2. Solaris

Tera Terminal Emulator

Hello Expert! :b: Question for you guys, Can anyone tell me how to use terminal emulator on Windows XP to view Solaris config? I have no idea on Solaris and the only thing I could do is to boot it up. Honestly, I have given a tasked to delete all the files and some necessary memory information... (2 Replies)
Discussion started by: katsloko
2 Replies

3. UNIX for Advanced & Expert Users

Filesystem from scratch

Hey, Had anyone tried with writing a new FS - file system ( whether its useful or not, that doesn't matter ) ? I tried one couple of years ago, but that was a fatal failure :( and can't continue working on it since then. :( Anybody got some experience with writing file system from the... (4 Replies)
Discussion started by: matrixmadhan
4 Replies

4. UNIX for Advanced & Expert Users

unix from scratch

hi all, i'm trying to write a unix system from scratch (not re-writing the kernel) does anyone have information about that? tips and stuff...?i would appreciate every help, thnks :) (9 Replies)
Discussion started by: elzalem
9 Replies

5. Linux

how to use terminal emulator???

hello, can any body tell how to use terminal emulator.... i want to check he serial port communication with the help of that terminal emmulator.... also tell me how to open terminal emmulator.....and how to configure it........and how to use it... I am using fedora core 6..... (1 Reply)
Discussion started by: arunchaudhary19
1 Replies
Login or Register to Ask a Question