Skip to content
suit Artifact [41474a8024]
Login

Artifact [41474a8024]

Artifact 41474a80242a31b2fc0524d519eca82889f138b4fa302ecc945088cd3ccc03bc:


#ifndef SUIT_ATTENTION_H
#define SUIT_ATTENTION_H

#include <stddef.h>

// $SUIT_HOME/attention: what needs the user. An item is a line, "KIND NAME"
// or "KIND NAME: what", and the lines indented by two spaces after it, which
// belong to it. The file is written beside, synced and renamed, and is removed
// when it would be empty. Each returns 0, or 1 after saying what failed.

constexpr size_t ATTENTION_FILE_MAX = 131072;

// Take out the items of NAME, of kind KIND (every kind if null). Writes
// nothing when there is none.
int attention_remove(const char *path, const char *kind, const char *name);

// Replace the item KIND NAME with HEADER and DETAILS: lines, each ending in a
// newline, kept under it indented (null for none). Writes nothing when the
// file would not change.
int attention_add(const char *path, const char *kind, const char *name, const char *header, const char *details);

// Print "needs you:" and the file's lines, or nothing when there are none.
int attention_print(const char *path);

// How many items the file holds: its lines that are not indented. 0 in *COUNT
// when it is not there. Returns 0, or 1 after saying what failed.
int attention_count(const char *path, unsigned *count);

#endif