#pragma once #include #define PTHREAD_CHECK(func_,...) do { int ret=(func_)(__VA_ARGS__); if(ret!=0){ fprintf(stderr,#func_ ": %s\n",strerror(ret)); exit(1); } } while(0) char* copy_buf(const char *buf,int len); char* copy_str(const char *str); void str_toupper(char *str); // Returns -1 on error, 0 on success int sendall(int sock,const char *buf,ssize_t len); int sendallf(int sock,const char *format,...) __attribute__((format (printf, 2, 3)));