14 * Reads size bytes into the destination buffer from filename.
17 bool slurp(const char *filename, char *destination, int size) {
20 if ((fd = open(filename, O_RDONLY)) == -1)
23 /* We need one byte for the trailing 0 byte */
24 int n = read(fd, destination, size-1);
26 destination[n] = '\0';
33 * Skip the given character for exactly 'amount' times, returns
34 * a pointer to the first non-'character' character in 'input'.
37 char *skip_character(char *input, char character, int amount) {
39 size_t len = strlen(input);
42 for (walk = input; ((size_t)(walk - input) < len) && (blanks < amount); walk++)
43 if (*walk == character)
46 return (walk == input ? walk : walk-1);
50 * Write errormessage to statusbar and exit
53 void die(const char *fmt, ...) {
57 (void)vsnprintf(buffer, sizeof(buffer), fmt, ap);
60 fprintf(stderr, "%s", buffer);