Commit e2cf9a82 authored by Mart Lubbers's avatar Mart Lubbers
Browse files

stability fixes

parent 6b74b1d6
TTY: TTY.prj TTY.icl TTY.dcl Clean\ System\ Files/tty.o
cpm make
clm -desc -exl -tst -ns -nt TTY -o TTY
Clean\ System\ Files/tty.o: tty.c
gcc -g -c $< -o "$@"
......
definition module TTY
from Data.Maybe import :: Maybe
from StdFile import class FileSystem
from StdClass import class zero
......
implementation module TTY
import Data.Maybe
import StdFunc
import StdFile
......@@ -79,8 +78,8 @@ Start :: *World -> (!String, *World)
Start w
#! (ok, tty, w) = TTYopen "/dev/ttyUSB0" zero w
| not ok = TTYerror w
#! tty = TTYwrite tty "echo123\n"
#! (c, tty) = TTYreadline tty
#! tty = TTYwrite tty "Hello World"
#! (ok, w) = TTYclose tty w
| not ok = TTYerror w
#! (s, w) = TTYerror w
......
......@@ -68,12 +68,7 @@ void ttyopen(CleanString fn, int baudrate, int bytesize, int parity,
tcsetattr(fd, TCSANOW, &tio);
*f = fdopen(fd, "r+");
if(*f == NULL){
printf("Couldn't open\n");
fflush(stdout);
} else {
printf("Succesfully opened\n");
fflush(stdout);
if(*f != NULL){
setbuf(*f, NULL);
*status = 1;
}
......@@ -121,13 +116,10 @@ void ttyreadline(FILE *fd, CleanString *result, FILE **fdo)
free(buf);
}
int ttywrite(FILE *fd, CleanString s, FILE **fdo)
FILE *ttywrite(FILE *fd, CleanString s)
{
char *cs_s = cleanStringToCString(s);
fwrite(s, 1, strlen(cs_s), fd);
free(cs_s);
*fdo = fd;
fwrite(CleanStringCharacters(s), 1, CleanStringLength(s), fd);
return fd;
}
int ttyclose(FILE *fd)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment