/*
* This file is part of DisOrder.
- * Copyright (C) 2004-2008 Richard Kettlewell
+ * Copyright (C) 2004-2009 Richard Kettlewell
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
static void queue_read_error(const char *msg,
void *u) {
- fatal(0, "error parsing queue %s: %s", (const char *)u, msg);
+ disorder_fatal(0, "error parsing queue %s: %s", (const char *)u, msg);
}
static void queue_do_read(struct queue_entry *head, const char *path) {
if(!(fp = fopen(path, "r"))) {
if(errno == ENOENT)
return; /* no queue */
- fatal(errno, "error opening %s", path);
+ disorder_fatal(errno, "error opening %s", path);
}
head->next = head->prev = head;
while(!inputline(path, fp, &buffer, '\n')) {
if(head == &qhead
&& (!q->track
|| !q->when))
- fatal(0, "incomplete queue entry in %s", path);
+ disorder_fatal(0, "incomplete queue entry in %s", path);
queue_insert_entry(head->prev, q);
}
- if(ferror(fp)) fatal(errno, "error reading %s", path);
+ if(ferror(fp))
+ disorder_fatal(errno, "error reading %s", path);
fclose(fp);
}
struct queue_entry *q;
byte_xasprintf(&tmp, "%s.new", path);
- if(!(fp = fopen(tmp, "w"))) fatal(errno, "error opening %s", tmp);
+ if(!(fp = fopen(tmp, "w"))) disorder_fatal(errno, "error opening %s", tmp);
/* Save version indicator */
if(fprintf(fp, "#1\n") < 0)
- fatal(errno, "error writing %s", tmp);
+ disorder_fatal(errno, "error writing %s", tmp);
for(q = head->next; q != head; q = q->next)
if(fprintf(fp, "%s\n", queue_marshall(q)) < 0)
- fatal(errno, "error writing %s", tmp);
- if(fclose(fp) < 0) fatal(errno, "error closing %s", tmp);
- if(rename(tmp, path) < 0) fatal(errno, "error replacing %s", path);
+ disorder_fatal(errno, "error writing %s", tmp);
+ if(fclose(fp) < 0) disorder_fatal(errno, "error closing %s", tmp);
+ if(rename(tmp, path) < 0) disorder_fatal(errno, "error replacing %s", path);
}
void queue_write(void) {