minishell
parse_opt_flags.c File Reference
#include <limits.h>
#include "ft_printf_local.h"
#include "../ft_is/ft_is.h"
#include "../ft_string/ft_string.h"
Include dependency graph for parse_opt_flags.c:

Go to the source code of this file.

Functions

static void parse_opt_flag_dot (char **fmt, t_fmt *p_ret)
 
static void parse_opt_flag_min_len (char **fmt, t_fmt *p_ret)
 
void parse_opt_flags (char **fmt, t_fmt *p_ret)
 

Function Documentation

◆ parse_opt_flag_dot()

static void parse_opt_flag_dot ( char **  fmt,
t_fmt p_ret 
)
static

Definition at line 18 of file parse_opt_flags.c.

19 {
20  long tmp;
21 
22  *fmt += 1;
23  p_ret->f_dot = true;
24  p_ret->max_len = 0;
25  if (!ft_isdigit(**fmt))
26  return ;
27  tmp = ft_strtol(*fmt, fmt, 10);
28  if (tmp > (long)INT_MAX)
29  p_ret->max_len = INT_MAX;
30  else
31  p_ret->max_len = tmp;
32 }
int ft_isdigit(int c)
Definition: ft_isdigit.c:15
long ft_strtol(const char *str, char **endptr, int base)
Definition: ft_strtol.c:69
int max_len
bool f_dot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ parse_opt_flag_min_len()

static void parse_opt_flag_min_len ( char **  fmt,
t_fmt p_ret 
)
static

Definition at line 34 of file parse_opt_flags.c.

35 {
36  long tmp;
37 
38  tmp = ft_strtol(*fmt, fmt, 10);
39  if (tmp > (long)INT_MAX)
40  p_ret->min_len = INT_MAX;
41  else
42  p_ret->min_len = tmp;
43 }
int min_len
Here is the call graph for this function:
Here is the caller graph for this function:

◆ parse_opt_flags()

void parse_opt_flags ( char **  fmt,
t_fmt p_ret 
)

Definition at line 45 of file parse_opt_flags.c.

46 {
47  if (**fmt == '-')
48  p_ret->f_minus = true;
49  else if (**fmt == '0')
50  p_ret->f_zero = true;
51  else if (**fmt == '.')
52  {
53  parse_opt_flag_dot(fmt, p_ret);
54  return ;
55  }
56  else if (**fmt == '#')
57  p_ret->f_hash = true;
58  else if (**fmt == ' ')
59  p_ret->f_space = true;
60  else if (**fmt == '+')
61  p_ret->f_plus = true;
62  else
63  {
64  parse_opt_flag_min_len(fmt, p_ret);
65  return ;
66  }
67  *fmt += 1;
68 }
static void parse_opt_flag_dot(char **fmt, t_fmt *p_ret)
static void parse_opt_flag_min_len(char **fmt, t_fmt *p_ret)
bool f_minus
bool f_plus
bool f_zero
bool f_space
bool f_hash
Here is the call graph for this function:
Here is the caller graph for this function: