-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsupport_2.c
More file actions
51 lines (42 loc) · 772 Bytes
/
support_2.c
File metadata and controls
51 lines (42 loc) · 772 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
47
48
49
50
51
#include "main.h"
/**
*is_digit - Function that helps find a digit
* @c: input
*
* Return: 1 , else 0
*/
int is_digit(char c)
{
if (c >= '0' && c <= '9')
return (1);
return (0);
}
/**
*is_print - Function that checks if a character is printable.
* @c: input
* Return: 1 , else 0
*/
int is_print(char c)
{
if (c >= 32 && c < 127)
return (1);
return (0);
}
/**
* append_hex - Function that appends ASSCI to buffer
* @buffer: Array
* @index: input
* @code: ASSCI CODE.
* Return: Always 3
*/
int append_hex(char code, char buffer[], int index)
{
char aleph_tab[] = "0123456789ABCDEF";
if (code < 0)
code *= -1;
buffer[index++] = '\\';
buffer[index++] = 'x';
buffer[index++] = aleph_tab[code / 16];
buffer[index] = aleph_tab[code % 16];
return (3);
}