handling of empty dirs & refactoring
This commit is contained in:
7
colors.c
7
colors.c
@@ -50,15 +50,14 @@ void colors_init() {
|
||||
|
||||
FILE *dircolors = fopen("/etc/DIR_COLORS", "r");
|
||||
if (dircolors) {
|
||||
char *line;
|
||||
char *line = NULL;
|
||||
char *token;
|
||||
char *extension;
|
||||
int tmp = 0;
|
||||
size_t size = 0;
|
||||
short fg;
|
||||
short bg;
|
||||
|
||||
while ((tmp = getline(&line, &size, dircolors)) != -1) {
|
||||
while (getline(&line, &size, dircolors) != -1) {
|
||||
fg = 7;
|
||||
bg = 0;
|
||||
token = strtok(line, " ");
|
||||
@@ -101,7 +100,7 @@ void colors_init() {
|
||||
colors = malloc(sizeof(color) * color_count);
|
||||
unsigned int i = 0;
|
||||
/* proper pass, reads all defined extensions within /etc/DIR_COLORS */
|
||||
while ((tmp = getline(&line, &size, dircolors)) != -1) {
|
||||
while (getline(&line, &size, dircolors) != -1) {
|
||||
fg = 7;
|
||||
bg = 0;
|
||||
if (line[0] == '.') {
|
||||
|
Reference in New Issue
Block a user