X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=miniexpect.h;h=192d18028dc8032fb7238c99d561e3f1ead895e8;hb=57eea3e7cc0f214200642fbeb68b6b063243558b;hp=9a374b78ce119d7a671214e353a871982b2d1e91;hpb=5b44176d36a170a846a732a0124d7ee1bffd6504;p=miniexpect.git diff --git a/miniexpect.h b/miniexpect.h index 9a374b7..192d180 100644 --- a/miniexpect.h +++ b/miniexpect.h @@ -41,6 +41,7 @@ struct mexp_h { char *buffer; size_t len; size_t alloc; + ssize_t next_match; size_t read_size; int pcre_error; void *user1; @@ -49,6 +50,19 @@ struct mexp_h { }; typedef struct mexp_h mexp_h; +/* Methods to access (some) fields in the handle. */ +#define mexp_get_fd(h) ((h)->fd) +#define mexp_get_pid(h) ((h)->pid) +#define mexp_get_timeout_ms(h) ((h)->timeout) +#define mexp_set_timeout_ms(h, ms) ((h)->timeout = (ms)) +/* If secs == -1, then this sets h->timeout to -1000, but the main + * code handles this since it only checks for h->timeout < 0. + */ +#define mexp_set_timeout(h, secs) ((h)->timeout = 1000 * (secs)) +#define mexp_get_read_size(h) ((h)->read_size) +#define mexp_set_read_size(h, size) ((h)->read_size = (size)) +#define mexp_get_pcre_error(h) ((h)->pcre_error) + /* Spawn a subprocess. */ extern mexp_h *mexp_spawnv (const char *file, char **argv); extern mexp_h *mexp_spawnl (const char *file, const char *arg, ...);