common.h (778B)
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 struct item { 7 char type; 8 char redtype; 9 char *username; 10 char *selector; 11 char *host; 12 char *port; 13 char *raw; 14 char *tag; 15 void *dat; 16 Item *entry; 17 }; 18 19 struct dir { 20 Item *items; 21 size_t nitems; 22 size_t printoff; 23 size_t curline; 24 }; 25 26 void die(const char *fmt, ...); 27 size_t mbsprint(const char *s, size_t len); 28 #ifdef NEED_STRCASESTR 29 char *strcasestr(const char *h, const char *n); 30 #endif /* NEED_STRCASESTR */ 31 const char *typedisplay(char t); 32 void uicleanup(void); 33 void uidisplay(Item *entry); 34 char *uiprompt(char *fmt, ...); 35 Item *uiselectitem(Item *entry); 36 void uisetup(void); 37 void uisigwinch(int signal); 38 void uistatus(char *fmt, ...);