# HG changeset patch # User jwe # Date 949487465 0 # Node ID ee1eea24f078af97a189866f27b76b93ce8da48d # Parent b80bbb43a1a951eb9eb8591a38a36826316227f2 [project @ 2000-02-02 10:31:05 by jwe] diff --git a/liboctave/oct-rl-hist.c b/liboctave/oct-rl-hist.c --- a/liboctave/oct-rl-hist.c +++ b/liboctave/oct-rl-hist.c @@ -206,16 +206,14 @@ k = 0; for (i = beg; i < end; i++) { - char *tmp = 0; - char buf[64]; + char *line = hlist[i]->line; + int len = line ? strlen (line) : 0; + char *tmp = malloc (len + 64); if (number_lines) - sprintf (buf, "%5d%c", i + history_base, - hlist[i]->data ? '*' : ' '); - - tmp = malloc (strlen (buf) + 1); - - strcpy (tmp, buf); + sprintf (tmp, "%5d%c%s", i + history_base, + hlist[i]->data ? '*' : ' ' + line ? line : ""); retval[k++] = tmp; }