#include "curs_lib.h"
#include "globals.h"
-int MonitorFilesChanged = 0;
-int MonitorContextChanged = 0;
+bool MonitorFilesChanged = false;
+bool MonitorContextChanged = false;
static int INotifyFd = -1;
static struct Monitor *Monitor = NULL;
struct MonitorInfo
{
enum MailboxType magic;
- short isdir;
+ bool is_dir;
const char *path;
dev_t st_dev;
ino_t st_ino;
mutt_poll_fd_remove(INotifyFd);
close(INotifyFd);
INotifyFd = -1;
- MonitorFilesChanged = 0;
+ MonitorFilesChanged = false;
}
}
* 0: no monitor / 1: preexisting monitor
* @retval -3 no mailbox (MonitorInfo: no fields set)
* @retval -2 magic not set
- * @retval -1 stat() failed (see errno; MonitorInfo fields: magic, isdir, path)
+ * @retval -1 stat() failed (see errno; MonitorInfo fields: magic, is_dir, path)
*
* If m is NULL, the current mailbox (Context) is used.
*/
}
else if (info->magic == MUTT_MAILDIR)
{
- info->isdir = 1;
+ info->is_dir = true;
fmt = "%s/new";
}
else
{
- info->isdir = 0;
+ info->is_dir = false;
if (info->magic == MUTT_MH)
fmt = "%s/.mh_sequences";
}
-
if (fmt)
{
if (!info->path_buf)
int rc = 0;
char buf[EVENT_BUFLEN] __attribute__((aligned(__alignof__(struct inotify_event))));
- MonitorFilesChanged = 0;
+ MonitorFilesChanged = false;
if (INotifyFd != -1)
{
}
else if (PollFds[i].fd == INotifyFd)
{
- MonitorFilesChanged = 1;
+ MonitorFilesChanged = true;
mutt_debug(LL_DEBUG3, "file change(s) detected\n");
char *ptr = buf;
const struct inotify_event *event = NULL;
if (event->mask & IN_IGNORED)
monitor_handle_ignore(event->wd);
else if (event->wd == MonitorContextDescriptor)
- MonitorContextChanged = 1;
+ MonitorContextChanged = true;
ptr += sizeof(struct inotify_event) + event->len;
}
}
goto cleanup;
}
- uint32_t mask = info.isdir ? INOTIFY_MASK_DIR : INOTIFY_MASK_FILE;
+ uint32_t mask = info.is_dir ? INOTIFY_MASK_DIR : INOTIFY_MASK_FILE;
if (((INotifyFd == -1) && (monitor_init() == -1)) ||
((desc = inotify_add_watch(INotifyFd, info.path, mask)) == -1))
{
if (!m)
{
MonitorContextDescriptor = -1;
- MonitorContextChanged = 0;
+ MonitorContextChanged = false;
}
if (monitor_resolve(&info, m) != RESOLVE_RES_OK_EXISTING)