tyls : make the code prettier and more flexible

This commit is contained in:
broggi_t 2015-02-07 00:58:55 +01:00 committed by Boris Faure
parent 2a397f35cd
commit 4b4deb3ad3
1 changed files with 5 additions and 2 deletions

View File

@ -101,6 +101,8 @@ size_print(char *buf, int bufsz, char *sz, unsigned long long size)
#define WHITE 7 #define WHITE 7
#define BRIGHT 8 #define BRIGHT 8
#define COUNT_OF(arr) (sizeof(arr) / sizeof(*arr))
// #3399ff // #3399ff
// 51 153 355 // 51 153 355
// as 6x6x6 // as 6x6x6
@ -790,13 +792,14 @@ main(int argc, char **argv)
{ {
char *path; char *path;
char *cmp[] = {"-c", "-m", "-l"}; char *cmp[] = {"-c", "-m", "-l"};
int modes[] = {SMALL, MEDIUM, LARGE};
int j; int j;
for (j = 0; j < 3; j++) for (j = 0; j < COUNT_OF(cmp) ; j++)
{ {
if (!strcmp(argv[i], cmp[j])) if (!strcmp(argv[i], cmp[j]))
{ {
mode = j; mode = modes[j];
if (++i >= argc) break; if (++i >= argc) break;
} }
} }