tgrekov-fdf
HIVE fdf May 2024
Loading...
Searching...
No Matches
char.c
1/* ************************************************************************** */
2/* */
3/* ::: :::::::: */
4/* char.c :+: :+: :+: */
5/* +:+ +:+ +:+ */
6/* By: tgrekov <tgrekov@student.hive.fi> +#+ +:+ +#+ */
7/* +#+#+#+#+#+ +#+ */
8/* Created: 2023/11/01 00:22:38 by tgrekov #+# #+# */
9/* Updated: 2024/02/02 03:56:57 by tgrekov ### ########.fr */
10/* */
11/* ************************************************************************** */
12
13#include <stdarg.h>
14#include <unistd.h>
15#include "../sequence.h"
16#include "../../utils/internal_types.h"
17
18int process_char(t_sequence seq, int *fd, int total)
19{
20 (void) total;
21 return (write(*fd, (char *) &seq.data, 1));
22}
23
24void pre_char(va_list args, t_sequence *seq)
25{
26 seq->data = (t_ubiggest) va_arg(args, int);
27 seq->total_len = 1;
28 seq->process = process_char;
29}
void pre_char(va_list args, t_sequence *seq)
Preprocess the character specifier by retrieving the character, setting s_sequence::total_len to 1 an...
Definition char.c:47
int process_char(t_sequence seq, int *fd, int total)
Processes the character specifier by writing a character. (Wow)
Definition char.c:33
unsigned long long t_ubiggest
Convenience typedef for largest unsigned type I need to handle.
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
int total_len
Total number of characters after padding.
Definition sequence.h:54