file_fd = fd_none;
if (op == "export") {
- if (!vm.count("file")) {
+ if (!vm.count("file") || file == "-") {
if (outistty) {
- cerr << "stdout is a tty and no --file option specified" << std::endl;
+ cerr << "stdout is a tty and no --file filename specified" << std::endl;
exit(1);
}
file_fd = STDOUT_FILENO;
file_fd = open(file.c_str(), O_WRONLY|O_CREAT|O_TRUNC, 0666);
}
} else if (op == "import") {
- if (!vm.count("file")) {
+ if (!vm.count("file") || file == "-") {
if (isatty(STDIN_FILENO)) {
- cerr << "stdin is a tty and no --file option specified" << std::endl;
+ cerr << "stdin is a tty and no --file filename specified" << std::endl;
exit(1);
}
file_fd = STDIN_FILENO;