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