Use std::exit() instead of C exit() function
This commit is contained in:
parent
17b614a278
commit
74fe842445
12
mcopy.cpp
12
mcopy.cpp
|
@ -115,7 +115,7 @@ void getMetadataFromFile(std::string format, std::string str) {
|
||||||
|
|
||||||
if (!std::filesystem::copy_file(str, filename)) {
|
if (!std::filesystem::copy_file(str, filename)) {
|
||||||
std::cerr << "mcopy: Failed to copy file " << str << " to " << filename << "\n";
|
std::cerr << "mcopy: Failed to copy file " << str << " to " << filename << "\n";
|
||||||
exit(1);
|
std::exit(1);
|
||||||
} else if (!quiet) {
|
} else if (!quiet) {
|
||||||
std::cout << "mcopy: Copied file " << str << " to " << filename << "\n";
|
std::cout << "mcopy: Copied file " << str << " to " << filename << "\n";
|
||||||
}
|
}
|
||||||
|
@ -132,10 +132,10 @@ int main(int argc, char **argv) {
|
||||||
|
|
||||||
if (!arg.compare("-h") || !arg.compare("--help")) {
|
if (!arg.compare("-h") || !arg.compare("--help")) {
|
||||||
help();
|
help();
|
||||||
exit(0);
|
std::exit(0);
|
||||||
} else if (!arg.compare("-v") || !arg.compare("--version")) {
|
} else if (!arg.compare("-v") || !arg.compare("--version")) {
|
||||||
std::cout << "mcopy " << VERSION << '\n';
|
std::cout << "mcopy " << VERSION << '\n';
|
||||||
exit(0);
|
std::exit(0);
|
||||||
} else if (!arg.compare("-a") || !arg.compare("--ask")) {
|
} else if (!arg.compare("-a") || !arg.compare("--ask")) {
|
||||||
ask = true;
|
ask = true;
|
||||||
} else if (!arg.compare("-na") || !arg.compare("--no-ask")) {
|
} else if (!arg.compare("-na") || !arg.compare("--no-ask")) {
|
||||||
|
@ -154,12 +154,12 @@ int main(int argc, char **argv) {
|
||||||
|
|
||||||
if (!format.compare("")) {
|
if (!format.compare("")) {
|
||||||
std::cerr << "mcopy: You must specify a format.\n";
|
std::cerr << "mcopy: You must specify a format.\n";
|
||||||
exit(1);
|
std::exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argc < 4) {
|
if (argc < 4) {
|
||||||
std::cerr << "mcopy: You must specify a file to copy.\n";
|
std::cerr << "mcopy: You must specify a file to copy.\n";
|
||||||
exit(1);
|
std::exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int set{0};
|
int set{0};
|
||||||
|
@ -175,6 +175,6 @@ int main(int argc, char **argv) {
|
||||||
|
|
||||||
if (!set) {
|
if (!set) {
|
||||||
std::cerr << "mcopy: File not found.\n";
|
std::cerr << "mcopy: File not found.\n";
|
||||||
exit(1);
|
std::exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue