aboutsummaryrefslogtreecommitdiffstats
path: root/fbiconfig.c
blob: 0d86860d5f9ad358f078f3739ba2d9d7735077d8 (plain)
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
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/stat.h>

#include "parseconfig.h"
#include "fbiconfig.h"

static char *fbi_config = NULL;

static void init_config(void)
{
    char *home;
    
    home = getenv("HOME");
    if (NULL == home)
	return;

    fbi_config = malloc(strlen(home) + 16);
    sprintf(fbi_config,"%s/.fbirc", home);
}

void fbi_read_config(void)
{
    init_config();
    if (fbi_config)
	cfg_parse_file("config", fbi_config);
}

void fbi_write_config(void)
{
    if (fbi_config)
	cfg_write_file("config", fbi_config);
}