drop out_pbuf, which was an ancient workaround

obviously an old implementation of out_printf()
  has been unreliable.
This commit is contained in:
rlar 2012-08-18 18:27:13 +02:00
parent 0825c10471
commit d4ced47e8e
7 changed files with 17 additions and 44 deletions

View File

@ -156,9 +156,8 @@ inp_list(FILE *file, struct line *deck, struct line *extras, int type)
continue;
if (*here->li_line != '*') {
if (useout) {
sprintf(out_pbuf, "%6d : %s\n",
out_printf("%6d : %s\n",
here->li_linenum, upper(here->li_line));
out_send(out_pbuf);
} else {
fprintf(file, "%6d : %s\n",
here->li_linenum, upper(here->li_line));
@ -180,8 +179,7 @@ inp_list(FILE *file, struct line *deck, struct line *extras, int type)
}
if (useout) {
sprintf(out_pbuf, "%6d : .end\n", i);
out_send(out_pbuf);
out_printf("%6d : .end\n", i);
} else {
fprintf(file, "%6d : .end\n", i);
}
@ -197,9 +195,8 @@ inp_list(FILE *file, struct line *deck, struct line *extras, int type)
continue;
if (type == LS_PHYSICAL) {
if (useout) {
sprintf(out_pbuf, "%6d : %s\n",
out_printf("%6d : %s\n",
here->li_linenum, upper(here->li_line));
out_send(out_pbuf);
} else {
fprintf(file, "%6d : %s\n",
here->li_linenum, upper(here->li_line));
@ -223,9 +220,8 @@ inp_list(FILE *file, struct line *deck, struct line *extras, int type)
continue;
if (type == LS_PHYSICAL) {
if (useout) {
sprintf(out_pbuf, "%6d : %s\n",
out_printf("%6d : %s\n",
there->li_linenum, upper(there->li_line));
out_send(out_pbuf);
} else {
fprintf(file, "%6d : %s\n",
there->li_linenum, upper(there->li_line));
@ -254,8 +250,7 @@ inp_list(FILE *file, struct line *deck, struct line *extras, int type)
}
if (type == LS_PHYSICAL) {
if (useout) {
sprintf(out_pbuf, "%6d : .end\n", i);
out_send(out_pbuf);
out_printf("%6d : .end\n", i);
} else {
fprintf(file, "%6d : .end\n", i);
}

View File

@ -271,10 +271,7 @@ ft_agraf(double *xlims, double *ylims, struct dvec *xscale, struct plot *plot, s
if (j == 0)
j = 1;
for (v = vecs; v; v = v->v_link2) {
out_pbuf[0] = (char) v->v_linestyle;
out_pbuf[1] = '\0';
/* out_printf("%c = %-17s", (char) v->v_linestyle, v->v_name); */
out_printf("%s = %-17s", out_pbuf, v->v_name);
out_printf("%c = %-17s", (char) v->v_linestyle, v->v_name);
if (!(++i % j) && v->v_link2) {
out_send("\n ");
curline++;
@ -297,23 +294,15 @@ ft_agraf(double *xlims, double *ylims, struct dvec *xscale, struct plot *plot, s
else
x = xrange[0] + (xrange[1] - xrange[0]) * i / (maxx - 1);
if (x < 0.0) {
sprintf(out_pbuf, "%.3e ", x);
out_send(out_pbuf);
/* out_printf("%.3e ", x); */
out_printf("%.3e ", x);
} else {
sprintf(out_pbuf, " %.3e ", x);
out_send(out_pbuf);
/* out_printf(" %.3e ", x); */
out_printf(" %.3e ", x);
}
if (!novalue) {
if (values[i] < 0.0) {
sprintf(out_pbuf, "%.3e ", values[i]);
out_send(out_pbuf);
/* out_printf("%.3e ", values[i]); */
out_printf("%.3e ", values[i]);
} else {
sprintf(out_pbuf, " %.3e ", values[i]);
out_send(out_pbuf);
/* out_printf(" %.3e ", values[i]); */
out_printf(" %.3e ", values[i]);
}
}
cb = field[(i + 1) * omaxy];

View File

@ -317,8 +317,7 @@ pbreak: /* New page. */
lineno += 2;
loop:
while ((j < npoints) && (lineno < height)) {
sprintf(out_pbuf, "%d\t", j);
out_send(out_pbuf);
out_printf("%d\t", j);
for (v = bv; (v && (v != lv)); v = v->v_link2) {
if (v->v_length <= j) {
if (isreal(v))
@ -329,8 +328,7 @@ loop:
if (isreal(v))
{
printnum(numbuf, v->v_realdata[j]);
(void) sprintf(out_pbuf, "%s\t",numbuf);
out_send(out_pbuf);
out_printf("%s\t", numbuf);
}
else
{
@ -339,15 +337,14 @@ loop:
imagpart(v->v_compdata[j]) == 0.0)
{
printnum(numbuf, realpart(v->v_compdata[j]));
(void) sprintf(out_pbuf, "%s\t",numbuf);
out_printf("%s\t", numbuf);
}
else
{
printnum(numbuf, realpart(v->v_compdata[j]));
printnum(numbuf2, imagpart(v->v_compdata[j]));
(void) sprintf(out_pbuf, "%s,\t%s\t",numbuf,numbuf2);
out_printf("%s,\t%s\t", numbuf, numbuf2);
}
out_send(out_pbuf);
}
}
}

View File

@ -51,10 +51,6 @@ extern int vasprintf(char **out, const char *fmt, va_list ap);
#include "variable.h"
#include "terminal.h"
/* out_printf doesn't handle double arguments correctly, so we
sprintf into this buf and call out_send w/ it */
char out_pbuf[8*BSIZE_SP];
bool out_moremode = TRUE;
bool out_isatty = TRUE;
@ -265,12 +261,14 @@ out_printf(char *fmt, ...)
out_send(tbuf);
FREE(tbuf);
#elif defined(HAVE_SNPRINTF) /* the second best */
static char out_pbuf[8*BSIZE_SP];
va_list ap;
va_start (ap, fmt);
vsnprintf(out_pbuf, sizeof(out_pbuf), fmt, ap);
va_end (ap);
out_send(out_pbuf);
#else /* guaranteed a bug for long messages */
static char out_pbuf[8*BSIZE_SP];
va_list ap;
va_start (ap, fmt);
vsprintf(out_pbuf, fmt, ap);

View File

@ -919,9 +919,7 @@ cp_vprint(void)
continue;
v = vars[j].x_v;
if (v->va_type == CP_BOOL) {
/* out_printf("%c %s\n", vars[j].x_char, v->va_name); */
sprintf(out_pbuf, "%c %s\n", vars[j].x_char, v->va_name);
out_send(out_pbuf);
out_printf("%c %s\n", vars[j].x_char, v->va_name);
} else {
out_printf("%c %s\t", vars[j].x_char, v->va_name);
wl = vareval(v->va_name);

View File

@ -116,7 +116,6 @@ extern void cp_init(void);
/* output.c */
extern char out_pbuf[];
extern bool out_moremode;
extern bool out_isatty;
extern void out_init(void);

View File

@ -33,9 +33,6 @@ struct circ *ft_curckt = NULL;
char *cp_program = "sconvert";
/* doesn't get used, but some unused routine in some file references it */
char out_pbuf[BSIZE_SP];
#define tfread(ptr, siz, nit, fp) if (fread((ptr), (siz), \
(nit), (fp)) != (nit)) { \