tgrekov-fdf
HIVE fdf May 2024
Loading...
Searching...
No Matches
uint.c
1/* ************************************************************************** */
2/* */
3/* ::: :::::::: */
4/* uint.c :+: :+: :+: */
5/* +:+ +:+ +:+ */
6/* By: tgrekov <tgrekov@student.hive.fi> +#+ +:+ +#+ */
7/* +#+#+#+#+#+ +#+ */
8/* Created: 2023/11/01 06:50:06 by tgrekov #+# #+# */
9/* Updated: 2024/02/11 23:50:31 by tgrekov ### ########.fr */
10/* */
11/* ************************************************************************** */
12
13#include <stdarg.h>
14#include <unistd.h>
15#include "../sequence.h"
16#include "../../utils/utils.h"
17#include "../../utils/internal_types.h"
18
19int process_uint(t_sequence seq, int *fd, int total)
20{
21 (void) total;
22 return (u_put_base(seq.data, "0123456789", *fd));
23}
24
25void pre_uint(va_list args, t_sequence *seq)
26{
27 seq->data = va_arg(args, unsigned int);
28 seq->total_len = u_len_base(seq->data, 10);
29 seq->process = process_uint;
30}
void pre_uint(va_list args, t_sequence *seq)
Preprocess the unsigned integer specifier by retrieving the argument in the appropriate size,...
Definition uint.c:54
int process_uint(t_sequence seq, int *fd, int total)
Processes the unsigned integer specifier by printing the number in base 10.
Definition uint.c:36
int u_len_base(t_ubiggest n, int base)
Determine the length of unsigned number n in base base.
Definition u_len_base.c:29
int u_put_base(t_ubiggest n, char *base, int fd)
Write unsigned number n on descriptor fd in base base.
Definition u_put_base.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
int total_len
Total number of characters after padding.
Definition sequence.h:54