summaryrefslogtreecommitdiff
path: root/trashsystem2.cpp
blob: 123ce9e380d03ae0e5ce96ecac40a19621b2e596 (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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#include <iostream>
#include "trashsystem2.hpp"
#include <unistd.h>

/*
 *
 * Trashing System (Version 2)
 *
 * A hopefully improved take on the previous trash
 * system that i made in C. By reimplementing this
 * in C++ i hope to avoid the bugs and code smell
 * that eventually cropped up in the last project.
 *
 * While i am optimistic at this point my pessimism
 * will probably prove me wrong because i will most
 * likely encounter other problems that will give
 * my code that nice funky smell.
 *
 */

char *g_argv = nullptr;

inline void usage_out(std::ostream &out) {
	
	out << USAGE;
}

inline void usage_out_long(std::ostream &out) {
	
	out << LONG_USAGE;
}

int main (int argc, char **argv) {

	g_argv = argv[0];
	if (argc == 1) {
		usage_out(std::cerr);
        return EXIT_FAILURE;
    }
	
	int R_mut = 0;
	int C_mut = 0;
	int c_mut = 0;
	int L_mut = 0;
	int l_mut = 0;
	int y_mut = 0;
	int n_mut = 0;
	int f_mut = 0;
	int h_mut = 0;
	bool y_used = false;
	bool n_used = false;
	bool v_used = false;
	bool f_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;	
	bool h_used = false;
    int opt;
	unsigned long long optarg_converted;
	bool R_failed = false;
	while ((opt = getopt(argc, argv, "ynvfatlLcCR:h")) != -1) {
        switch (opt) {
        case 'y':

			y_mut = 1;
			y_used = true; // YES on enter

        break;
        case 'n':

			n_mut = 1;
            n_used = true; // NO on enter

        break;
        case 'v':
			
            v_used = true; // Verbose debug mode

        break;
        case 'f':

			f_mut = 1;
            f_used = true; // choice will not ask, it will just say yes by default thus basically "forcing" it

        break;
	    case 't':

			t_used = true;
			
		break;
		case 'l':

			l_mut = 1;
			l_used = true;
			
		break;
		case 'L':

			L_mut = 1;
			L_used = true;
			
		break;
		case 'c':

			c_mut = 1;
			c_used = true;
			
		break;
		case 'C':

			C_mut = 1;
			C_used = true;
			
		break;
		case 'R': {

			R_mut = 1;
			R_used = true;
			
		}
		break;
		case 'h':

			h_mut = 1;
			h_used = true;

		break;
        }
    }

	std::cout << "Smoketest" << std::endl;
	std::cout << argc << std::endl;
	std::cout << argv[0] << std::endl;
	std::cout << BUF_SIZE_1MIB << std::endl;
	return 0;
}