Skip to content
suit Artifact [a942dba552]
Login

Artifact [a942dba552]

Artifact a942dba55222f5f73f33e05a37776e9eac0871719102d3386523a7ec0ff601db:


#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);

#endif