1 /* General module include file */ 2 3 #ifndef _GENERAL_H 4 #define _GENERAL_H 5 6 #ifndef _STDIO_H 7 #include <stdio.h> 8 #endif 9 10 #include <termios.h> 11 #include <unistd.h> 12 #include <sys/ioctl.h> 13 14 #ifndef uint 15 #define uint unsigned int 16 #define ulong unsigned long 17 #define ushort unsigned short int 18 #define uchar unsigned char 19 #endif 20 21 #ifndef abs 22 #define abs(x) (((x)>0)? (x) : (0-(x))) 23 #endif 24 25 long freadblock( FILE *f, long size, void *target ); 26 /* reads size bytes from file f to target 27 returns 1 on success, 0 on error 28 */ 29 30 void echo( void *source, long size ); 31 /* echos size bytes taken from source to the std output this way: 32 000 001 002 000 255 ....... 33 */ 34 35 int getkey( void ); 36 /* returns a character from the stdin stream, returning 0 if no 37 key was pressed 38 */ 39 40 #endif 41 42