Port main.cpp to C++.

This commit is contained in:
Nicolás A. Ortega Froysa 2024-10-09 20:03:10 +02:00
parent e86ca506c1
commit b5094d68e9

View File

@ -15,8 +15,9 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <stdlib.h>
#include <stdio.h> #include <iostream>
#include <cstdlib>
#include "arg_parse.hpp" #include "arg_parse.hpp"
#include "cmd.hpp" #include "cmd.hpp"
@ -25,7 +26,7 @@ int main(int argc, char *argv[]) {
enum cmd_id id; enum cmd_id id;
if(argc < 2) { if(argc < 2) {
fprintf(stderr, "Invalid number of arguments. Use 'help' sub-command.\n"); std::cerr << "Invalid number of arguments. Use 'help' sub-command." << std::endl;
print_usage(); print_usage();
return EXIT_FAILURE; return EXIT_FAILURE;
} }
@ -43,7 +44,7 @@ int main(int argc, char *argv[]) {
print_version(); print_version();
break; break;
default: default:
fprintf(stderr, "No such command '%s'. Use 'help' sub-command.\n", argv[1]); std::cerr << "No such command '" << argv[1] << "'. Use 'help' sub-command." << std::endl;
print_usage(); print_usage();
return EXIT_FAILURE; return EXIT_FAILURE;
} }