diff --git a/src/dj.c b/src/dj.c index d5f209c..9fb55ca 100644 --- a/src/dj.c +++ b/src/dj.c @@ -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; + } } }