#ifndef SUIT_MACHINE_H #define SUIT_MACHINE_H #include <stddef.h> // The machine's name: $SUIT_HOME/machine, one name on one line. A machine // without the file has no name. constexpr size_t MACHINE_MAX = 64; // True if the LEN bytes are a name: 1 to MACHINE_MAX of A-Z a-z 0-9 . _ - bool machine_name_ok(const char *s, size_t len); // Read PATH into NAME (room for MACHINE_MAX + 1). A file that is not there // leaves NAME empty. Returns 0, or 1 after saying on stderr what is wrong. int machine_read(const char *path, char *name); // Write NAME (already checked) to PATH atomically. Returns 0, or 1 after // saying why. int machine_write(const char *path, const char *name); #endif