#include "stdio.h"
#include "string.h"
#include "sys/time.h"
#include "unistd.h"
int main(void){
int n=0;
char input[55]="\0";
struct timeval timeout;
timeout.tv_sec=3;
timeout.tv_usec=0;
fd_set rdfds;
FD_ZERO(&rdfds);
FD_SET(0,&rdfds);
int ret=select(1,&rdfds,NULL,NULL,&timeout);
if (ret<0) perror("select");
if (ret==0) printf("it's timeout!\n");
if (ret>0) {n=1;}
if (n==1) {read(0,input,55);
write(1,input,strlen(input));}}