#include "ccan/take/take.h"
#include "ccan/rbuf/rbuf.h"
#include "ccan/tal/path/path.h"
+#include "ccan/tal/grab_file/grab_file.h"
#include "ccan/err/err.h"
+#include "ccan/noerr/noerr.h"
#include "tools.h"
static bool verbose = false;
#define verbose_indent() (indent += 2)
#define verbose_unindent() (indent -= 2)
-static int unlink_no_errno(const char *filename)
-{
- int ret = 0, serrno = errno;
- if (unlink(filename) < 0)
- ret = errno;
- errno = serrno;
- return ret;
-}
-
static char **get_dir(const char *dir)
{
DIR *d;
hdr = tal_fmt(dir, "%s.h",
path_join(NULL, dir, take(path_basename(NULL, dir))));
- contents = tal_grab_file(dir, hdr, NULL);
+ contents = grab_file(dir, hdr);
if (!contents)
err(1, "Reading %s", hdr);
for (r = *repl; r; r = r->next) {
if (write(fd,r->string,strlen(r->string)) != strlen(r->string)
|| write(fd, "\n", 1) != 1) {
- unlink_no_errno(replname);
+ unlink_noerr(replname);
if (errno == 0)
errx(1, "Short write to %s: disk full?",
replname);
int fd;
verbose("Rewriting %s\n", filename);
- file = tal_grab_file(filename, filename, NULL);
+ file = grab_file(filename, filename);
if (!file)
err(1, "Reading file %s", filename);
char *replname = path_join(depdir, depdir, ".namespacize");
char *file, **line;
- file = tal_grab_file(replname, replname, NULL);
+ file = grab_file(replname, replname);
if (!file) {
if (errno != ENOENT)
err(1, "Opening %s", replname);