ezmlmx 0.68
ezmlmx
Loading...
Searching...
No Matches
auto-str.c
Go to the documentation of this file.
1#include "buffer.h"
2#include "readwrite.h"
3#include "exit.h"
4
5void subputs(const char *s)
6{
7 if (buffer_puts(buffer_1,s) == -1) _exit(111);
8}
9
10int main(int argc, char **argv)
11{
12 char *name;
13 char *value;
14 unsigned char ch;
15 char octal[4];
16
17 name = argv[1];
18 if (!name) _exit(100);
19 value = argv[2];
20 if (!value) _exit(100);
21
22 subputs("const char ");
24 subputs("[] = \"\\\n");
25
26 while (ch = *value++) {
27 subputs("\\");
28 octal[3] = 0;
29 octal[2] = '0' + (ch & 7); ch >>= 3;
30 octal[1] = '0' + (ch & 7); ch >>= 3;
31 octal[0] = '0' + (ch & 7);
32 subputs(octal);
33 }
34
35 subputs("\\\n\";\n");
36 if (buffer_flush(buffer_1) == -1) _exit(111);
37 return 0;
38}
int main()
Definition ezmlm-weed.c:69
stralloc name
Definition ezmlm-split.c:48
void subputs(const char *s)
Definition auto-str.c:5