summaryrefslogtreecommitdiff
path: root/src/entry.c
blob: dceb4247eb31807d11a4cd1ff09f3d431baf83bc (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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include <assert.h>
#include <dirent.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

#include "include/entry.h"
#include "include/read_cfg.h"

typedef struct entry{
	char name[BUF_LEN];
	char path[BUF_LEN];
	bool path_force;
} ENTRY;

ENTRY *create_entry(const char *new_name, const char *new_path, const bool force){
	ENTRY *new;

	new = malloc(sizeof(ENTRY));

	strcpy(new->name, new_name);
	strcpy(new->path, new_path);
	new->path_force = force;

	return new;
}

char *get_ename(ENTRY *e){
	assert(e != NULL);
	return e->name;
}

char *get_epath(ENTRY *e){
	assert(e != NULL);
	return e->path;
}

bool get_eforce(ENTRY *e){
	assert(e != NULL);
	return e->path_force;
}

/*
void entry_debug(ENTRY *trav){

	while(trav != NULL){
		printf("%s, \n", trav->name);
		trav = trav->next;
	}

	return;
}
*/