/* skel.h - From Jon C. Snader: Effective TCP/IP Programming * Addison-Wesley 2000 * For better understanding, read the excellent Snader book. */ #ifndef __SKEL_H__ #define __SKEL_H__ /* UNIX version */ #define INIT() ( program_name = \ strrchr( argv[ 0 ], '/' ) ) ? \ program_name++ : \ ( program_name = argv[ 0 ] ) /* program_name is of type "char *". It is set to argv[0] if argv[0] consists of just a filename. If instead argv[0] denotes a path, program_name is just the file name that follows the rightmost "/" */ #define EXIT(s) exit( s ) #define CLOSE(s) if ( close( s ) ) error( 1, errno, \ "close failed" ) #define set_errno(e) errno = ( e ) #define isvalidsock(s) ( ( s ) >= 0 ) typedef int SOCKET; #endif /* __SKEL_H__ */