summaryrefslogtreecommitdiffstats
path: root/include/libbb.h
blob: a362bd32d87a2479902553103ae772214d375e71 (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

#ifndef __LIBBB_H
#define __LIBBB_H

#include <linux/stat.h>

#define DOT_OR_DOTDOT(s) ((s)[0] == '.' && (!(s)[1] || ((s)[1] == '.' && !(s)[2])))

char *concat_path_file(const char *path, const char *filename);
char *concat_subpath_file(const char *path, const char *f);
int execable_file(const char *name);
char *find_execable(const char *filename);
char* last_char_is(const char *s, int c);

enum {
	ACTION_RECURSE     = (1 << 0),
	ACTION_FOLLOWLINKS    = (1 << 1),
	ACTION_DEPTHFIRST  = (1 << 2),
	/*ACTION_REVERSE   = (1 << 3), - unused */
};

int recursive_action(const char *fileName, unsigned flags,
	int (*fileAction) (const char *fileName, struct stat* statbuf, void* userData, int depth),
	int (*dirAction) (const char *fileName, struct stat* statbuf, void* userData, int depth),
	void* userData, const unsigned depth);

char * safe_strncpy(char *dst, const char *src, size_t size);

int process_escape_sequence(const char *source, char *dest, int destlen);

char *simple_itoa(unsigned int i);

#endif /* __LIBBB_H */