-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutil.h
59 lines (47 loc) · 1.37 KB
/
util.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#ifndef __UTIL_H
#define __UTIL_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <signal.h>
#include <setjmp.h>
#include <poll.h>
#include <readline/readline.h>
#include <readline/history.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <sys/signalfd.h>
#include <arpa/inet.h>
#define MAX_MESSAGE_LENGTH 4096
#define PORT 5001
#define RESET "\001\033[0m\002"
#define BOLD "\001\033[1m\002"
#define UNDERLINE "\001\033[4m\002"
#define RED "\001\033[0;31m\002"
#define GREEN "\001\033[0;32m\002"
#define YELLOW "\001\033[0;33m\002"
#define BLUE "\001\033[0;34m\002"
#define MAGENTA "\001\033[0;35m\002"
#define CYAN "\001\033[0;36m\002"
#define WHITE "\001\033[0;37m\002"
#define BOLD_RED "\001\033[1;31m\002"
#define BOLD_GREEN "\001\033[1;32m\002"
#define BOLD_YELLOW "\001\033[1;33m\002"
#define BOLD_BLUE "\001\033[1;34m\002"
#define BOLD_MAGENTA "\001\033[1;35m\002"
#define BOLD_CYAN "\001\033[1;36m\002"
#define BOLD_WHITE "\001\033[1;37m\002"
extern int sock;
extern char *input;
extern char message[MAX_MESSAGE_LENGTH];
int min(int a, int b);
int checkError(int descriptor, char *description);
void prompt(char **input_ptr, char *prefix, int history);
int startsWith(char *s1, char *s2);
int equals(char *s1, char *s2);
void leftShift(char *str, int offset);
int readMessage(int fd);
#endif