+}
+
+/* Compares strin A to string B. The shorter string is
+ considered to be padded with spaces to the length of the
+ longer. */
+int
+str_compare_rpad (const char *a, const char *b)
+{
+ return buf_compare_rpad (a, strlen (a), b, strlen (b));
+}
+
+/* Copies string SRC to buffer DST, of size DST_SIZE bytes.
+ DST is truncated to DST_SIZE bytes or padded on the right with
+ spaces as needed. */
+void
+buf_copy_str_rpad (char *dst, size_t dst_size, const char *src)
+{
+ size_t src_len = strlen (src);
+ if (src_len >= dst_size)
+ memcpy (dst, src, dst_size);