-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathutils.c
52 lines (41 loc) · 979 Bytes
/
utils.c
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
#include "utils.h"
bool checkArgs(int argc, char *argv[]){
if(argc == 1)
return false;
if(argc == 3 && isdigit(*argv[1]) && isdigit(*argv[2])){
return true;
}
printErrorMsg("If you are using args, please insert 2 values like: 20 20");
return false;
}
void setNrmColor(){
printf(KNRM);
}
void printErrorMsg(char *msg){
printf(KRED "%s\n",msg);
setNrmColor();
}
void printErrorMsgInt(char *msg, int num){
printf(KRED "%s %d\n",msg,num);
setNrmColor();
}
void printSuccessMsg(char * msg){
printf(KGRN "%s\n",msg);
setNrmColor();
}
void printWarningMsg(char *msg){
printf(KYEL "%s\n",msg);
setNrmColor();
}
void printWarningMsgInt(char *msg, int num){
printf(KYEL "%s %d\n",msg,num);
setNrmColor();
}
void deBug(char *msg){
printf(KMAG "%s\n",msg);
setNrmColor();
}
void clearScreen(){
const char *CLEAR_SCREEN_ANSI = "\e[1;1H\e[2J";
write(STDOUT_FILENO, CLEAR_SCREEN_ANSI, 12);
}