-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhandle_pointer.c
More file actions
25 lines (24 loc) · 830 Bytes
/
handle_pointer.c
File metadata and controls
25 lines (24 loc) · 830 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <format_specifier.h>
#include <handlers.h>
#include <stdarg.h>
#include <utils.h>
/**
* handle_pointer - Handles the pointer format specifier
* @fs: Pointer to the FormatSpecifier structure
* @args: Pointer to the va_list containing the arguments
* @buf: Buffer where the formatted output will be stored
* @bufsize: Pointer to an integer that keeps track of the current length of the
* buffer
*
* Description: This function retrieves a pointer argument from the va_list and
* formats it as a hexadecimal number, writing it to the buffer.
*/
int handle_pointer(struct FormatSpecifier *fs, va_list *args, char *buf,
int *bufsize)
{
fs->flags &= ~(FLAG_ZERO | FLAG_PLUS | FLAG_SPACE);
fs->precision = -1;
fs->flags |= FLAG_HASH;
fs->length = LEN_L;
return handle_hexadecimal(fs, args, buf, bufsize);
}