minishell
parse_opt_ptr.c File Reference
Include dependency graph for parse_opt_ptr.c:

Go to the source code of this file.

Functions

bool parse_opt_ptr (char fmt, va_list *args, t_fmt *p_ret)
 

Function Documentation

◆ parse_opt_ptr()

bool parse_opt_ptr ( char  fmt,
va_list *  args,
t_fmt p_ret 
)

Definition at line 16 of file parse_opt_ptr.c.

17 {
18  size_t num;
19 
20  if (fmt != 'p')
21  return (false);
22  p_ret->type = PTR;
23  num = (size_t)va_arg(*args, void *);
24  p_ret->header[0] = '0';
25  p_ret->header[1] = 'x';
26  p_ret->head_len = 2;
27  if (num == 0)
28  {
29  p_ret->str_len = 1;
30  p_ret->data.c = '0';
31  }
32  else
33  p_ret->str_len = get_numstr_base(p_ret->data.str_buf, num, 16, false);
34  return (true);
35 }
@ PTR
int get_numstr_base(char *buf, size_t num, int base, bool is_upper)
t_dtype type
t_data data
int str_len
t_uint8 head_len
char header[3]
char str_buf[STR_BUF_LEN]
Here is the call graph for this function:
Here is the caller graph for this function: