minishell
ft_printf.c File Reference
#include <unistd.h>
#include <stdlib.h>
#include "ft_printf.h"
#include "ft_printf_local.h"
Include dependency graph for ft_printf.c:

Go to the source code of this file.

Functions

int ft_printf (const char *format,...)
 
int ft_dprintf (int fd, const char *format,...)
 
int ft_vprintf (const char *format, va_list *args)
 
int ft_vdprintf (int fd, const char *format, va_list *args)
 

Function Documentation

◆ ft_dprintf()

int ft_dprintf ( int  fd,
const char *  format,
  ... 
)

Definition at line 29 of file ft_printf.c.

30 {
31  va_list args;
32  int written_count;
33 
34  va_start(args, format);
35  written_count = ft_vdprintf(fd, format, &args);
36  va_end(args);
37  return (written_count);
38 }
int ft_vdprintf(int fd, const char *format, va_list *args)
Definition: ft_printf.c:45
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ft_printf()

int ft_printf ( const char *  format,
  ... 
)

Definition at line 18 of file ft_printf.c.

19 {
20  va_list args;
21  int written_count;
22 
23  va_start(args, format);
24  written_count = ft_vprintf(format, &args);
25  va_end(args);
26  return (written_count);
27 }
int ft_vprintf(const char *format, va_list *args)
Definition: ft_printf.c:40
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ft_vdprintf()

int ft_vdprintf ( int  fd,
const char *  format,
va_list *  args 
)

Definition at line 45 of file ft_printf.c.

46 {
47  t_list *list;
48  int written_count;
49 
50  if (*format == '\0')
51  return (0);
52  else if (format[0] != '%' && format[1] == '\0')
53  return (write(fd, format, 1));
54  list = parse_format(format, args);
55  if (list == NULL)
56  return (-1);
57  written_count = print_all(fd, list);
58  ft_lstclear(&list, free);
59  return (written_count);
60 }
void ft_lstclear(t_list **lst, void(*del)(void *))
Definition: ft_lstclear.c:16
int print_all(int fd, t_list *list)
Definition: print_all.c:106
t_list * parse_format(const char *fmt, va_list *args)
Definition: parse_format.c:18
Definition: ft_lst.h:18
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ft_vprintf()

int ft_vprintf ( const char *  format,
va_list *  args 
)

Definition at line 40 of file ft_printf.c.

41 {
42  return (ft_vdprintf(STDOUT_FILENO, format, args));
43 }
Here is the call graph for this function:
Here is the caller graph for this function: