X-Git-Url: http://git.thejh.net/?p=tools.git;a=blobdiff_plain;f=math%2Fround.c;h=f87d3c109841cb9e87248f5761cb78282e8fb208;hp=e422fd0ce216147856f5ed2ddc3ee4871e1f85c2;hb=56b86248a393e3dd5073189ca50cb262046839ac;hpb=7ebc44a8d838298394178687975cf9d2994ff8be diff --git a/math/round.c b/math/round.c index e422fd0..f87d3c1 100644 --- a/math/round.c +++ b/math/round.c @@ -6,6 +6,8 @@ int main(int argc, char **argv) { double target = strtod(argv[1], NULL); char line[128]; while (fgets(line, sizeof(line), stdin)) { + trim_end(line, "\r\n \t"); + if (!*line) continue; double n = strtod(line, NULL); double quot = n / target; quot = round(quot);