X-Git-Url: https://git.distorted.org.uk/~mdw/dvdrip/blobdiff_plain/c62cd11a8bcfdacd01498ee08da82b2afa4b2f25..refs/heads/mdw/cleanup:/lib.h diff --git a/lib.h b/lib.h index 2b8eb6b..7c4a0cb 100644 --- a/lib.h +++ b/lib.h @@ -240,6 +240,13 @@ extern void sit(double t); * fractional. */ +extern int read_line(FILE *fp, struct buf *b); + /* Read a line from FP, appending it to the buffer B, leaving the + * string in B null-terminated (as if by `buf_putz'). Return 0 on + * success, or -1 if nothing was read (not even an empty line) before + * we encountered end-of-file or a read error. + */ + extern void carefully_write(int fd, const void *buf, size_t sz); /* Write SZ bytes to file descriptor FD, starting at BUF. Report a * fatal error if this fails. Correctly handles short writes and @@ -294,19 +301,19 @@ extern void hide_banner(void); /*----- DVD utilities -----------------------------------------------------*/ -extern void open_dvd(const char *device, int mode, - int *fd_out, dvd_reader_t **dvd_out); +extern int open_dvd(const char *device, int mode, + int *fd_out, dvd_reader_t **dvd_out); /* Open the DEVICE. If FD_OUT is not null, then open a file * descriptor onto the device, with the given open(2)-style MODE, * storing the descriptor in *FD_OUT; if DVD_OUT is not null, then * open a `libdvdread' handle onto the devie and store it in * *DVD_OUT. If both are null, then why are you calling this - * function? + * function? Returns 0 on success or -1 on failure. * * If DEVICE refers to an actual block device, and no medium is * currently inserted, then put up a banner prompting the user and - * wait for a medium to be inserted. Other problems are reported as - * fatal errors. + * wait for a medium to be inserted. Other problems are reported to + * stderr. */ enum { RAW, IFO, VOB, BUP };