// io.c: minimal cat version (from Kernighan and Pike) /*************************************************** * OS Class, Fall 2007, Chee Yap * * This program will echo whatever you type. * To terminate, type control-D ***************************************************/ #define SIZE 512 // arbitrary int main() { char buf[SIZE]; int n; while ((n = read(0, buf, sizeof buf)) > 0) write( 1, buf, n); return(0); }