case TABLE_PATH_BASENAME:
case TABLE_FIELD:
case TABLE_HEADER:
+ case TABLE_VERSION:
return strlen(data) + 1;
case TABLE_STRV:
int r;
assert(t);
- assert(IN_SET(dt, TABLE_STRING, TABLE_PATH, TABLE_PATH_BASENAME, TABLE_FIELD, TABLE_HEADER));
+ assert(IN_SET(dt, TABLE_STRING, TABLE_PATH, TABLE_PATH_BASENAME, TABLE_FIELD, TABLE_HEADER, TABLE_VERSION));
va_start(ap, format);
r = vasprintf(&buffer, format, ap);
case TABLE_PATH_BASENAME:
case TABLE_FIELD:
case TABLE_HEADER:
+ case TABLE_VERSION:
data = va_arg(ap, const char *);
break;
case TABLE_PATH_BASENAME:
return path_compare(a->string, b->string);
+ case TABLE_VERSION:
+ return strverscmp_improved(a->string, b->string);
+
case TABLE_STRV:
case TABLE_STRV_WRAPPED:
return strv_compare(a->strv, b->strv);
case TABLE_PATH:
case TABLE_PATH_BASENAME:
case TABLE_FIELD:
- case TABLE_HEADER: {
+ case TABLE_HEADER:
+ case TABLE_VERSION: {
_cleanup_free_ char *bn = NULL;
const char *s;
case TABLE_PATH_BASENAME:
case TABLE_FIELD:
case TABLE_HEADER:
+ case TABLE_VERSION:
return sd_json_variant_new_string(ret, d->string);
case TABLE_STRV:
TABLE_STRV_WRAPPED,
TABLE_PATH,
TABLE_PATH_BASENAME, /* like TABLE_PATH, but display only last path element (i.e. the "basename") in regular output */
+ TABLE_VERSION, /* just like TABLE_STRING, but uses version comparison when sorting */
TABLE_BOOLEAN,
TABLE_BOOLEAN_CHECKMARK,
TABLE_TIMESTAMP,