From 5d7f82cb4369fdc37afb19b1733d9a4d43a541d8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fran=C3=A7ois=20Pinard?= Date: Wed, 16 Nov 1994 02:47:32 +0000 Subject: [PATCH] *** empty log message *** --- src/buffer.c | 19 +++++++++-------- src/read_ffs.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+), 9 deletions(-) create mode 100644 src/read_ffs.c diff --git a/src/buffer.c b/src/buffer.c index 31e1283..4529810 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -440,11 +440,12 @@ child_open () { if (err < 0) { - msg_perror ("can't write to compress"); + msg_perror ("can't write to compression program"); exit (EX_SYSTEM); } else - msg ("write to compress short %d bytes", count - err); + msg ("write to compression program short %d bytes", + count - err); count = (err < 0) ? 0 : err; } ptr += count; @@ -472,20 +473,20 @@ child_open () /* EOF */ if (err == 0) { - if (f_compress < 2) + if (!f_compress_block) blocksize -= n; else bzero (ar_block->charptr + blocksize - n, n); err = rmtwrite (archive, ar_block->charptr, blocksize); if (err != (blocksize)) writeerror (err); - if (f_compress < 2) + if (!f_compress_block) blocksize += n; break; } if (n) { - msg_perror ("can't read from compress"); + msg_perror ("can't read from compression program"); exit (EX_SYSTEM); } err = rmtwrite (archive, ar_block->charptr, (int) blocksize); @@ -500,10 +501,10 @@ child_open () } /* So we should exec compress (-d) */ if (ar_reading) - execlp ("compress", "compress", "-d", (char *) 0); + execlp (f_compressprog, f_compressprog, "-d", (char *) 0); else - execlp ("compress", "compress", (char *) 0); - msg_perror ("can't exec compress"); + execlp (f_compressprog, f_compressprog, (char *) 0); + msg_perror ("can't exec %s", f_compressprog); _exit (EX_SYSTEM); } @@ -573,7 +574,7 @@ open_archive (reading) exit (EX_ARGSBAD); } - if (f_compress) + if (f_compressprog) { if (reading == 2 || f_verify) { diff --git a/src/read_ffs.c b/src/read_ffs.c new file mode 100644 index 0000000..18164cf --- /dev/null +++ b/src/read_ffs.c @@ -0,0 +1,57 @@ +/* Read files directly from the fast file system + Copyright (C) 1992 Free Software Foundation + + This file is part of GNU Tar. + + GNU Tar is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. + + GNU Tar is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GNU Tar; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + + +dev_t lastdev; +ino_t lastino; + +struct dinode ino; +struct fs fs; +off_t offset; +int device_fd; + +int *sindir, *dindir, *tindir; +int sindirblk, dindirblk, tindirblk; + +read_raw_file (fd, buf, len) + int fd; + char *buf; + int len; +{ + struct stat st; + off_t ntoread; + int log_blkno, phys_blkno; + + fstat (fd, &st); + if (st.st_dev != lastdev) + new_device (st.st_dev); + + if (st.st_ino != lastino) + new_inode (st.st_ino); + + /* Only read single blocks at a time */ + if (len > fs.fs_bsize) + len = fs.fs_bsize; + + /* Prune to the length of the file */ + if (offset + len > ino.di_size) + len = ino.di_size - offset; + + log_blkno = lblkno (&fs, blkno); + -- 2.44.0