forked from tatwik-sai/QuickTicket
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.h
More file actions
50 lines (40 loc) · 1.44 KB
/
utils.h
File metadata and controls
50 lines (40 loc) · 1.44 KB
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
#ifndef UTILS_H
#define UTILS_H
#define MAX_STATIONS 2000
#define MAX_STATION_NAME 60
#define RESET_COLOR "\033[0m"
#define BLUE "\033[0;34m"
#define ERROR "\033[0;31m"
#define SUCCESS "\033[0;32m"
#define INNER_QUERY "\033[1;36m"
#define CHOICE "\033[0;94m"
#define HEADER_COLOR "\033[0;36m"
#define DATA_COLOR "\033[0;32m"
typedef struct Node {
char *data;
struct Node *prev;
struct Node *next;
} Node;
typedef struct DoublyLinkedList {
Node *head;
Node *tail;
} DoublyLinkedList;
typedef struct {
char t_name[300];
char stations[150][200];
int coach_cap, sleeper, general, ac3, ac2, ac1;
} Train;
DoublyLinkedList* create_list();
void insert_at_end(DoublyLinkedList *list, const char *data);
void traverse_list(DoublyLinkedList *list, int order);
void free_list(DoublyLinkedList *list);
int split_string(const char *input, int rows, int cols, char output[rows][cols]);
void merge_strings(char *output, char arr[][200], int count);
int compare_strings(const char *str1, const char *str2);
void format_string(const char *input, char *output);
int re_check(char *pattern, char *input);
int is_departure_before_arrival(char *dep_date, char *dep_time, char *arr_date, char *arr_time);
void center_text(const char *text, int width, char* colour);
void center_group_text(const char *text, int console_width);
int is_date_time_in_future(const char *date_str, const char *time_str);
#endif