dj(1): remove Io_bufrpad
This commit is contained in:
parent
b74160fa4e
commit
2b593559af
21
src/dj.c
21
src/dj.c
@ -62,19 +62,6 @@ static int write_flags = O_WRONLY | O_CREAT;
|
||||
/* Macro to check if fd is stdin or stdout */
|
||||
#define fdisstd(fd) ((fd) == STDIN_FILENO || (fd) == STDOUT_FILENO)
|
||||
|
||||
/* Fills the unused portion of io's buffer with padding, updating io->bufuse.
|
||||
* Returns io. */
|
||||
static struct Io *
|
||||
Io_bufrpad(struct Io *io, int padding){
|
||||
|
||||
assert(io != NULL);
|
||||
|
||||
memset(io->buf + io->bufuse, padding, io->bs - io->bufuse);
|
||||
io->bufuse = io->bs;
|
||||
|
||||
return io;
|
||||
}
|
||||
|
||||
/* Opens io->fn and saves the file descriptor into io->fd. Returns io->fd,
|
||||
* which will be -1 if an error occured. */
|
||||
static int
|
||||
@ -294,8 +281,12 @@ int main(int argc, char *argv[]){
|
||||
printio(fmt, io);
|
||||
if(!noerror)
|
||||
count = 1;
|
||||
if(align >= 0)
|
||||
Io_bufrpad(&io[0], align);
|
||||
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;
|
||||
}
|
||||
}else
|
||||
++io[0].rec;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user