tfileexists.c - spoon - [fork] customized build of spoon, the dwm status utility
 (HTM) git clone git://src.adamsgaard.dk/spoon
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) LICENSE
       ---
       tfileexists.c (298B)
       ---
            1 #include <stdio.h>
            2 #include <err.h>
            3 #include <fcntl.h>
            4 #include <unistd.h>
            5 
            6 int
            7 fileexists(void *arg, char *buf, size_t len)
            8 {
            9         char *path = arg;
           10         ssize_t n;
           11         int fd;
           12 
           13         fd = open(path, O_RDONLY);
           14         if (fd == -1)
           15                 snprintf(buf, len, "");
           16         else
           17                 snprintf(buf, len, " R |");
           18         close(fd);
           19         return 0;
           20 }