summaryrefslogtreecommitdiff
path: root/idc.h
blob: ffdf48c53be2223c364c0cad1a8f427470f7f7f5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#ifndef _IDC_H_
#define _IDC_H_

#include <stdio.h>
#include <sys/select.h>

char *read_line_hack(FILE *fp,int len);
int update_shits();
char *memstr(char *s,char *find,size_t l);
int select_on_everything();

#define CHUNK 4096

struct shit {
  int fd;
  char *backlog;
  int blsize;
  int bllen;
  char buffer[CHUNK];//THIS IS *NOT* NULL TERMINATED.

  char *delim;

  char read_lines_for_us;
  char keep_open;
  char eof;
  //other stuffs?
//  union {
  void (*line_handler)(struct shit *me,char *line);//function pointer to the handler. ???
//    (void *line_handler_fd)(int fd,char *)
//  };//???
  void *extra_info;//extra info that I don't care to name atm
};

struct idc_global {
  int fdmax;
  int shitlen;
  struct shit fds[FD_SETSIZE];
};

int add_fd(int fd,void (*line_handler)(struct shit *,char *));
#endif