31 lines
579 B
C
31 lines
579 B
C
#pragma once
|
|
#include <stddef.h>
|
|
|
|
#define LIBSCOMM_MAXARG 32
|
|
#define LIBSCOMM_MAXBUF 1024
|
|
|
|
struct libscomm_line {
|
|
size_t name;
|
|
char *buf[LIBSCOMM_MAXARG];
|
|
size_t len;
|
|
};
|
|
|
|
struct libscomm_input {
|
|
int state;
|
|
|
|
char intbuf[LIBSCOMM_MAXBUF];
|
|
size_t len;
|
|
};
|
|
|
|
enum libscomm_input_r {
|
|
LIBSCOMM_MORE,
|
|
LIBSCOMM_OVERFLOW,
|
|
LIBSCOMM_ARG_OVERFLOW,
|
|
LIBSCOMM_COMPLETE
|
|
};
|
|
|
|
void libscomm_reset(struct libscomm_input *);
|
|
enum libscomm_input_r libscomm_read(struct libscomm_input *,
|
|
char **,
|
|
struct libscomm_line *);
|