diff options
author | Ranjith Kumaran <ranjith@cygnus.com> | 2000-03-17 22:48:54 +0000 |
---|---|---|
committer | Ranjith Kumaran <ranjith@cygnus.com> | 2000-03-17 22:48:54 +0000 |
commit | 03261851a10dd2d6900a0a00a7515a0a46fb5d76 (patch) | |
tree | 7c22ac6cbbc99fd5cd1b5426853be8d4fd7bfcf1 /libgloss/testsuite/libgloss.all/io.c | |
parent | fae4c299f14fc23e2829c8656992eba21f79242a (diff) | |
download | cygnal-03261851a10dd2d6900a0a00a7515a0a46fb5d76.tar.gz cygnal-03261851a10dd2d6900a0a00a7515a0a46fb5d76.tar.bz2 cygnal-03261851a10dd2d6900a0a00a7515a0a46fb5d76.zip |
20000317 sourceware import
Diffstat (limited to 'libgloss/testsuite/libgloss.all/io.c')
-rw-r--r-- | libgloss/testsuite/libgloss.all/io.c | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/libgloss/testsuite/libgloss.all/io.c b/libgloss/testsuite/libgloss.all/io.c new file mode 100644 index 000000000..5ad93ef88 --- /dev/null +++ b/libgloss/testsuite/libgloss.all/io.c @@ -0,0 +1,71 @@ +/* + io.c -- Test the serial I/O. + */ + +#define BUFSIZE 80 +#include <stdio.h> + +main() +{ + char buf[100]; + char *tmp; + int result; + + /* test the lowest level output function */ + result = outbyte ('&'); + if (result != 0x0) { + pass ("outbyte"); + } else { + fail ("outbyte"); + } + + /* try writing a string */ + result = write ("Write Test:\n", 12); + print ("result was "); + putnum (result); + outbyte ('\n'); + if (result == 12) { + pass ("write"); + } else { + fail ("write"); + } + + /* try the print() function too */ + result = print ("Print Test:\n"); + print ("result was "); + putnum (result); + outbyte ('\n'); + if (result == 12) { + pass ("print"); + } else { + fail ("print"); + } + + /* try the iprintf() function too */ + result = print ("Iprintf Test:\n"); + print ("result was "); + putnum (result); + outbyte ('\n'); + if (result == 14) { + pass ("iprintf"); + } else { + fail ("iprintf"); + } + + /* try to read a string */ + print ("Type 5 characters"); + + result = 0; + result = read (0, buf, 5); + print (buf); + if (result == 5) { + pass ("read"); + } else { + fail ("read"); + } + + /* clear everything out */ + fflush (stdout); +} + + |