From 2fdb53d8c39a6ca4668ec8d5388432ccd9daa168 Mon Sep 17 00:00:00 2001 From: rodri Date: Fri, 16 Jul 2021 20:20:43 +0000 Subject: test.c: there's no roman numeral for the number zero. roman.c: put the NIL at the right offset. --- roman.c | 2 +- test.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/roman.c b/roman.c index 6606e25..d669cc2 100644 --- a/roman.c +++ b/roman.c @@ -52,7 +52,7 @@ dectoroman(int n, char *buf, ulong len) n -= decimal[i]; } } - buf[len-1] = 0; + buf[o] = 0; return 0; } diff --git a/test.c b/test.c index fb71a58..d0532d8 100644 --- a/test.c +++ b/test.c @@ -29,7 +29,7 @@ main(int argc, char *argv[]) if(argc != 0) usage(); - if(decimal >= 0){ + if(decimal > 0){ if(dectoroman(decimal, buf, sizeof buf) < 0) sysfatal("dectoroman: %r"); print("%s\n", buf); -- cgit v1.2.3