From 368207e46ca78ec42d77a3b1d3539cf4250617eb Mon Sep 17 00:00:00 2001 From: biouman Date: Tue, 1 May 2001 14:13:28 +0000 Subject: *** empty log message *** --- lib/polynom.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'lib') diff --git a/lib/polynom.c b/lib/polynom.c index dcd0386..ab0ac07 100644 --- a/lib/polynom.c +++ b/lib/polynom.c @@ -274,18 +274,22 @@ char *ply_affichage(polynome poly) int count = 0; buf[0] = '\0'; - while (poly) { - if (poly->degre != 0) { - sprintf(temp, "%s*%s^%u ", rat_to_string(poly->coef), mute, poly->degre); - } else { - sprintf(temp, "%s ", rat_to_string(poly->coef)); + if (!poly) { + sprintf(buf, "%s ", rat_to_string(rat_constr(0,1))); + } else { + while (poly) { + if (poly->degre != 0) { + sprintf(temp, "%s*%s^%u ", rat_to_string(poly->coef), mute, poly->degre); + } else { + sprintf(temp, "%s ", rat_to_string(poly->coef)); + } + count += strlen(temp); + if (count < BUFSIZ) + strcat(buf, temp); + else + exception(2, _("ply_affichage: strcat error, not enough space in buffer")); + poly = poly->suiv; } - count += strlen(temp); - if (count < BUFSIZ) - strcat(buf, temp); - else - exception(2, _("ply_affichage: strcat error, not enough space in buffer")); - poly = poly->suiv; - } + } return buf; } -- cgit v1.2.3