I just came across the copy-file module, which does exactly what I want (it is even geared to making backup files), but (unfortunately for use in an interactive program) exits on error.
I was just wondering what the rationale for this is, rather than returning an error code. Even in a non-interactive program, this breaks the usual convention that I/O operations return error codes rather than exiting on failure. The one advantage I see of the current approach is the detailed error messages (which in any case I'd like, for interactive use, to suppress). For my purposes, a version in which each call of error instead returned -1 would be fine; is there some gnulib convention that naturally supports this sort of dual? Or any other suggestions on how I go about adding it? -- http://rrt.sc3d.org