Minor updates to generally make it suck less...

This commit is contained in:
Ognjen Milan Robovic 2023-09-12 05:22:25 -04:00
parent 7f36fa2d60
commit 8411647d92
3 changed files with 44 additions and 2 deletions

View File

@ -2,7 +2,7 @@
set -xe
sudo cp xtandard.h /usr/include/xolatile/xtandard.h
sudo cp xtandard.c /usr/include/xolatile/xtandard.c
cp xtandard.h /usr/include/xolatile/xtandard.h
cp xtandard.c /usr/include/xolatile/xtandard.c
exit

View File

@ -305,6 +305,17 @@ void file_export (char * name, void * data) {
(void) data;
}
int character_compare_array (char character, char * character_array, int count) {
int i = 0;
do {
if (character == character_array [i]) {
return (i);
}
} while (++i != count);
return (0);
}
int string_length (char * string) {
int length = 0;
@ -451,4 +462,29 @@ int string_split_space (char * string) {
return (++count);
}
void terminal_clear (void) {
out ("\033[2J\033[H", 7);
}
void terminal_style (int effect, int colour) {
char format [8] = "\033[ ;3 m";
if ((effect == -1) || (colour == -1)) {
out ("\033[0m", 4);
} else {
format [2] = (char) effect + '0';
format [5] = (char) colour + '0';
out (format, 7);
}
}
void terminal_show_cursor (int show) {
if (show != 0) {
out ("\033[?25h", 6);
} else {
out ("\033[?25l", 6);
}
}
#endif

View File

@ -78,6 +78,8 @@ extern void file_list_import (char *);
extern void file_list_export (char *);
extern void file_list_delete (void);
extern int character_compare_array (char, char *, int);
extern int string_length (char *);
extern void string_reverse (char *);
@ -93,4 +95,8 @@ extern void string_concatenate_limit (char *, char *, int);
extern int string_split_space (char *);
extern void terminal_clear (void);
extern void terminal_style (int, int);
extern void terminal_show_cursor (int);
#endif