| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- MODULE test2;
- (* based on the kilo editor building course*)
- (* Step 6 *)
- IMPORT FIO, SYSTEM, termios, libc, STextIO, NumberIO;
- VAR
- c : CHAR;
- p : POINTER TO CHAR;
- thetermios : termios.TERMIOS;
- theoldtermios : termios.TERMIOS;
- result : INTEGER;
- TCSAFLUSH : INTEGER;
- bresult : BOOLEAN;
-
- BEGIN
- thetermios := termios.InitTermios();
- theoldtermios := termios.InitTermios();
- TCSAFLUSH := termios.tcsflush ();
- result := termios.tcgetattr(FIO.StdIn, thetermios);
- STextIO.WriteString (" call 1 to tcgetattr ");
- NumberIO.WriteCard(result, 5);
- STextIO.WriteLn;
- result := termios.tcgetattr(FIO.StdIn, theoldtermios);
- STextIO.WriteString (" call 2 to tcgetattr ");
- NumberIO.WriteCard(result, 5);
- STextIO.WriteLn;
- bresult := termios.SetFlag(thetermios,termios.lecho, TRUE);
- STextIO.WriteString ("call to SetFlag");
- STextIO.WriteLn;
- IF bresult = TRUE THEN
- STextIO.WriteString("true");
- STextIO.WriteLn;
- ELSE
- STextIO.WriteString("false");
- STextIO.WriteLn
- END;
- result := termios.tcsetattr(FIO.StdIn, TCSAFLUSH, theoldtermios);
- STextIO.WriteString (" call to tcsetattr ");
- NumberIO.WriteCard(result, 5);
- STextIO.WriteLn;
-
- END test2.
|