-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
33 lines (28 loc) · 748 Bytes
/
main.cpp
File metadata and controls
33 lines (28 loc) · 748 Bytes
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
#include "ascii85.h"
#include <iostream>
#include <string>
int main(int argc, char* argv[]) {
bool adobe_mode = false;
std::string mode;
for (int i = 1; i < argc; ++i) {
std::string arg = argv[i];
if (arg == "-e" || arg == "-d") {
mode = arg;
} else if (arg == "--adobe") {
adobe_mode = true;
} else {
std::cerr << "Invalid option: " << arg << "\n";
return 1;
}
}
if (mode.empty()) {
std::cerr << "Usage: " << argv[0] << " [-e|-d] [--adobe]\n";
return 1;
}
if (mode == "-e") {
ASCII85::runEncoder(adobe_mode);
} else if (mode == "-d") {
ASCII85::runDecoder(adobe_mode);
}
return 0;
}