|
Revision 5674, 0.7 KB
(checked in by blogic, 3 years ago)
|
|
add command line options, integrate lucic, add unix socket
|
| Line | |
|---|
| 1 | #include <stdio.h> |
|---|
| 2 | #include <string.h> |
|---|
| 3 | #include <stdlib.h> |
|---|
| 4 | #include <stdarg.h> |
|---|
| 5 | #include <sys/types.h> |
|---|
| 6 | #include <sys/stat.h> |
|---|
| 7 | #include <unistd.h> |
|---|
| 8 | #include <fcntl.h> |
|---|
| 9 | |
|---|
| 10 | #include "lucip.h" |
|---|
| 11 | #include "lucic.h" |
|---|
| 12 | |
|---|
| 13 | static bool |
|---|
| 14 | buffer_grow(struct blob_buf *buf, int minlen) |
|---|
| 15 | { |
|---|
| 16 | buf->buflen += ((minlen / 256) + 1) * 256; |
|---|
| 17 | buf->buf = realloc(buf->buf, buf->buflen); |
|---|
| 18 | return !!buf->buf; |
|---|
| 19 | } |
|---|
| 20 | |
|---|
| 21 | static struct blob_buf bbuf = { |
|---|
| 22 | .grow = buffer_grow |
|---|
| 23 | }; |
|---|
| 24 | |
|---|
| 25 | int lucic_main(const char *in, const char *out) |
|---|
| 26 | { |
|---|
| 27 | if(!lucip_load(in, &bbuf)) |
|---|
| 28 | { |
|---|
| 29 | printf("Ok!\n"); |
|---|
| 30 | if(out) |
|---|
| 31 | lucip_blob_dump(out, &bbuf); |
|---|
| 32 | else |
|---|
| 33 | printf("use -o to save luco file\n"); |
|---|
| 34 | } else { |
|---|
| 35 | printf("error opening/compiling %s\n", in); |
|---|
| 36 | return 1; |
|---|
| 37 | } |
|---|
| 38 | return 0; |
|---|
| 39 | } |
|---|