aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrodri <rgl@antares-labs.eu>2021-07-16 20:20:43 +0000
committerrodri <rgl@antares-labs.eu>2021-07-16 20:20:43 +0000
commit2fdb53d8c39a6ca4668ec8d5388432ccd9daa168 (patch)
treea95570659c3be6ff88ff0e980635f5fb58f1387d
parentc59a4f460b30f2ff5a2dd47672d72f47c02d8b75 (diff)
downloadlibroman-front.tar.gz
libroman-front.tar.bz2
libroman-front.zip
test.c: there's no roman numeral for the number zero.HEADfront
roman.c: put the NIL at the right offset.
-rw-r--r--roman.c2
-rw-r--r--test.c2
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);