-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmx_utils.c
More file actions
35 lines (34 loc) · 794 Bytes
/
mx_utils.c
File metadata and controls
35 lines (34 loc) · 794 Bytes
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
#include <mx_utils.h>
#include <mx_debug.h>
/*
* Remove all white spaces until encounter a character.
*/
void
remove_white_spaces_until_character (char *str, int offset, int *_len)
{
int indexJ;
int len = *_len;
log("%s:%d",str, len);
while (offset < len && str[offset] != '\0' && str[offset] == ' ') {
indexJ = offset;
while (indexJ <= len) {
str[indexJ] = str[indexJ+1];
indexJ++;
}
len--;
}
*_len = len;
}
/*
* Print an error message
*/
void print_cmd_error (char* inputcmdbuff, int errorindex)
{
int i = 0;
printf("\n%s\n",inputcmdbuff);
while (i < (errorindex-1)) {
printf(" ");
i++;
}
printf(KRED"^^^"KNRM);
}