-static void write_to_statusbar(const char *message) {
- int fd = open(wmii_path, O_RDWR);
+static void cleanup_rbar_dir() {
+ struct dirent *ent;
+ DIR *dir;
+ char pathbuf[strlen(wmii_path)+256+1];
+
+ if ((dir = opendir(wmii_path)) == NULL)
+ exit(-3);
+
+ while ((ent = readdir(dir)) != NULL) {
+ if (ent->d_type == DT_REG) {
+ sprintf(pathbuf, "%s%s", wmii_path, ent->d_name);
+ unlink(pathbuf);
+ }
+ }
+
+ closedir(dir);
+}
+
+static void create_file(const char *name) {
+ char pathbuf[strlen(wmii_path)+256+1];
+
+ sprintf(pathbuf, "%s%s", wmii_path, name);
+ int fd = creat(pathbuf, S_IRUSR | S_IWUSR);
+ if (fd < 0)
+ exit(-4);
+ close(fd);
+}
+
+static void write_to_statusbar(const char *name, const char *message) {
+ char pathbuf[strlen(wmii_path)+256+1];
+
+ sprintf(pathbuf, "%s%s", wmii_path, name);
+ int fd = open(pathbuf, O_RDWR);