File: disk.h

package info (click to toggle)
yiff 2.14.5-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 3,344 kB
  • ctags: 3,360
  • sloc: ansic: 40,505; cpp: 7,420; makefile: 425; sh: 242
file content (92 lines) | stat: -rw-r--r-- 2,200 bytes parent folder | download | duplicates (7)
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/*
	  Disk IO, Directory Listing, and Path Parsing/Manipulations
*/


#ifndef DISK_H
#define DISK_H

#include <sys/types.h>
#include "os.h"

#if defined(WIN32)
# include <direct.h>
# define mode_t unsigned short
# define S_ISREG(m) ((m) & S_IFREG)
# define S_ISDIR(m) ((m) & S_IFDIR)
#endif

#ifdef __cplusplus
extern "C" {
#endif

/* Path deliminator */
#ifndef DIR_DELIMINATOR
# ifdef WIN32
#  define DIR_DELIMINATOR	'\\'
# else
#  define DIR_DELIMINATOR	'/'
# endif
#endif

#if defined(WIN32)
# define PATH_SEP_CHAR		'\\'
# define PATH_SEP_STR		"\\"
# define CWD_STR		".\\"
#else
# define PATH_SEP_CHAR		'/'
# define PATH_SEP_STR		"/"
# define CWD_STR		"./"
#endif


extern int FILEHASEXTENSION(const char *filename);
extern int ISPATHABSOLUTE(const char *path);
extern int NUMDIRCONTENTS(const char *path);

extern int COMPARE_PARENT_PATHS(const char *path, const char *parent);

extern int ISPATHDIR(const char *path);
extern int ISLPATHDIR(const char *path);
extern int ISPATHEXECUTABLE(const char *path);

extern int rmkdir(const char *path, mode_t m);

extern char *PathSubHome(const char *path);
extern char **GetDirEntNames2(const char *parent, int *total);
extern char **GetDirEntNames(const char *parent);
extern char *ChangeDirRel(const char *cpath, const char *npath);
extern void StripAbsolutePath(char *path);
extern void StripParentPath(char *path, const char *parent);

#if defined(__cplusplus) || defined(c_plusplus)
extern "C" char *PrefixPaths(const char *parent, const char *child);
#else
extern char *PrefixPaths(const char *parent, const char *child);
#endif

extern char *GetAllocLinkDest(const char *link);
extern char *GetParentDir(const char *path);

#define COMPLETE_PATH_SUCCESS		0
#define COMPLETE_PATH_NONE		-1
#define COMPLETE_PATH_AMBIGUOUS		-2
#define COMPLETE_PATH_PARTIAL		-3
extern char *CompletePath(char *path, int *status);

extern int FileCountLines(const char *filename);
extern int DirHasSubDirs(const char *path);
extern void StripPath(char *path);
extern void SimplifyPath(char *path);

extern int CopyObject(
	const char *target, const char *source,
	int (*comferm_func)(const char *, const char *)
);


#ifdef __cplusplus
}
#endif

#endif /* DISK_H */