[comp.lang.modula2] UNIX calls from Modula2

vinter@iesd.auc.dk (Vinter Brian) (12/16/90)

Hi netters,

I'm writing a Libary system in Modula2 running under UNIX, and my problem is as
follows:

         From time to time users of the system is to use the mail facility in
	 UNIX, and to make this as comfortable as possible I'd like to use
	 emacs as editor for the letters. I use POpen to access emacs my
	 code is as follows:
MODULE test;

    FROM UnixStdio IMPORT POpen,StdOut,PClose,StdErr,StdIn,Stream, FDOpen, 
         FOpen, GetChar, PutC;
    FROM InOut IMPORT WriteString;
    FROM Files IMPORT File,Create,textMode,replace,FileState;
    FROM Terminal IMPORT SetEditMode, SetEchoMode, Tmode;

    VAR b1,b2 : BOOLEAN;
        status : FileState;
        stream : Stream;
        ch     : CHAR;



BEGIN
    b1:= FOpen("letter.txt","r+",stream);
    b1:= POpen("emacs letter.txt","w",stream);
    b2:= PClose(stream);
    IF bol THEN WriteString("Opend")
    ELSE WriteString("Not opend") END;
    IF b2 THEN WriteString("Closed") ELSE WriteString("close failed"); END;
END test.


The problem is: emacs starts up nicely and because of the hybrid with r+ and
w it also retrieves chars allright, but it refuses to retrieve control 
sequences so I'm stock.

The alternative is is to ask the user to wait 3 min. after ending his letter,
and then kill the job and use the backupfile, but that wont give me an A -:).

So if anybody got an idea how to do it, please give me a hint - as I have to 
deliver th program on friday the 21 Dec.

Thanks in advance

vinter

alias Brian Vinter comp. ing. stud.