Welcome to mirror list, hosted at ThFree Co, Russian Federation.

io.c « libgloss.all « testsuite « libgloss - cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5ad93ef880689f35d9b9b8f65ad5f2d659783bf4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
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);
}