summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/printf.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/printf.c b/lib/printf.c
index 4c26fe4..4e64d7b 100644
--- a/lib/printf.c
+++ b/lib/printf.c
@@ -100,6 +100,10 @@ vsnprintf(
case 'i':
goto int_conversion;
break;
+ /*custom formatters for jove.*/
+ case 'P':
+ goto path_conversion;
+ break;
}
string_conversion:
{
@@ -132,6 +136,17 @@ int_conversion:
}
stri += advance;
} continue;
+path_conversion:
+ {
+ uint16_t *obj_path = va_arg(ap, uint16_t*);
+ size_t obj_pathlen = va_arg(ap, size_t);
+ for(size_t i = 0; i < obj_pathlen; i++) {
+ uint16_t subdir = obj_path[i];
+ int advance = convert_as_int(str, size, stri, 3, subdir, 10, 1);
+ stri += advance;
+ SPRINTF_PUTC(str, size, stri, '/');
+ }
+ } continue;
}
if(str && stri < size) str[stri] = 0;
return stri;