diff options
author | norly <ny-git@enpas.org> | 2013-02-15 01:19:41 +0000 |
---|---|---|
committer | norly <ny-git@enpas.org> | 2013-02-15 01:30:22 +0000 |
commit | 430ce2a8749eb90ca0f8cdf18f5b217128c43e79 (patch) | |
tree | 8c838780bda4c7ebf4f778ca307f01b2d39bdfbe /statuses/tools.c | |
parent | 2ddbfa53a31360e50565345a1ac08c0799c8243e (diff) |
Better file structure and build system
Also fix some warnings
Diffstat (limited to 'statuses/tools.c')
-rw-r--r-- | statuses/tools.c | 60 |
1 files changed, 0 insertions, 60 deletions
diff --git a/statuses/tools.c b/statuses/tools.c deleted file mode 100644 index abb8a0d..0000000 --- a/statuses/tools.c +++ /dev/null @@ -1,60 +0,0 @@ -#include <stdio.h> -#include <fcntl.h> -#include <unistd.h> -#include "tools.h" - -char powerToChar(int power) -{ - switch(power) - { - case 0: - return 'b'; - case 1: - return 'k'; - case 2: - return 'M'; - case 3: - return 'G'; - case 4: - return 'T'; - case 5: - return 'P'; - case 6: - return 'E'; - } - - return '?'; -} - - -void statusError(char *where, char *what, char *extra) -{ - fprintf(stderr, "%s: %s", where, what); - if (extra) { - fprintf(stderr, " -- %s", extra); - } - fputs("\n", stderr); -} - - -ssize_t fileRead(char *buf, size_t bufsize, char *file) -{ - int fd; - int readbytes; - - fd = open(file, 0); - if (fd < 0) { - return -1; - } - - readbytes = read(fd, buf, bufsize - 1); - close(fd); - - if (readbytes > 0) { - buf[readbytes] = '\0'; - } else { - buf[0] = '\0'; - } - - return readbytes; -} |