basic struct for loop run
This commit is contained in:
@@ -10,6 +10,9 @@
|
|||||||
#include <errno.h> // for errno
|
#include <errno.h> // for errno
|
||||||
#include <string.h> // for strerror
|
#include <string.h> // for strerror
|
||||||
|
|
||||||
|
#include <sys/wait.h>
|
||||||
|
#include <termios.h> // For tcflush() and TCIFLUSH
|
||||||
|
|
||||||
/** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
* COMPUTORV1.C
|
* COMPUTORV1.C
|
||||||
*/
|
*/
|
||||||
@@ -18,6 +21,7 @@ typedef enum
|
|||||||
{
|
{
|
||||||
MODE_ARGV, //
|
MODE_ARGV, //
|
||||||
MODE_STDIN, //
|
MODE_STDIN, //
|
||||||
|
MODE_LOOP, //
|
||||||
} e_program_mode;
|
} e_program_mode;
|
||||||
|
|
||||||
/** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
@@ -99,7 +103,7 @@ void reduce(s_term *terms, double *polynom);
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
void print_state();
|
void print_state();
|
||||||
int stop_errors(const char *format, ...);
|
void stop_errors(const char *format, ...);
|
||||||
|
|
||||||
/** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
* UTILS/PRINT_ENUMS.C
|
* UTILS/PRINT_ENUMS.C
|
||||||
|
|||||||
@@ -230,6 +230,13 @@ static void launch_stdin()
|
|||||||
free(line);
|
free(line);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void launch_stdin_loop()
|
||||||
|
{
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int main(int ac, char **av)
|
int main(int ac, char **av)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@@ -260,6 +267,7 @@ int main(int ac, char **av)
|
|||||||
else if ((ft_strcmp(av[i], "-l") == 0))
|
else if ((ft_strcmp(av[i], "-l") == 0))
|
||||||
{
|
{
|
||||||
flag_loop_mode = true;
|
flag_loop_mode = true;
|
||||||
|
program_mode = MODE_LOOP;
|
||||||
}
|
}
|
||||||
else if (ft_strlen(av[i]) == 2 && av[i][0] == '-')
|
else if (ft_strlen(av[i]) == 2 && av[i][0] == '-')
|
||||||
{
|
{
|
||||||
@@ -287,6 +295,10 @@ int main(int ac, char **av)
|
|||||||
{
|
{
|
||||||
launch_stdin();
|
launch_stdin();
|
||||||
}
|
}
|
||||||
|
else if (program_mode == MODE_LOOP)
|
||||||
|
{
|
||||||
|
launch_stdin_loop();
|
||||||
|
}
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ void print_state()
|
|||||||
print_context_polynom();
|
print_context_polynom();
|
||||||
}
|
}
|
||||||
|
|
||||||
int stop_errors(const char *description, ...)
|
void stop_errors(const char *description, ...)
|
||||||
{
|
{
|
||||||
// print context (if debug mode)
|
// print context (if debug mode)
|
||||||
print_state();
|
print_state();
|
||||||
|
|||||||
Reference in New Issue
Block a user