tskrtt

Simple libev based gopher server
git clone https://git.inz.fi/tskrtt/
Log | Files | Refs | README

common.h (683B)


      1 #ifndef COMMON_H
      2 #define COMMON_H
      3 
      4 #include <stddef.h>
      5 
      6 #if EV_MULTIPLICITY
      7 # define EV_UNUSED (void)EV_A
      8 #else
      9 # define EV_UNUSED
     10 #endif
     11 
     12 #define FOFFSET(x, y) (ptrdiff_t)(&((x *)NULL)->y)
     13 #define PTR_FROM_FIELD(x, y, z) ((x *)((size_t)z - FOFFSET(x, y)))
     14 
     15 #ifndef ev_io_modify
     16 #define ev_io_modify(ev,events_)             do { (ev)->events = (ev)->events & EV__IOFDSET | (events_); } while (0)
     17 #endif
     18 
     19 extern const char *hostname;
     20 extern const char *oport;
     21 extern const char dfl_port[];
     22 extern const char *gopherroot;
     23 
     24 void accesslog(struct client *c, const char *resource, const char *qs, const char *ss);
     25 char *cleanup_path(char *path, char **basename, size_t *pathlen);
     26 
     27 #endif