* * *

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

Edson

  • Hero Member
  • *****
  • Posts: 939
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 1.6 - FPC 3.0.0 - x86_64-win64 on  Windows 7

Thaddy

  • Hero Member
  • *****
  • Posts: 6904
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?
Ada's daddy wrote this:"Fools are my theme, let satire be my song."

af0815

  • Full Member
  • ***
  • Posts: 171
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: 6904
Re: Linux Terminal Emulator in Free Pascal
« Reply #3 on: October 11, 2018, 08:41:27 am »
google translate did a good job...
Ada's daddy wrote this:"Fools are my theme, let satire be my song."

Edson

  • Hero Member
  • *****
  • Posts: 939
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 1.6 - FPC 3.0.0 - x86_64-win64 on  Windows 7

Edson

  • Hero Member
  • *****
  • Posts: 939
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 1.6 - FPC 3.0.0 - x86_64-win64 on  Windows 7

Thaddy

  • Hero Member
  • *****
  • Posts: 6904
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)
Ada's daddy wrote this:"Fools are my theme, let satire be my song."

Edson

  • Hero Member
  • *****
  • Posts: 939
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 1.6 - FPC 3.0.0 - x86_64-win64 on  Windows 7

af0815

  • Full Member
  • ***
  • Posts: 171
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: 6904
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.
Ada's daddy wrote this:"Fools are my theme, let satire be my song."

Edson

  • Hero Member
  • *****
  • Posts: 939
Lazarus 1.6 - FPC 3.0.0 - x86_64-win64 on  Windows 7

Thaddy

  • Hero Member
  • *****
  • Posts: 6904
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.
Ada's daddy wrote this:"Fools are my theme, let satire be my song."

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus