blob: 7b6da79665d08850d08c5bd587daaf70784cd58a (
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
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
#include <stdio.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <unistd.h>
#include <time.h>
#define USAGE "to be decided"
struct trashsys_log_info {
uint64_t ts_log_id;
char ts_log_filename[255];
size_t ts_log_filesize;
time_t ts_log_trashtime;
char ts_log_originalpath[4096];
bool ts_log_tmp;
};
int main (int argc, char *argv[]) {
if (argc == 1) {
fprintf(stderr, "%s: please specify a filename\n%s\n", argv[0], USAGE);
return EXIT_FAILURE;
}
bool y_used = false;
bool n_used = false;
bool v_used = false;
bool f_used = false;
bool a_used = false;
bool t_used = false;
bool l_used = false;
bool L_used = false;
bool c_used = false;
bool C_used = false;
bool R_used = false;
int opt;
int returnval;
char *optarg_copy = NULL; // We will copy optarg to this
while ((opt = getopt(argc, argv, "ynvfatlLcCR:")) != -1) {
switch (opt) {
case 'y':
y_used = true;
break;
case 'n':
n_used = true;
break;
case 'v':
v_used = true;
break;
case 'f':
f_used = true;
break;
case 'a':
a_used = true;
break;
case 't':
t_used = true;
break;
case 'l':
l_used = true;
break;
case 'L':
L_used = true;
break;
case 'c':
c_used = true;
break;
case 'C':
C_used = true;
break;
case 'R':
R_used = true;
break;
}
}
if (n_used == true && y_used == true) { // If both YES and NO are used print usage and exit
fprintf(stderr, "%s", USAGE);
return EXIT_FAILURE;
}
return 0;
}
|