aboutsummaryrefslogtreecommitdiff
path: root/duser.h
blob: e5b305f93aefaa0873cfce1bb980a5ff57831cb6 (plain) (blame)
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
#ifndef DUSER_H
#define DUSER_H

#include <limits.h>
#define REGEX_MAX   255
#define CFG_PATH "/usr/local/etc/duser"
#define SELF	__FUNCTION__
typedef struct stats_t
{
    int lines;
    int files;
    int matches;
    int added;
    int deleted;
    int modified;
} stats_t;
//Global statistics struct
stats_t processed;

typedef struct record_t
{
    int index;
    int match;
    int pad1;
    char name[REGEX_MAX];
    int pad2;
    char file[PATH_MAX];
    int pad3;
} record_t;

int cfg_open(const char* filename);
void cfg_close();
int cfg_get_key(char* val, const char* key);
int logcleanup();
int COM(const char* func, char *format, ...);
record_t* find_in_file(const char* filename, const char* needle);
int get_file_count(const char* path);
char** get_file_list(const char* path, int count);
void free_file_list(char** list);
void stats_init(stats_t *s);
int user_list(const char* needle);
int find_in_file_ex(record_t* rec);
int user_del(record_t* rec);
int user_cmd(const int argc, char* argv[]);
int user_choice(char c);
int user_add(const char* filename, const char* needle);
int user_new_list(const char* fname);
#ifdef _NLINUX_
char *strcasestr(const char *s, const char *find);
char *strchrnul(const char* s, int c);
#endif

#endif