X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=src%2Foutput%2Fpostscript.c;h=5d0d577607687132fb95cf7c5f2db8a23341d215;hb=ebf3b993687a25782fe72f45bf3e72aa4bee7c95;hp=fbe8f6426c9815f7b9a7d931165b9bec750bac63;hpb=dcf9b154cbcaa35c3d8459a201b77eec8bcb30bd;p=pspp-builds.git diff --git a/src/output/postscript.c b/src/output/postscript.c index fbe8f642..5d0d5776 100644 --- a/src/output/postscript.c +++ b/src/output/postscript.c @@ -19,12 +19,9 @@ #include -/*this #if encloses the remainder of the file. */ -#if !NO_POSTSCRIPT - #include #include "chart.h" -#include "message.h" +#include #include #include #include @@ -34,18 +31,20 @@ #include #endif -#include "alloc.h" -#include "bit-vector.h" -#include "message.h" -#include "filename.h" +#include +#include +#include +#include +#include #include "font.h" #include "getline.h" -#include "hash.h" -#include "misc.h" +#include +#include "intprops.h" +#include #include "output.h" #include "manager.h" -#include "start-date.h" -#include "version.h" +#include +#include #include "gettext.h" #define _(msgid) gettext (msgid) @@ -1190,20 +1189,20 @@ postopen (struct file_ext *f) {"title", 0}, {0, 0}, }; - char boundbox[INT_DIGITS * 4 + 4]; + char boundbox[INT_STRLEN_BOUND (int) * 4 + 4]; #if HAVE_UNISTD_H char host[128]; #endif - char scaling[INT_DIGITS + 5]; + char scaling[INT_STRLEN_BOUND (int) + 5]; time_t curtime; struct tm *loctime; char *p, *cp; - char paper_width[INT_DIGITS + 1]; - char paper_length[INT_DIGITS + 1]; - char left_margin[INT_DIGITS + 1]; - char top_margin[INT_DIGITS + 1]; - char line_width[INT_DIGITS + 1]; - char line_width_thick[INT_DIGITS + 1]; + char paper_width[INT_STRLEN_BOUND (int) + 1]; + char paper_length[INT_STRLEN_BOUND (int) + 1]; + char left_margin[INT_STRLEN_BOUND (int) + 1]; + char top_margin[INT_STRLEN_BOUND (int) + 1]; + char line_width[INT_STRLEN_BOUND (int) + 1]; + char line_width_thick[INT_STRLEN_BOUND (int) + 1]; struct outp_driver *this = f->param; struct ps_driver_ext *x = this->ext; @@ -1394,8 +1393,8 @@ postopen (struct file_ext *f) if (!outp_title) { - dict[16].value = cp = local_alloc (strlen (dict[17].value) + 30); - sprintf (cp, "PSPP (%s)", dict[17].value); + dict[16].value = cp = local_alloc (16); + strcpy (cp, "PSPP"); } else { @@ -1407,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"); @@ -1437,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)) @@ -2402,7 +2399,7 @@ write_text (struct outp_driver *this, int last_y; - char number[INT_DIGITS + 1]; + char number[INT_STRLEN_BOUND (int) + 1]; char line[80]; char *lp; @@ -3043,5 +3040,3 @@ struct outp_class epsf_class = ps_chart_finalise }; - -#endif /* NO_POSTSCRIPT */