sacc

sacc (saccomys): simple gopher client.
Log | Files | Refs | LICENSE

common.h (1048B)


      1 #define clear(p)	do { void **_p = (void **)(p); free(*_p); *_p = NULL; } while (0);
      2 
      3 typedef struct item Item;
      4 typedef struct dir Dir;
      5 
      6 enum {
      7 	TXT,
      8 	DIR,
      9 	CSO,
     10 	ERR,
     11 	MAC,
     12 	DOS,
     13 	UUE,
     14 	IND,
     15 	TLN,
     16 	BIN,
     17 	MIR,
     18 	IBM,
     19 	GIF,
     20 	IMG,
     21 	URL,
     22 	INF,
     23 	UNK,
     24 	BRK,
     25 };
     26 
     27 struct item {
     28 	char type;
     29 	char redtype;
     30 	char *username;
     31 	char *selector;
     32 	char *host;
     33 	char *port;
     34 	char *raw;
     35 	char *tag;
     36 	void *dat;
     37 	Item *entry;
     38 };
     39 
     40 struct dir {
     41 	Item *items;
     42 	size_t nitems;
     43 	size_t printoff;
     44 	size_t curline;
     45 };
     46 
     47 extern void (*diag)(char *, ...);
     48 
     49 extern void die(const char *, ...);
     50 extern size_t mbsprint(const char *, size_t);
     51 #ifdef NEED_STRCASESTR
     52 extern char *strcasestr(const char *, const char *);
     53 #endif /* NEED_STRCASESTR */
     54 extern const char *typedisplay(char);
     55 extern int itemuri(Item *, char *, size_t);
     56 extern void yankitem(Item *);
     57 extern void uicleanup(void);
     58 extern void uidisplay(Item *);
     59 extern char *uiprompt(char *, ...);
     60 extern Item *uiselectitem(Item *);
     61 extern void uisetup(void);
     62 extern void uisigwinch(int);
     63 extern void uistatus(char *, ...);