Definition in file input.c.
#include <stdlib.h>
#include <libft.h>
#include "utils/utils.h"
#include "stack/stack.h"
Go to the source code of this file.
|
static int | init_stacks (int argc, char **argv, char ***arg2, t_stack *stack) |
| Split input if it was provided as a single argument, validate input length, and allocate stacks.
|
|
static int | validate_arg (char *arg, int parsed) |
| Check that parsed is identical to the source arg when converted back into a string.
|
|
static int | duplicate_check (t_stack stack, int n) |
| Check if n is already present in the stack .
|
|
static int | parse_args (char **argv, t_stack *stack) |
| Parse and validate input arguments and add them to the first stack.
|
|
int | input (int argc, char **argv, t_stack *stack) |
| Parse and validate program input, initialize stacks and fill the first stack.
|
|
◆ duplicate_check()
static int duplicate_check |
( |
t_stack |
stack, |
|
|
int |
n |
|
) |
| |
|
static |
Check if n
is already present in the stack
.
- Parameters
-
- Return values
-
Definition at line 92 of file input.c.
◆ init_stacks()
static int init_stacks |
( |
int |
argc, |
|
|
char ** |
argv, |
|
|
char *** |
arg2, |
|
|
t_stack * |
stack |
|
) |
| |
|
static |
Split input if it was provided as a single argument, validate input length, and allocate stacks.
- Parameters
-
[in] | argc | |
[in] | argv | |
[out] | arg2 | |
[out] | stack | |
- Return values
-
Definition at line 35 of file input.c.
References arr_len(), and ft_split().
◆ input()
int input |
( |
int |
argc, |
|
|
char ** |
argv, |
|
|
t_stack * |
stack |
|
) |
| |
◆ parse_args()
static int parse_args |
( |
char ** |
argv, |
|
|
t_stack * |
stack |
|
) |
| |
|
static |
◆ validate_arg()
static int validate_arg |
( |
char * |
arg, |
|
|
int |
parsed |
|
) |
| |
|
static |