djbdnscurve6 45
djbdnscurve6
Loading...
Searching...
No Matches
auto-str.c
Go to the documentation of this file.
1#include "buffer.h"
2#include "exit.h"
3
4char bspace[256];
5buffer b = BUFFER_INIT(buffer_unixwrite,1,bspace,sizeof(bspace));
6
7int puts(const char *s)
8{
9 if (buffer_puts(&b,s) == -1) _exit(111);
10 return 0;
11}
12
13int main(int argc,char **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 puts("const char ");
26 puts(name);
27 puts("[] = \"\\\n");
28
29 while ((ch = *value++)) {
30 puts("\\");
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 puts(octal);
36 }
37
38 puts("\\\n\";\n");
39 if (buffer_flush(&b) == -1) _exit(111);
40 _exit(0);
41}
char bspace[256]
Definition: auto-str.c:4
buffer b
Definition: auto-str.c:5
int puts(const char *s)
Definition: auto-str.c:7
int main()
Definition: axfrdns.c:323
char name[DNS_NAME6_DOMAIN]
Definition: dnsfilter.c:52