|
Revision 154, 449 bytes
(checked in by malte, 2 years ago)
|
|
|
| Line | |
|---|
| 1 | |
|---|
| 2 | #include "lr_cmd.h" |
|---|
| 3 | |
|---|
| 4 | int lr_cmd(int fd, license_data_type *ld) |
|---|
| 5 | { |
|---|
| 6 | char *buff = calloc(MAX_MSG_SIZE, sizeof(char)); |
|---|
| 7 | |
|---|
| 8 | int res; |
|---|
| 9 | |
|---|
| 10 | for ( ; ; ) { |
|---|
| 11 | memset(buff, '\0', MAX_MSG_SIZE); |
|---|
| 12 | |
|---|
| 13 | if (recv_line(fd, buff, MAX_MSG_SIZE - 1) <= 0) { |
|---|
| 14 | free(buff); |
|---|
| 15 | return (-1); |
|---|
| 16 | } |
|---|
| 17 | |
|---|
| 18 | res = lr_syntax(fd, ld, buff); |
|---|
| 19 | |
|---|
| 20 | if (res == -1) { |
|---|
| 21 | free(buff); |
|---|
| 22 | return (-1); |
|---|
| 23 | } else if (res == 1) |
|---|
| 24 | continue; |
|---|
| 25 | else |
|---|
| 26 | break; |
|---|
| 27 | } |
|---|
| 28 | |
|---|
| 29 | free(buff); |
|---|
| 30 | |
|---|
| 31 | return (NO_ERROR); |
|---|
| 32 | } |
|---|
| 33 | |
|---|