summaryrefslogtreecommitdiffabout
path: root/capture.h
blob: cad375d18ed05d3d1cce5b2f444283c7fd555e41 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"

#include "ppport.h"

#include <stdlib.h>
#include <runcap/runcap.h>

struct line_closure
{
	char *str;
	size_t len;
	size_t size;
	SV *cv;
};

struct capture {
	struct runcap rc;
	int flags;
	struct line_closure closure[2];
	SV *program;
	SV *input;
};

typedef struct capture *POSIX__Run__Capture;
typedef char** ARGV;

ARGV XS_unpack_ARGV(SV *sv);
void XS_pack_ARGV(SV *const sv, ARGV argv);

struct capture *capture_new(SV *pn, ARGV argv, unsigned timeout, SV *cb[2], SV *input);
void capture_DESTROY(struct capture *rc);
char *capture_next_line(struct capture *rc, int fd);
int capture_run(struct capture *cp);
void capture_set_argv_ref(struct capture *cp, ARGV av);
void capture_set_input(struct capture *cp, SV *inp);

Return to:

Send suggestions and report system problems to the System administrator.