libscomp/input.h

31 lines
579 B
C
Raw Normal View History

2021-07-10 15:10:00 -04:00
#pragma once
#include <stddef.h>
2021-08-09 13:52:52 -04:00
#define LIBSCOMP_MAXARG 32
#define LIBSCOMP_MAXBUF 1024
2021-07-10 15:10:00 -04:00
2021-08-09 13:52:52 -04:00
struct libscomp_line {
2021-07-10 15:10:00 -04:00
size_t name;
2021-08-09 13:52:52 -04:00
char *buf[LIBSCOMP_MAXARG];
2021-07-10 15:10:00 -04:00
size_t len;
};
2021-08-09 13:52:52 -04:00
struct libscomp_input {
2021-07-10 15:10:00 -04:00
int state;
2021-08-09 13:52:52 -04:00
char intbuf[LIBSCOMP_MAXBUF];
2021-07-10 15:10:00 -04:00
size_t len;
};
2021-08-09 13:52:52 -04:00
enum libscomp_input_r {
LIBSCOMP_MORE,
LIBSCOMP_OVERFLOW,
LIBSCOMP_ARG_OVERFLOW,
LIBSCOMP_COMPLETE
2021-07-10 15:10:00 -04:00
};
2021-08-09 13:52:52 -04:00
void libscomp_reset(struct libscomp_input *);
enum libscomp_input_r libscomp_read(struct libscomp_input *,
char **,
2021-08-09 13:52:52 -04:00
struct libscomp_line *);