-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcar.c
More file actions
48 lines (40 loc) · 1.21 KB
/
car.c
File metadata and controls
48 lines (40 loc) · 1.21 KB
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
#include <stdio.h>
#include <sys/ioctl.h>
#include <unistd.h>
#define CAR_ASCII_1 " _________________ \n"
#define CAR_ASCII_2 " / `. \n"
#define CAR_ASCII_3 " ____/ `.________ .´ \n"
#define CAR_ASCII_4 " |.| \\´...\n"
#define CAR_ASCII_5 " |/ _____ _____ \\. \n"
#define CAR_ASCII_6 "=|____//´´´\\\\____________//```\\\\______| `.\n"
#define CAR_ASCII_7 " \\___/ \\___/ \n"
#define PRINT_BLANKS(_i) \
do {\
int _j;\
for (_j = 0; _j < _i; _j++) printf(" ");\
} while (0)
int main()
{
struct winsize w;
ioctl(STDOUT_FILENO, TIOCGWINSZ, &w);
int i;
for (i = 0; i < (w.ws_col - 43); i++) {
system("clear");
PRINT_BLANKS(i);
printf(CAR_ASCII_1);
PRINT_BLANKS(i);
printf(CAR_ASCII_2);
PRINT_BLANKS(i);
printf(CAR_ASCII_3);
PRINT_BLANKS(i);
printf(CAR_ASCII_4);
PRINT_BLANKS(i);
printf(CAR_ASCII_5);
PRINT_BLANKS(i);
printf(CAR_ASCII_6);
PRINT_BLANKS(i);
printf(CAR_ASCII_7);
usleep(20000);
}
return 0;
}