ucspi-ssl
0.13.03
ucspi-ssl
Loading...
Searching...
No Matches
ucspi-ssl-0.13.03
src
auto-str.c
Go to the documentation of this file.
1
/* what to do */
2
#include "readwrite.h"
3
#include "
exit.h
"
4
#include "buffer.h"
5
6
char
bspace
[BUFFER_SMALL];
7
buffer
b
= BUFFER_INIT(buffer_unixwrite,1,
bspace
,
sizeof
(
bspace
));
8
9
static
void
outs(
const
char
*s)
10
{
11
if
(buffer_puts(&
b
,s) == -1)
_exit
(111);
12
}
13
14
int
main
(
int
argc,
char
**argv)
15
{
16
char
*name;
17
char
*value;
18
unsigned
char
ch;
19
char
octal[4];
20
21
name = argv[1];
22
if
(!name)
_exit
(100);
23
value = argv[2];
24
if
(!value)
_exit
(100);
25
26
outs(
"const char "
);
27
outs(name);
28
outs(
"[] = \"\\\n"
);
29
30
while
((ch = *value++)) {
31
outs(
"\\"
);
32
octal[3] = 0;
33
octal[2] =
'0'
+ (ch & 7); ch >>= 3;
34
octal[1] =
'0'
+ (ch & 7); ch >>= 3;
35
octal[0] =
'0'
+ (ch & 7);
36
outs(octal);
37
}
38
39
outs(
"\\\n\";\n"
);
40
if
(buffer_flush(&
b
) == -1)
_exit
(111);
41
_exit
(0);
42
}
b
buffer b
Definition:
auto-str.c:7
bspace
char bspace[BUFFER_SMALL]
Definition:
auto-str.c:6
main
int main()
Definition:
chkshsgr.c:7
exit.h
_exit
void _exit()
Generated on Mon Sep 23 2024 11:30:08 for ucspi-ssl by
1.9.6