summaryrefslogtreecommitdiff
path: root/src/nonblocktail.c
blob: 329f01d9330325190c109ef37ae8e5dc2c521156 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <stdio.h>
#include <idc.h>
#include <fcntl.h>

extern struct idc_global idc;

void handler(struct shit *me,char *line) {
  if(!line) return;
  if(line) printf("%s\n",line);
}

int main(int argc,char *argv[]) {
  int i;
  setvbuf(stdout,NULL,_IOLBF,0);
  for(i=0;i<100;i++) {
    idc.fds[i].fd=-1;
  }
  for(argv++,argc--;argc;argc--,argv++) {
    idc.fds[add_fd(open(*argv,O_RDONLY),handler)].keep_open=1;
  }
  select_on_everything();
}