-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsusfetch.c
67 lines (56 loc) · 1.5 KB
/
susfetch.c
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#define _POSIX_C_SOURCE 200809L
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <getopt.h>
#include <stdbool.h>
#include "susfetch.h"
#include "util.h"
#include "config.h"
#define VERSION "0.2.1"
char *argv0;
void
usage()
{
fprintf(stdout, "%s [-h] [-v] [-s] [-c yellow]\nsusfetch "VERSION" developed by sleepntsheep", argv0);
exit(EXIT_SUCCESS);
}
int
main(int argc, char *argv[])
{
int ci, i, j, opt;
bool smol = false;
char colors[3][13] = { BRST, BRED, BGRY };
argv0 = *argv;
while((opt = getopt(argc, argv, "hvsc:")) != -1) {
switch (opt) {
case 'h':
case 'v':
usage();
break;
case 'c':
for (i = 0; i < LENGTH(colorss); i++)
if (!strcmp(optarg, colorss[i][0]))
strcpy(colors[1], colorss[i][1]);
break;
case 's':
smol = true;
break;
default:
break;
}
}
/* print */
fputc('\n', stdout);
for (i = 0; i < MAX(HEIGHT, LENGTH(fetch)); i++) {
fputs(" ", stdout);
for (j = 0; j < WIDTH; j++)
if (i >= HEIGHT)
fputs(" ", stdout);
else if ((ci = (smol ? smolamogus[i][j] : amogus[i][j])) >= 0)
fprintf(stdout, "%s ", colors[ci]);
fprintf(stdout, "%s %8s: %s\n", BRST, fetch[i].name, fetch[i].fnc());
}
fputc('\n', stdout);
return 0;
}