Pass in output function to lbuf_init() instead of writing to stdout.

A side effect is that the usage info can now go to stderr as it should.
This commit is contained in:
Todd C. Miller
2010-03-18 06:42:17 -04:00
parent 038ec569de
commit b4f4afdf69
8 changed files with 50 additions and 23 deletions

View File

@@ -23,18 +23,19 @@
* Line buffer struct.
*/
struct lbuf {
int (*output)(const char *);
char *buf;
int continuation;
const char *continuation;
int indent;
int len;
int size;
int cols;
};
void lbuf_init (struct lbuf *, char *, int, int, int);
void lbuf_destroy (struct lbuf *);
void lbuf_append (struct lbuf *, ...);
void lbuf_append_quoted (struct lbuf *, const char *, ...);
void lbuf_print (struct lbuf *);
void lbuf_init(struct lbuf *, int (*)(const char *), int, const char *, int);
void lbuf_destroy(struct lbuf *);
void lbuf_append(struct lbuf *, ...);
void lbuf_append_quoted(struct lbuf *, const char *, ...);
void lbuf_print(struct lbuf *);
#endif /* _SUDO_LBUF_H */