Exemplo n.º 1
0
/***
 * Reads at most \texttt{len - 1} characters from the polling TTY
 * driver to the buffer \texttt{s}. Reading is line-oriented so
 * characters are read until a newline character is encountered (or
 * \texttt{len} characters has been read). The resulting string will
 * be null-terminated.
 *
 * @param s The buffer which will contain the read line.
 *
 * @param len The length of the buffer \texttt{s}.
 *
 */
void kread(char *s, 
           int len)
{
    int ch;
    int count = 0;

    while (((ch = polltty_getchar()) != '\n') &&
           (count < len - 1)){
        s[count] = ch;
        count++;
    }
    s[count] = '\0';
}
Exemplo n.º 2
0
int syscall_read(char *buffer) {
  /* Not a G1 solution! */
  *buffer = polltty_getchar();
  return 1;
}