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