summaryrefslogtreecommitdiff
path: root/lib/std/fmt.myr
diff options
context:
space:
mode:
Diffstat (limited to 'lib/std/fmt.myr')
-rw-r--r--lib/std/fmt.myr5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/std/fmt.myr b/lib/std/fmt.myr
index 540d6d8..51dc36e 100644
--- a/lib/std/fmt.myr
+++ b/lib/std/fmt.myr
@@ -454,10 +454,14 @@ const fltparams = {params
fp = [
.mode = MNormal,
.prec = 0,
+ .padfill = ' ',
+ .padto = 0,
]
for p : params
match p
+ | ("w", wid): fp.padto = getint(wid, "fmt: width must be integer")
+ | ("p", pad): fp.padfill = decode(pad)
| (opt, arg):
std.write(2, "fmt: ")
std.write(2, opt)
@@ -466,6 +470,7 @@ const fltparams = {params
std.die("\nunreachable\n")
;;
;;
+ iassert(fp.padto >= 0, "pad must be >= 0")
-> fp
}