I7000: Fixed bug in printer resting file. Fixed Coverity error.

This commit is contained in:
Richard Cornwell 2019-08-12 07:40:24 -07:00 committed by Mark Pizzolato
parent 68df51fc22
commit 866ce293e5
4 changed files with 39 additions and 17 deletions

View file

@ -220,8 +220,10 @@ print_line(UNIT * uptr, int chan, int unit)
sim_debug(DEBUG_DETAIL, &lpr_dev, "WRS unit=%d [%s]\n", unit, &out[0]);
/* Print out buffer */
if (uptr->flags & UNIT_ATT)
if (uptr->flags & UNIT_ATT) {
sim_fwrite(&out, 1, i, uptr->fileref);
uptr->pos += i;
}
if (uptr->flags & ECHO) {
int j = 0;
@ -236,14 +238,18 @@ print_line(UNIT * uptr, int chan, int unit)
if (uptr->u5 & URCSTA_SKIPAFT) {
i = (uptr->u5 >> 12) & 0x7f;
if (i == 0) {
if (uptr->flags & UNIT_ATT)
if (uptr->flags & UNIT_ATT) {
sim_fwrite("\r\n", 1, 2, uptr->fileref);
uptr->pos += 2;
}
if (uptr->flags & ECHO)
sim_putchar('\r');
} else {
for (; i > 1; i--) {
if (uptr->flags & UNIT_ATT)
if (uptr->flags & UNIT_ATT) {
sim_fwrite("\r\n", 1, 2, uptr->fileref);
uptr->pos += 2;
}
if (uptr->flags & ECHO) {
sim_putchar('\r');
sim_putchar('\n');
@ -331,8 +337,10 @@ uint32 lpr_cmd(UNIT * uptr, uint16 cmd, uint16 dev)
break;
case 040: /* Space before */
for (i = dev & 03; i > 1; i--) {
if (uptr->flags & UNIT_ATT)
if (uptr->flags & UNIT_ATT) {
sim_fwrite("\r\n", 1, 2, uptr->fileref);
uptr->pos += 2;
}
if (uptr->flags & ECHO) {
sim_putchar('\r');
sim_putchar('\n');
@ -358,8 +366,10 @@ uint32 lpr_cmd(UNIT * uptr, uint16 cmd, uint16 dev)
break;
}
for (; i > 0; i--) {
if (uptr->flags & UNIT_ATT)
if (uptr->flags & UNIT_ATT) {
sim_fwrite("\r\n", 1, 2, uptr->fileref);
uptr->pos += 2;
}
if (uptr->flags & ECHO) {
sim_putchar('\r');
sim_putchar('\n');

View file

@ -2976,10 +2976,8 @@ step6:
Next(MA);
sim_interval --; /* count down */
cr2 = AC[tsac];
if (cr2 == 0) {
smt = 1; /* Check usage here */
break; /* goto step6; */
}
if (cr2 == 0)
goto step6;
if (at) {
cr1 &= 017;
at = 0;

View file

@ -1263,7 +1263,7 @@ chan_cmd(uint16 dev, uint16 dcmd)
if ((chan_flags[chan] & (DEV_WRITE)) == (DEV_WRITE) ||
(chan_flags[chan] & (DEV_FULL)) == (DEV_FULL))
chan_flags[chan] |= DEV_DISCO | DEV_WEOR;
return SCPE_BUSY;
return SCPE_BUSY;
}
/* Unit is busy doing something, wait */
if (chan_flags[chan] & (DEV_SEL | DEV_DISCO | STA_TWAIT | STA_WAIT))

View file

@ -174,8 +174,10 @@ print_line(UNIT * uptr, int chan, int unit)
return SCPE_UNATT; /* attached? */
if (outsel & PRINT_3) {
if (uptr->flags & UNIT_ATT)
if (uptr->flags & UNIT_ATT) {
sim_fwrite("\r\n", 1, 2, uptr->fileref);
uptr->pos += 2;
}
if (uptr->flags & ECHO) {
sim_putchar('\r');
sim_putchar('\n');
@ -185,8 +187,10 @@ print_line(UNIT * uptr, int chan, int unit)
}
if (outsel & PRINT_4) {
if (uptr->flags & UNIT_ATT)
if (uptr->flags & UNIT_ATT) {
sim_fwrite("\r\n\r\n", 1, 4, uptr->fileref);
uptr->pos += 4;
}
if (uptr->flags & ECHO) {
sim_putchar('\r');
sim_putchar('\n');
@ -226,14 +230,18 @@ print_line(UNIT * uptr, int chan, int unit)
j = 0;
for (i = j; i < 72; i++) {
if (uptr->flags & UNIT_ATT)
if (uptr->flags & UNIT_ATT) {
sim_fwrite(" ", 1, 1, uptr->fileref);
uptr->pos += 1;
}
if (uptr->flags & ECHO)
sim_putchar(' ');
}
} else {
if (uptr->flags & UNIT_ATT)
if (uptr->flags & UNIT_ATT) {
sim_fwrite("\n\r", 1, 2, uptr->fileref);
uptr->pos += 2;
}
if (uptr->flags & ECHO) {
sim_putchar('\n');
sim_putchar('\r');
@ -265,8 +273,10 @@ print_line(UNIT * uptr, int chan, int unit)
for (j = 71; j > 0 && lpr_data[unit].lbuff[j] == ' '; j--) ;
/* Print out buffer */
if (uptr->flags & UNIT_ATT)
if (uptr->flags & UNIT_ATT) {
sim_fwrite(lpr_data[unit].lbuff, 1, j+1, uptr->fileref);
uptr->pos += j+1;
}
if (uptr->flags & ECHO) {
for(i = 0; i <= j; i++)
sim_putchar(lpr_data[unit].lbuff[i]);
@ -280,8 +290,10 @@ print_line(UNIT * uptr, int chan, int unit)
/* Space printer */
if (outsel & PRINT_2) {
if (uptr->flags & UNIT_ATT)
if (uptr->flags & UNIT_ATT) {
sim_fwrite("\r\n", 1, 2, uptr->fileref);
uptr->pos += 2;
}
if (uptr->flags & ECHO) {
sim_putchar('\r');
sim_putchar('\n');
@ -291,8 +303,10 @@ print_line(UNIT * uptr, int chan, int unit)
if (outsel & PRINT_1) {
while (uptr->u4 < (int32)uptr->capac) {
if (uptr->flags & UNIT_ATT)
if (uptr->flags & UNIT_ATT) {
sim_fwrite("\r\n", 1, 2, uptr->fileref);
uptr->pos += 2;
}
if (uptr->flags & ECHO) {
sim_putchar('\r');
sim_putchar('\n');