summaryrefslogtreecommitdiff
path: root/host/proto/test/fio.py
diff options
context:
space:
mode:
authorNicolas Schodet2008-04-02 23:02:59 +0200
committerNicolas Schodet2008-04-02 23:02:59 +0200
commitf1c0281f0827699b5990c5dd21908d2384407578 (patch)
tree92c70cc7539208d36ba13ea9ba05b323ee5e8df5 /host/proto/test/fio.py
parent1197ceaf9f4a3730bf89542ad28ddd6aff634ade (diff)
* host/proto:
- added proto interface.
Diffstat (limited to 'host/proto/test/fio.py')
-rw-r--r--host/proto/test/fio.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/host/proto/test/fio.py b/host/proto/test/fio.py
new file mode 100644
index 00000000..07646199
--- /dev/null
+++ b/host/proto/test/fio.py
@@ -0,0 +1,22 @@
+
+class IO:
+ def __init__ (self, fin = None, fout = None):
+ if fin is None:
+ import sys, tty
+ self.fin = sys.stdin
+ self.fout = sys.stdout
+ tty.setcbreak (sys.stdin.fileno ())
+ else:
+ self.fin = fin
+ self.fout = fout
+
+ def read (self, *args):
+ buf = self.fin.read (*args).replace ('\n', '\r')
+ return buf
+
+ def write (self, *args):
+ return self.fout.write (*[i.replace ('\r', '\n') for i in args])
+
+ def fileno (self):
+ return self.fin.fileno ()
+