Recent

Author Topic: Linux Terminal Emulator in Free Pascal  (Read 6248 times)

Edson

  • Hero Member
  • *****
  • Posts: 1301
Linux Terminal Emulator in Free Pascal
« on: October 11, 2018, 04:33:05 am »
Some time ago I developed a simple Terminal Emulator in Free Pascal: https://github.com/t-edson/Titty

I share it for someone who has problem to read the output of a rebel process in Linux, that only works well in a terminal.
Lazarus 2.2.6 - FPC 3.2.2 - x86_64-win64 on Windows 10

Thaddy

  • Hero Member
  • *****
  • Posts: 14205
  • Probably until I exterminate Putin.
Re: Linux Terminal Emulator in Free Pascal
« Reply #1 on: October 11, 2018, 06:54:34 am »
I see the code has a getmem call, but no freemem? on exit?
Specialize a type, not a var.

af0815

  • Hero Member
  • *****
  • Posts: 1289
Re: Linux Terminal Emulator in Free Pascal
« Reply #2 on: October 11, 2018, 08:21:37 am »
Is there theinformation in english too ? At github and inthe blog there is no english info.
regards
Andreas

Thaddy

  • Hero Member
  • *****
  • Posts: 14205
  • Probably until I exterminate Putin.
Re: Linux Terminal Emulator in Free Pascal
« Reply #3 on: October 11, 2018, 08:41:27 am »
google translate did a good job...
Specialize a type, not a var.

Edson

  • Hero Member
  • *****
  • Posts: 1301
Re: Linux Terminal Emulator in Free Pascal
« Reply #4 on: October 11, 2018, 04:38:52 pm »
I see the code has a getmem call, but no freemem? on exit?

Good observation. Not so critical considering execvp() will never finish  >:D I'm sure there is some better way to implement this.

And there is not validation for the value returned in fpfork().

This is a very basic example, used to show how create terminals.
Lazarus 2.2.6 - FPC 3.2.2 - x86_64-win64 on Windows 10

Edson

  • Hero Member
  • *****
  • Posts: 1301
Re: Linux Terminal Emulator in Free Pascal
« Reply #5 on: October 11, 2018, 04:41:22 pm »
Is there theinformation in english too ? At github and inthe blog there is no english info.

Sorry. I public a lot of information in my native language.

This code is based on http://rachid.koucha.free.fr/tech_corner/pty_pdip.html. There you can find more information in english but using C.
Lazarus 2.2.6 - FPC 3.2.2 - x86_64-win64 on Windows 10

Thaddy

  • Hero Member
  • *****
  • Posts: 14205
  • Probably until I exterminate Putin.
Re: Linux Terminal Emulator in Free Pascal
« Reply #6 on: October 11, 2018, 05:12:30 pm »
Edson, according to a compile with -glh the memory is not a leak...  Nice code except from the 5 (I got around that by giving the executable some more rights)
Specialize a type, not a var.

Edson

  • Hero Member
  • *****
  • Posts: 1301
Re: Linux Terminal Emulator in Free Pascal
« Reply #7 on: October 11, 2018, 06:35:46 pm »
Nice code except from the 5

What is 5?  Post #5?

I got around that by giving the executable some more rights
Do you refer I must use another license for the code?
« Last Edit: October 11, 2018, 06:38:22 pm by Edson »
Lazarus 2.2.6 - FPC 3.2.2 - x86_64-win64 on Windows 10

af0815

  • Hero Member
  • *****
  • Posts: 1289
Re: Linux Terminal Emulator in Free Pascal
« Reply #8 on: October 11, 2018, 08:33:04 pm »
There you can find more information in english but using C.
Thank you, now it is clear for me. The google translation was not good enough for me to understand.
regards
Andreas

Thaddy

  • Hero Member
  • *****
  • Posts: 14205
  • Probably until I exterminate Putin.
Re: Linux Terminal Emulator in Free Pascal
« Reply #9 on: October 12, 2018, 07:51:42 am »
Do you refer I must use another license for the code?
No: runtime error 5.
Specialize a type, not a var.

Edson

  • Hero Member
  • *****
  • Posts: 1301
Lazarus 2.2.6 - FPC 3.2.2 - x86_64-win64 on Windows 10

Thaddy

  • Hero Member
  • *****
  • Posts: 14205
  • Probably until I exterminate Putin.
Re: Linux Terminal Emulator in Free Pascal
« Reply #11 on: October 12, 2018, 06:51:08 pm »
No: runtime error 5.

http://forum.lazarus.freepascal.org/index.php?topic=4936.0
Yes. I know.... :) but Bart's solution is not complete: simply adapt rights.
But you should fix your code accordingly.
Specialize a type, not a var.

 

TinyPortal © 2005-2018