Skip to content

Commit 2fb828d

Browse files
committed
lib/format.c: implement tostrmode()
1 parent ca3a7fd commit 2fb828d

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

lib/format.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ nexttok(const char **pos, struct strbuf *buf)
183183
}
184184

185185
struct conversion {
186-
enum { HUMANIZE = 1, STRMODE } type;
186+
enum { HUMANIZE = 1, STRMODE = 2 } type;
187187
union {
188188
struct humanize {
189189
unsigned width : 8;
@@ -571,9 +571,13 @@ humanize(const struct xbps_fmt_spec *spec, int64_t d, FILE *fp)
571571
}
572572

573573
static int
574-
tostrmode(const struct xbps_fmt_spec *spec UNUSED, int64_t d UNUSED, FILE *fp UNUSED)
574+
tostrmode(const struct xbps_fmt_spec *spec, int64_t d, FILE *fp)
575575
{
576-
return -ENOTSUP;
576+
char buf[64];
577+
int len;
578+
xbps_strmode(d, buf);
579+
len = strlen(buf);
580+
return xbps_fmt_string(spec, buf, len, fp);
577581
}
578582

579583
int

0 commit comments

Comments
 (0)