Skip to content

Commit 715dd41

Browse files
author
Noam Preil
committed
plan9: support %r format to read errstr
1 parent 1971d7d commit 715dd41

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/core/pp.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -794,9 +794,7 @@ static const char *get_fmt_mapping(char c) {
794794
if (format_mappings[i].c == c)
795795
return format_mappings[i].mapping;
796796
}
797-
#ifndef JANET_PLAN9
798797
janet_assert(0, "bad format mapping");
799-
#endif
800798
}
801799

802800
static const char *scanformat(
@@ -1025,10 +1023,19 @@ void janet_buffer_format(
10251023
char form[MAX_FORMAT], item[MAX_ITEM];
10261024
char width[3], precision[3];
10271025
int nb = 0; /* number of bytes in added item */
1026+
#ifdef JANET_PLAN9
1027+
if(*strfrmt == 'r'){
1028+
rerrstr(item, MAX_ITEM);
1029+
nb = strlen(item);
1030+
} else
1031+
#endif
10281032
if (++arg >= argc)
10291033
janet_panic("not enough values for format");
10301034
strfrmt = scanformat(strfrmt, form, width, precision);
10311035
switch (*strfrmt++) {
1036+
#ifdef JANET_PLAN9
1037+
case 'r': break;
1038+
#endif
10321039
case 'c': {
10331040
nb = snprintf(item, MAX_ITEM, form, (int)
10341041
janet_getinteger(argv, arg));

0 commit comments

Comments
 (0)