Recent

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

Edson

  • Hero Member
  • *****
  • Posts: 1302
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: 14357
  • Sensorship about opinions does not belong here.
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?
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

af0815

  • Hero Member
  • *****
  • Posts: 1291
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: 14357
  • Sensorship about opinions does not belong here.
Re: Linux Terminal Emulator in Free Pascal
« Reply #3 on: October 11, 2018, 08:41:27 am »
google translate did a good job...
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

Edson

  • Hero Member
  • *****
  • Posts: 1302
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: 1302
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: 14357
  • Sensorship about opinions does not belong here.
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)
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

Edson

  • Hero Member
  • *****
  • Posts: 1302
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: 1291
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: 14357
  • Sensorship about opinions does not belong here.
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.
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

Edson

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

Thaddy

  • Hero Member
  • *****
  • Posts: 14357
  • Sensorship about opinions does not belong here.
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.
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

 

TinyPortal © 2005-2018