-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfileRemover.h
More file actions
54 lines (37 loc) · 1.15 KB
/
fileRemover.h
File metadata and controls
54 lines (37 loc) · 1.15 KB
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
#ifndef _FILEREMOVER_GUARD
#define _FILEREMOVER_GUARD
#include <time.h>
// MAX LENGTHS
#define MAX_PATHNAME_LEN 100000
#define MAX_GREP_TERM_REGEX 5000
// ARGV Indexes
#define ARG_INDEX 1
#define TERM_INDEX 2
// Length of argument type.
#define ARG_TYPE_LEN 3
// Boolean conditions.
#define TRUE 1
#define FALSE 0
// Types of calls.
#define CALL_NORM 0
#define CALL_PREFIX 1
#define CALL_TIME 2
#define CALL_GREP 3
// Directory
#define DIR_CHAR '/'
#define DIR_DELIM "/"
#define CUR_DIR "./"
// File Descriptors
#define READ_END 0
#define WRITE_END 1
static time_t retrieveTime(char path[MAX_PATHNAME_LEN]);
static time_t stripTime(char *datetime);
static int calculateTimeDiff(char *datetime, char filePath[MAX_PATHNAME_LEN]);
static int findPaths(char *searchTerm, char filePath[MAX_PATHNAME_LEN],
int callType);
static void removeNameFileDir(char **nameCollection, int numNames,
int isPrefix);
static void removeDirectory(char path[MAX_PATHNAME_LEN]);
static void removeGreppedFile(char **nameCollection, int numNames, int callType);
static int grepFiles(char *grepTerms, char filePath[MAX_PATHNAME_LEN]);
#endif