Zmodem in Linux with FPC? 
Author Message
 Zmodem in Linux with FPC?

I'm having a problem with an old DOS program that i've ported to Linux.  
Basically, it just allows someone to call in, and it sends them a few files via
Zmodem and disconnects.

The program works using FPC's CRT unit and STDIO, except for the Zmodem part.  
I've changed all the Zmodem code to use ReadKey/Write,etc but it doesn't work.  
I have a feeling Linux's terminal settings are interfering with the data Zmodem
is sending/receiving.

Does anyone have any suggestions?  Is there any way to set Linux in a temporary
"raw" mode where it doesn't manipulate data sent to the terminal?

Thanks for any help...

(BTW - I know I could probably hack it up to use rz/sz, but in this case I
don't want to have to do that.  I'd rather keep everything in a single
executable and the person i'm porting this for would like it that way as well)



Sun, 25 May 2003 13:26:19 GMT  
 Zmodem in Linux with FPC?

Quote:

> I'm having a problem with an old DOS program that i've ported to Linux.  
> Basically, it just allows someone to call in, and it sends them a few files
> via
> Zmodem and disconnects.

> The program works using FPC's CRT unit and STDIO, except for the Zmodem part.

> I've changed all the Zmodem code to use ReadKey/Write,etc but it doesn't
> work.  
> I have a feeling Linux's terminal settings are interfering with the data
> Zmodem
> is sending/receiving.

> Does anyone have any suggestions?  Is there any way to set Linux in a
> temporary
> "raw" mode where it doesn't manipulate data sent to the terminal?

If you use the crt unit, the terminal is already set into rawmode. But
readkey/readln etc are rewired to crt routines and do some magic behind
the scenes (translating keycodes e.g.) so it looks as if you're still
working in cooked mode. You can change this by using

assign(input,'');
reset(input);
assign(output,'');
rewrite(output);

This will have some annoying side effects though if you still wish to
edit anything (backspace won't work for example).

Jonas



Sun, 25 May 2003 03:00:00 GMT  
 Zmodem in Linux with FPC?

Quote:
>If you use the crt unit, the terminal is already set into rawmode. But
>readkey/readln etc are rewired to crt routines and do some magic behind
>the scenes (translating keycodes e.g.) so it looks as if you're still
>working in cooked mode. You can change this by using

>assign(input,'');
>reset(input);
>assign(output,'');
>rewrite(output);

>This will have some annoying side effects though if you still wish to
>edit anything (backspace won't work for example).

Thanks for the response!

I will have to look at the CRT source code and see if I can make a small
extention onto it to read keys without interfering.  If I did use the
assign/reset method, is there any function in CRT which I could call to return
things back to normal afterwards?

Thanks again for your help!  Its much appreciated!



Tue, 27 May 2003 20:27:03 GMT  
 Zmodem in Linux with FPC?

Quote:

> >If you use the crt unit, the terminal is already set into rawmode. But
> >readkey/readln etc are rewired to crt routines and do some magic behind
> >the scenes (translating keycodes e.g.) so it looks as if you're still
> >working in cooked mode. You can change this by using

> >assign(input,'');
> >reset(input);
> >assign(output,'');
> >rewrite(output);

> >This will have some annoying side effects though if you still wish to
> >edit anything (backspace won't work for example).

> Thanks for the response!

> I will have to look at the CRT source code and see if I can make a small
> extention onto it to read keys without interfering.  If I did use the
> assign/reset method, is there any function in CRT which I could call to
> return things back to normal afterwards?

assignCrt(input)
reset(input);
assignCrt(output);
rewrite(output);

Note that readkey will *always* do the translation stuff, since it's a
crt-only routine (the crt readln routine uses readkey to read in
characters when readon from a tty).

Quote:
> Thanks again for your help!  Its much appreciated!

No problem, that's exactly what this newsgroup is for :)

Jonas



Tue, 27 May 2003 20:39:43 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. multi threading in fpc linux?

2. Linux/PPC port of FPC working

3. Writing PNG in FPC for Linux, libpng available

4. FPC linking error under Linux ... cannot find GLU

5. FPC - linux question

6. Question about FPC under linux

7. Printing problem again FPC under linux

8. find small database for FPC linux

9. fpc and printer under linux

10. FPC (linux) and utf-8

11. FPC charset (linux) question

12. FPC Linux: Screen saving...

 

 
Powered by phpBB® Forum Software