X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Foutput%2Fpostscript.c;h=5d0d577607687132fb95cf7c5f2db8a23341d215;hb=ebf3b993687a25782fe72f45bf3e72aa4bee7c95;hp=e6ce8614825b6554adae61b6ea5478ce642e08b3;hpb=cb05567731adc7c890d3146102ff01068ba796dd;p=pspp-builds.git diff --git a/src/output/postscript.c b/src/output/postscript.c index e6ce8614..5d0d5776 100644 --- a/src/output/postscript.c +++ b/src/output/postscript.c @@ -1406,7 +1406,7 @@ postopen (struct file_ext *f) while (-1 != getline (&buf, &buf_size, prologue_file)) { char *cp; - char *buf2; + int len; cp = strstr (buf, "!eps"); @@ -1436,18 +1436,16 @@ postopen (struct file_ext *f) output_encodings (this); else { - char *beg; - beg = buf2 = fn_interp_vars (buf, ps_get_var); - len = strlen (buf2); - while (isspace ((unsigned char) *beg)) - beg++, len--; - if (beg[len - 1] == '\n') - len--; - if (beg[len - 1] == '\r') - len--; - fwrite (beg, len, 1, f->file); + struct string line; + ds_create(&line, buf); + fn_interp_vars(&line, ps_get_var); + ds_ltrim_spaces(&line); + len = ds_length(&line); + fwrite (ds_c_str(&line), len, 1, f->file); + + ds_destroy(&line); + fputs (x->eol, f->file); - free (buf2); } } if (ferror (f->file))