Signed-off-by: 0xf8 <0xf8.dev@proton.me>
This commit is contained in:
0xf8 2023-02-25 12:27:55 -05:00
parent e9c15019ea
commit e488536d0d
Signed by: 0xf8
GPG Key ID: 446580D758689584

View File

@ -46,9 +46,9 @@ case enum:\
unsigned long long t = 0; unsigned long long t = 0;
void genColors(char *s) { void genColors(char *s) {
char *cstr = malloc(20 * sizeof(char));
for (int i = 0; i < strlen(s); i++) { for (int i = 0; i < strlen(s); i++) {
enum color c = (((t + i) / COLOR_SKIP) % COLORS); enum color c = (((t + i) / COLOR_SKIP) % COLORS);
char *cstr = malloc(256*sizeof(char));
switch (c) { switch (c) {
//addcase(enum value, #define name) //addcase(enum value, #define name)
@ -72,23 +72,24 @@ int main(int carg, char **varg) {
return 1; return 1;
} }
char *text = malloc(1024*sizeof(char)); char *text = malloc(1024 * sizeof(char));
int t_ind = 0;
// Similar to pythons str.join() method // Similar to pythons str.join() method
// Adds all the arguments together with spaces seperating them // Adds all the arguments together with spaces seperating them
// EG: ./rbtext hello world > "hello world" // EG: ./rbtext hello world > "hello world"
for (int i = 1; i < carg; i++) { for (int i = 1, j = 0; i < carg; i++) {
for (int j = 0; j < strlen(varg[i]); j++,t_ind++) { for (int k = 0; k < strlen(varg[i]); k++, j++) {
text[t_ind] = varg[i][j]; text[j] = varg[i][k];
} }
text[t_ind] = ' ';
t_ind++; text[j] = ' ';
j++;
} }
while (1) { while (1) {
printf("\r"); printf("\r");
genColors(text); genColors(text);
printf("\e[0m");
fflush(stdout); fflush(stdout);
usleep(CONF_SLEEP_TIMEMS*1000); usleep(CONF_SLEEP_TIMEMS*1000);
t += 1; t += 1;