feat(09): adding the start of the parsing
This commit is contained in:
parent
fb8df888bf
commit
116ddcabe4
1 changed files with 23 additions and 1 deletions
|
|
@ -6,17 +6,39 @@
|
||||||
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/05/01 14:45:40 by rparodi #+# #+# */
|
/* Created: 2025/05/01 14:45:40 by rparodi #+# #+# */
|
||||||
/* Updated: 2025/05/01 16:28:50 by rparodi ### ########.fr */
|
/* Updated: 2025/05/02 16:06:17 by rparodi ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "PmergeMe.hpp"
|
#include "PmergeMe.hpp"
|
||||||
|
#include <cctype>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
int check_input(int argc, char **argv) {
|
||||||
|
for (size_t i = 1; i < static_cast<size_t>(argc); i++) {
|
||||||
|
for (size_t j = 0; argv[i][j]; j++) {
|
||||||
|
if (!std::isdigit(argv[i][j]))
|
||||||
|
return (i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
if (DEBUG)
|
if (DEBUG)
|
||||||
std::cerr << CLR_MAGENTA << "Warning: DEBUG_MODE is now enable" << CLR_RESET << std::endl << std::endl;
|
std::cerr << CLR_MAGENTA << "Warning: DEBUG_MODE is now enable" << CLR_RESET << std::endl << std::endl;
|
||||||
if (argc < 2)
|
if (argc < 2)
|
||||||
std::cerr << CLR_RED << "Usage:\t" << argv[0] << " <number> <number> ..." << CLR_RESET << std::endl;
|
std::cerr << CLR_RED << "Usage:\t" << argv[0] << " <number> <number> ..." << CLR_RESET << std::endl;
|
||||||
|
else {
|
||||||
|
if (DEBUG) {
|
||||||
|
std::cerr << CLR_CYAN << "Info: " << argv[0] << " have " << argc - 1 << " arguments !" << CLR_RESET << std::endl << std::endl;
|
||||||
|
}
|
||||||
|
int check = check_input(argc, argv);
|
||||||
|
if (check) {
|
||||||
|
std::cerr << CLR_RED << "Error: I only have to have number in parameter (args: " << check << ")" << CLR_RESET << std::endl;
|
||||||
|
if (DEBUG)
|
||||||
|
std::cerr << CLR_MAGENTA << "\tValue of args: [" << argv[check] << "]" << CLR_RESET << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue