]> git.sur5r.net Git - i3/i3status/blobdiff - src/general.c
debian: fix issues with initscript
[i3/i3status] / src / general.c
index 4016ecdbf0902bf26c9859b7cd3e2643e08428ff..8d48f749ddbb9f6232dca6f9e4d7436a7be65b70 100644 (file)
@@ -1,3 +1,4 @@
+// vim:ts=8:expandtab
 #include <sys/types.h>
 #include <string.h>
 #include <stdarg.h>
  * Reads size bytes into the destination buffer from filename.
  *
  */
-void slurp(char *filename, char *destination, int size) {
-       int fd;
+bool slurp(char *filename, char *destination, int size) {
+        int fd;
 
-       if ((fd = open(filename, O_RDONLY)) == -1)
-               die("Could not open \"%s\"\n", filename);
+        if ((fd = open(filename, O_RDONLY)) == -1)
+                return false;
 
-       (void)read(fd, destination, size);
-       (void)close(fd);
+        (void)read(fd, destination, size);
+        (void)close(fd);
+
+        return true;
 }
 
 /*
@@ -63,8 +66,8 @@ void die(const char *fmt, ...) {
  * Otherwise, the buffer size would have to be increased.
  *
  */
-char *concat(const char *str1, const char *str2) {
-        static char concatbuf[32];
-        (void)snprintf(concatbuf, sizeof(concatbuf), "%s%s", str1, str2);
-        return concatbuf;
+char *order_to_str(int number, char *name) {
+        static char buf[32];
+        (void)snprintf(buf, sizeof(buf), "%d%s", number, name);
+        return buf;
 }