s/qmail
4.3.20
Next generation secure email transport
Loading...
Searching...
No Matches
4.3
sqmail-4.3.20
src
auto-str.c
Go to the documentation of this file.
1
#include <unistd.h>
2
#include "buffer.h"
3
#include "
exit.h
"
4
5
char
inbuf
[BUFFER_SMALL];
6
buffer
b
= BUFFER_INIT(
write
,1,
inbuf
,
sizeof
(
inbuf
));
7
8
void
out
(
char
*s)
9
{
10
if
(buffer_puts(&
b
,s) == -1)
_exit
(111);
11
}
12
13
int
main
(
int
argc,
char
*
const
*argv)
14
{
15
char
*name;
16
char
*value;
17
unsigned
char
ch;
18
char
octal[4];
19
20
name = argv[1];
21
if
(!name)
_exit
(100);
22
value = argv[2];
23
if
(!value)
_exit
(100);
24
25
out
(
"char "
);
26
out
(name);
27
out
(
"[] = \"\\\n"
);
28
29
while
((ch = *value++)) {
30
out
(
"\\"
);
31
octal[3] = 0;
32
octal[2] =
'0'
+ (ch & 7); ch >>= 3;
33
octal[1] =
'0'
+ (ch & 7); ch >>= 3;
34
octal[0] =
'0'
+ (ch & 7);
35
out
(octal);
36
}
37
38
out
(
"\\\n\";\n"
);
39
if
(buffer_flush(&
b
) == -1)
_exit
(111);
40
_exit
(0);
41
}
b
buffer b
Definition:
auto-str.c:6
inbuf
char inbuf[BUFFER_SMALL]
Definition:
auto-str.c:5
main
int main()
Definition:
chkshsgr.c:6
out
stralloc out
Definition:
dnscname.c:12
exit.h
_exit
void _exit(int)
write
void write()
Generated on Thu Jan 16 2025 17:42:03 for s/qmail by
1.9.6