tgrekov-ft_printf
HIVE printf Feb 2024
Loading...
Searching...
No Matches
set_fd.c
Go to the documentation of this file.
1/* ************************************************************************** */
2/* */
3/* ::: :::::::: */
4/* set_fd.c :+: :+: :+: */
5/* +:+ +:+ +:+ */
6/* By: tgrekov <tgrekov@student.hive.fi> +#+ +:+ +#+ */
7/* +#+#+#+#+#+ +#+ */
8/* Created: 2023/12/16 17:58:03 by tgrekov #+# #+# */
9/* Updated: 2024/02/13 07:56:48 by tgrekov ### ########.fr */
10/* */
11/* ************************************************************************** */
12
20#include <stdarg.h>
21#include <unistd.h>
22#include "../sequence.h"
23#include "../../utils/internal_types.h"
24
34static int process_set_fd(t_sequence seq, int *fd, int total)
35{
36 (void) total;
37 *fd = (int) seq.data;
38 return (0);
39}
40
49void pre_set_fd(va_list args, t_sequence *seq)
50{
51 seq->data = (t_ubiggest) va_arg(args, int);
52 seq->subspec.min_width = 0;
54}
unsigned long long t_ubiggest
Convenience typedef for largest unsigned type I need to handle.
static int process_set_fd(t_sequence seq, int *fd, int total)
Processes the set file descriptor specifier by setting the file descriptor. (Phenomenal design)
Definition set_fd.c:34
void pre_set_fd(va_list args, t_sequence *seq)
Preprocess the set file descriptor specifier by retrieving the argument, ensuring that s_subspec::min...
Definition set_fd.c:49
Holds information regarding the current format specifier sequence.
Definition sequence.h:49
int(* process)(struct s_sequence, int *, int)
Function to use for processing this sequence's value.
Definition sequence.h:56
t_ubiggest data
Retrieved variable argument.
Definition sequence.h:53
t_subspec subspec
Holds subspecifier options for a format specifier.
Definition sequence.h:51
int min_width
Minimum number of characters to be printed.
Definition subspec.h:70