#include <unistd.h> #include <fcntl.h> void motd(void) { int fd, size; char buf[8192]; if((fd = open("/etc/motd", O_RDONLY, 0)) == -1) return; while((size = read(fd, buf, sizeof(buf))) > 0) write(STDOUT_FILENO, buf, size); close(fd); }