+void priomsg_new(struct priomsg *pm, int32_t maxlen)
+{
+ buffer_new(&pm->m, maxlen);
+ pm->prio = INT_MIN;
+}
+void priomsg_reset(struct priomsg *pm)
+{
+ buffer_init(&pm->m, 0);
+ pm->prio = INT_MIN;
+}
+bool_t priomsg_update_p(struct priomsg *pm, int prio)
+{
+ if (!pm) return False;
+ if (prio <= pm->prio) return False;
+ buffer_init(&pm->m, 0);
+ pm->prio = prio;
+ return True;
+}
+const char *priomsg_getmessage(const struct priomsg *pm, const char *defmsg)
+{
+ if (pm->prio >= INT_MIN)
+ return truncmsg_terminate(&pm->m);
+ else
+ return defmsg;
+}
+
+bool_t priomsg_update_fixed(struct priomsg *pm, int prio, const char *m) {
+ if (!priomsg_update_p(pm, prio)) return False;
+ truncmsg_add_string(&pm->m, m);
+ return True;
+}
+