-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhelper.c
More file actions
46 lines (45 loc) · 698 Bytes
/
Copy pathhelper.c
File metadata and controls
46 lines (45 loc) · 698 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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include "main.h"
/**
*check_buffer - checks if a buffer is NULL
*@buffer:a pointer to char
*
*
*/
void check_buffer(char *buffer)
{
if (buffer == NULL)
{
_putstring("error buffer");
exit(0);
}
}
/**
*initialisation - initialize the buffer
*@format:the format string
*Return:a pointer to buffer created
*
*/
char *initialisation(const char *format)
{
char *p;
if (format == NULL)
{
_putstring("error format is NULL");
exit(0);
}
p = malloc(sizeof(char));
check_buffer(p);
p[0] = '\0';
return (p);
}
/**
*free_vars - free variables
*@buffer:apointer to char
*@args:va_list argument
*
*/
void free_vars(char *buffer, va_list args)
{
free(buffer);
va_end(args);
}