#ifndef UTIL_H #define UTIL_H /* * TEA Total Copyright (c) Alex Holden 2000, 2001. * * This code is public domain; you can do whatever you want with it, though I * would prefer you to contribute any bug fixes back to me if possible. * This software comes with NO WARRANTY WHATSOEVER, not even the implied * warranties of merchantability and fitness for a particular purpose. */ #include /* Needed for size_t */ #include /* Needed for struct termios */ extern struct termios origtermattr; extern void restore_termattr(void); extern int hextoint(char *p); extern void inttohex(u8 i, char *p); extern u32 swapu32(u32 n); extern void die(char *msg); extern void *safe_malloc(size_t size); extern char *safe_strdup(const char *s); extern long safe_readwrite(int fd, void *buf, long len, int r); #define safe_read(A, B, C) safe_readwrite(A, B, C, 1) #define safe_write(A, B, C) safe_readwrite(A, B, C, 0) extern int openwrite(char *path); #endif