-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoutput_bigS.c
44 lines (40 loc) · 852 Bytes
/
output_bigS.c
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
#include "main.h"
#include <stdlib.h>
/**
* output_bigS - Non printable character
* @S: arguement
* @s: format
* Return: int
*/
int output_bigS(const char *s, va_list S)
{
unsigned int m = 0;
int counter = 0;
char *Nstr = va_arg(S, char *);
while (*s != 'S')
s++;
if (Nstr == NULL)
Nstr = "(null)";
for (; Nstr[m]; m++)
{
if (Nstr[m] < 32 || Nstr[m] >= 127)
{
/*my_putchar('\\');*/
/*my_putchar('x');*/
/*counter += 2;*/
counter += my_putchar('\\');
counter += my_putchar('x');
counter += my_putchar((Nstr[m] / 16) < 10 ? ('0' +
(Nstr[m] / 16)) : ('A' + (Nstr[m] / 16 - 10)));
counter += my_putchar((Nstr[m] % 16) < 10 ? ('0' +
(Nstr[m] % 16)) : ('A' + (Nstr[m] % 16 - 10)));
/*counter += output_bigSX(Nstr);*/
}
else
{
my_putchar(Nstr[m]);
counter++;
}
}
return (counter);
}