dj(1): add a variable for skipping in the main loop

This commit is contained in:
dtb 2024-07-04 20:00:40 -06:00
parent 8c33f0116c
commit fe175cab19
Signed by: trinity
GPG Key ID: 34C0543BBB6AF81B

View File

@ -269,22 +269,29 @@ int main(int argc, char *argv[]){
if(io[i].seek > 0)
return oserr(io[i].fn);
do{ /* read */
if(Io_read(&io[0])->bufuse == 0 && !noerror)
Io_read(&io[0]); /* second chance */
if(io[0].bufuse == 0) /* that's all she wrote */
break;
do{
{ /* read */
static char skipping = 0;
if(io[0].bufuse < io[0].bs){
fprintf(stderr, "%s: Partial read:\n\t", program_name);
fprintio(stderr, fmt, io);
if(!noerror)
count = 1;
if(align >= 0){
/* fill the rest of the ibuf with padding */
memset(io[0].buf + io[0].bufuse, align,
io[0].bs - io[0].bufuse);
io->bufuse = io->bs;
if(io[0].seek > 0)
skipping = 1;
if(Io_read(&io[0])->bufuse == 0 && !noerror)
Io_read(&io[0]); /* second chance */
if(io[0].bufuse == 0) /* that's all she wrote */
break;
if(io[0].bufuse < io[0].bs){
fprintf(stderr, "%s: Partial read:\n\t", program_name);
fprintio(stderr, fmt, io);
if(!noerror)
count = 1;
if(align >= 0){
/* fill the rest of the ibuf with padding */
memset(io[0].buf + io[0].bufuse, align,
io[0].bs - io[0].bufuse);
io->bufuse = io->bs;
}
}
}