📄 ourhdr.h
字号:
/* Our own header, to be included *after* all standard system headers */#ifndef __ourhdr_h#define __ourhdr_h#include <sys/types.h> /* required for some of our prototypes */#include <stdio.h> /* for convenience */#include <stdlib.h> /* for convenience */#include <string.h> /* for convenience */#include <unistd.h> /* for convenience */#define MAXLINE 4096 /* max line length */#define FILE_MODE (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH) /* default file access permissions for new files */#define DIR_MODE (FILE_MODE | S_IXUSR | S_IXGRP | S_IXOTH) /* default permissions for new directories */struct message{ char *to; char *from; time_t sendtime; time_t recvtime; char *messageid; char *subject; char *content;};/*struct message **msgpp; */#define min(a,b) ((a) < (b) ? (a) : (b))#define max(a,b) ((a) > (b) ? (a) : (b))int lock_reg(int, int, int, off_t, int, off_t); #define read_lock(fd, offset, whence, len) \ lock_reg(fd, F_SETLK, F_RDLCK, offset, whence, len)#define readw_lock(fd, offset, whence, len) \ lock_reg(fd, F_SETLKW, F_RDLCK, offset, whence, len)#define write_lock(fd, offset, whence, len) \ lock_reg(fd, F_SETLK, F_WRLCK, offset, whence, len)#define writew_lock(fd, offset, whence, len) \ lock_reg(fd, F_SETLKW, F_WRLCK, offset, whence, len)#define un_lock(fd, offset, whence, len) \ lock_reg(fd, F_SETLK, F_UNLCK, offset, whence, len)pid_t lock_test(int, int, off_t, int, off_t); #define is_readlock(fd, offset, whence, len) \ lock_test(fd, F_RDLCK, offset, whence, len)#define is_writelock(fd, offset, whence, len) \ lock_test(fd, F_WRLCK, offset, whence, len)void err_dump(const char *, ...); void err_msg(const char *, ...);void err_quit(const char *, ...);void err_ret(const char *, ...);void err_sys(const char *, ...);void log_msg(const char *, ...); void log_open(const char *, int, int);void log_quit(const char *, ...);void log_ret(const char *, ...);void log_sys(const char *, ...);#endif /* __ourhdr_h */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -