2 * declarations common to
15 typedef struct CommandInput CommandInput;
17 /*---------- from obc.c ----------*/
19 typedef struct OutBuffer OutBuffer;
20 typedef struct OutBufferChain OutBufferChain;
21 typedef void OutBufferError(OutBufferChain*, const char *e1, const char *e2
22 /* on error: both e1 and e2 non-0. say `$e1: $e2'
23 * on eof: both e1 and e2 =0. */);
25 struct OutBufferChain {
30 int limit; /* 0 means obc_init will set a default */
31 OutBufferError *error;
32 /* set/used by obc_..., oprintf, etc., only */
33 int done_of_head, total;
34 struct { OutBuffer *head, *tail; } obs;
37 void obc_init(OutBufferChain *ch);
38 void obc_init_core(OutBufferChain *ch); /* doesn't mess with fd */
39 int obc_tryflush(OutBufferChain *ch);
40 /* returns 0 for all flushed or errno, including particularly EWOULDBLOCK */
42 void ovprintf(OutBufferChain *ch, const char *fmt, va_list al)
43 __attribute__((format(printf,2,0)));
44 void oprintf(OutBufferChain *ch, const char *msg, ...)
45 __attribute__((format(printf,2,3)));
46 void owrite(OutBufferChain *ch, const char *data, int l);
47 void voerror(OutBufferChain *ch, const char *fmt, va_list al)
48 __attribute__((format(printf,2,0)));
50 /*---------- from cmdinput.c ----------*/
52 extern oop_source *events;
54 typedef void CommandInputCallback(ParseState *ps, CommandInput *cmdi);
58 CommandInputCallback *doline;
62 void cmdin_new(CommandInput *cmdi, int readfd);
63 /* fill in cmdi->out's `set by user' fields before calling cmdin_new,
64 * as cmdin_new will call obc_init and will use cmdi->out->fd. */