conman - while (ch!='q') { len = read(STDIN_FILENO,...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
/* * conman.c * * Echoes characters until a 'q' is read. * This should work once the basic system calls are implemented. */ #include <unistd.h> #include <err.h> int main() { char ch=0; int len;
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: while (ch!='q') { len = read(STDIN_FILENO, &amp;ch, 1); if (len &lt; 0) { err(1, &quot;stdin: read&quot;); } if (len==0) { /* EOF */ break; } write(STDOUT_FILENO, &amp;ch, 1); } return 0; }...
View Full Document

Ask a homework question - tutors are online