Cygwin: cygwin_GetCommandLineW/A: don't rely on __argv[0] content
[newlib-cygwin.git] / libgloss / testsuite / libgloss.all / io.c
blob5ad93ef880689f35d9b9b8f65ad5f2d659783bf4
1 /*
2 io.c -- Test the serial I/O.
3 */
5 #define BUFSIZE 80
6 #include <stdio.h>
8 main()
10 char buf[100];
11 char *tmp;
12 int result;
14 /* test the lowest level output function */
15 result = outbyte ('&');
16 if (result != 0x0) {
17 pass ("outbyte");
18 } else {
19 fail ("outbyte");
22 /* try writing a string */
23 result = write ("Write Test:\n", 12);
24 print ("result was ");
25 putnum (result);
26 outbyte ('\n');
27 if (result == 12) {
28 pass ("write");
29 } else {
30 fail ("write");
33 /* try the print() function too */
34 result = print ("Print Test:\n");
35 print ("result was ");
36 putnum (result);
37 outbyte ('\n');
38 if (result == 12) {
39 pass ("print");
40 } else {
41 fail ("print");
44 /* try the iprintf() function too */
45 result = print ("Iprintf Test:\n");
46 print ("result was ");
47 putnum (result);
48 outbyte ('\n');
49 if (result == 14) {
50 pass ("iprintf");
51 } else {
52 fail ("iprintf");
55 /* try to read a string */
56 print ("Type 5 characters");
58 result = 0;
59 result = read (0, buf, 5);
60 print (buf);
61 if (result == 5) {
62 pass ("read");
63 } else {
64 fail ("read");
67 /* clear everything out */
68 fflush (stdout);