diff options
Diffstat (limited to 'bin/pax/ar_io.c')
-rw-r--r-- | bin/pax/ar_io.c | 100 |
1 files changed, 50 insertions, 50 deletions
diff --git a/bin/pax/ar_io.c b/bin/pax/ar_io.c index b286aa6..0c86ff0 100644 --- a/bin/pax/ar_io.c +++ b/bin/pax/ar_io.c @@ -92,7 +92,7 @@ extern sigset_t s_mask; * -1 on failure, 0 otherwise */ -#if __STDC__ +#ifdef __STDC__ int ar_open(char *name) #else @@ -120,14 +120,14 @@ ar_open(name) arfd = STDIN_FILENO; arcname = STDN; } else if ((arfd = open(name, EXT_MODE, DMOD)) < 0) - sys_warn(0, errno, "Failed open to read on %s", name); + syswarn(0, errno, "Failed open to read on %s", name); break; case ARCHIVE: if (name == NULL) { arfd = STDOUT_FILENO; arcname = STDO; } else if ((arfd = open(name, AR_MODE, DMOD)) < 0) - sys_warn(0, errno, "Failed open to write on %s", name); + syswarn(0, errno, "Failed open to write on %s", name); else can_unlnk = 1; break; @@ -136,7 +136,7 @@ ar_open(name) arfd = STDOUT_FILENO; arcname = STDO; } else if ((arfd = open(name, APP_MODE, DMOD)) < 0) - sys_warn(0, errno, "Failed open to read/write on %s", + syswarn(0, errno, "Failed open to read/write on %s", name); break; case COPY: @@ -154,14 +154,14 @@ ar_open(name) * set up is based on device type */ if (fstat(arfd, &arsb) < 0) { - sys_warn(0, errno, "Failed stat on %s", arcname); + syswarn(0, errno, "Failed stat on %s", arcname); (void)close(arfd); arfd = -1; can_unlnk = 0; return(-1); } if (S_ISDIR(arsb.st_mode)) { - pax_warn(0, "Cannot write an archive on top of a directory %s", + paxwarn(0, "Cannot write an archive on top of a directory %s", arcname); (void)close(arfd); arfd = -1; @@ -290,7 +290,7 @@ ar_open(name) * ar_close() * closes archive device, increments volume number, and prints i/o summary */ -#if __STDC__ +#ifdef __STDC__ void ar_close(void) #else @@ -405,7 +405,7 @@ ar_close() * other side of the pipe from getting a SIGPIPE (pax will stop * reading an archive once a format dependent trailer is detected). */ -#if __STDC__ +#ifdef __STDC__ void ar_drain(void) #else @@ -442,7 +442,7 @@ ar_drain() * 0 if all ready to write, -1 otherwise */ -#if __STDC__ +#ifdef __STDC__ int ar_set_wr(void) #else @@ -470,7 +470,7 @@ ar_set_wr() */ if (((cpos = lseek(arfd, (off_t)0L, SEEK_CUR)) < 0) || (ftruncate(arfd, cpos) < 0)) { - sys_warn(1, errno, "Unable to truncate archive file"); + syswarn(1, errno, "Unable to truncate archive file"); return(-1); } return(0); @@ -485,7 +485,7 @@ ar_set_wr() * 0 if we can append, -1 otherwise. */ -#if __STDC__ +#ifdef __STDC__ int ar_app_ok(void) #else @@ -494,13 +494,13 @@ ar_app_ok() #endif { if (artyp == ISPIPE) { - pax_warn(1, "Cannot append to an archive obtained from a pipe."); + paxwarn(1, "Cannot append to an archive obtained from a pipe."); return(-1); } if (!invld_rec) return(0); - pax_warn(1,"Cannot append, device record size %d does not support %s spec", + paxwarn(1,"Cannot append, device record size %d does not support %s spec", rdblksz, argv0); return(-1); } @@ -514,7 +514,7 @@ ar_app_ok() * Number of bytes in buffer. 0 for end of file, -1 for a read error. */ -#if __STDC__ +#ifdef __STDC__ int ar_read(register char *buf, register int cnt) #else @@ -587,9 +587,9 @@ ar_read(buf, cnt) */ lstrval = res; if (res < 0) - sys_warn(1, errno, "Failed read on archive volume %d", arvol); + syswarn(1, errno, "Failed read on archive volume %d", arvol); else - pax_warn(0, "End of archive volume %d reached", arvol); + paxwarn(0, "End of archive volume %d reached", arvol); return(res); } @@ -604,7 +604,7 @@ ar_read(buf, cnt) * error in the archive occured. */ -#if __STDC__ +#ifdef __STDC__ int ar_write(register char *buf, register int bsz) #else @@ -668,7 +668,7 @@ ar_write(buf, bsz) if (res >= 0) break; if (errno == EACCES) { - pax_warn(0, "Write failed, archive is write protected."); + paxwarn(0, "Write failed, archive is write protected."); res = lstrval = 0; return(0); } @@ -706,18 +706,18 @@ ar_write(buf, bsz) * must quit right away. */ if (!wr_trail && (res <= 0)) { - pax_warn(1,"Unable to append, trailer re-write failed. Quitting."); + paxwarn(1,"Unable to append, trailer re-write failed. Quitting."); return(res); } if (res == 0) - pax_warn(0, "End of archive volume %d reached", arvol); + paxwarn(0, "End of archive volume %d reached", arvol); else if (res < 0) - sys_warn(1, errno, "Failed write to archive volume: %d", arvol); + syswarn(1, errno, "Failed write to archive volume: %d", arvol); else if (!frmt->blkalgn || ((res % frmt->blkalgn) == 0)) - pax_warn(0,"WARNING: partial archive write. Archive MAY BE FLAWED"); + paxwarn(0,"WARNING: partial archive write. Archive MAY BE FLAWED"); else - pax_warn(1,"WARNING: partial archive write. Archive IS FLAWED"); + paxwarn(1,"WARNING: partial archive write. Archive IS FLAWED"); return(res); } @@ -729,7 +729,7 @@ ar_write(buf, bsz) * 0 when ok to try i/o again, -1 otherwise. */ -#if __STDC__ +#ifdef __STDC__ int ar_rdsync(void) #else @@ -751,7 +751,7 @@ ar_rdsync() return(-1); if ((act == APPND) || (act == ARCHIVE)) { - pax_warn(1, "Cannot allow updates to an archive with flaws."); + paxwarn(1, "Cannot allow updates to an archive with flaws."); return(-1); } if (io_ok) @@ -803,10 +803,10 @@ ar_rdsync() break; } if (lstrval <= 0) { - pax_warn(1, "Unable to recover from an archive read failure."); + paxwarn(1, "Unable to recover from an archive read failure."); return(-1); } - pax_warn(0, "Attempting to recover from an archive read failure."); + paxwarn(0, "Attempting to recover from an archive read failure."); return(0); } @@ -820,7 +820,7 @@ ar_rdsync() * partial move (the amount moved is in skipped) */ -#if __STDC__ +#ifdef __STDC__ int ar_fow(off_t sksz, off_t *skipped) #else @@ -870,7 +870,7 @@ ar_fow(sksz, skipped) if (lseek(arfd, mpos, SEEK_SET) >= 0) return(0); } - sys_warn(1, errno, "Forward positioning operation on archive failed"); + syswarn(1, errno, "Forward positioning operation on archive failed"); lstrval = -1; return(-1); } @@ -886,7 +886,7 @@ ar_fow(sksz, skipped) * 0 if moved the requested distance, -1 on complete failure */ -#if __STDC__ +#ifdef __STDC__ int ar_rev(off_t sksz) #else @@ -912,7 +912,7 @@ ar_rev(sksz) /* * cannot go backwards on these critters */ - pax_warn(1, "Reverse positioning on pipes is not supported."); + paxwarn(1, "Reverse positioning on pipes is not supported."); lstrval = -1; return(-1); case ISREG: @@ -930,7 +930,7 @@ ar_rev(sksz) * First we figure out where we are in the archive. */ if ((cpos = lseek(arfd, (off_t)0L, SEEK_CUR)) < 0) { - sys_warn(1, errno, + syswarn(1, errno, "Unable to obtain current archive byte offset"); lstrval = -1; return(-1); @@ -948,14 +948,14 @@ ar_rev(sksz) /* * this should never happen */ - pax_warn(1,"Reverse position on previous volume."); + paxwarn(1,"Reverse position on previous volume."); lstrval = -1; return(-1); } cpos = (off_t)0L; } if (lseek(arfd, cpos, SEEK_SET) < 0) { - sys_warn(1, errno, "Unable to seek archive backwards"); + syswarn(1, errno, "Unable to seek archive backwards"); lstrval = -1; return(-1); } @@ -990,7 +990,7 @@ ar_rev(sksz) * ok we have to move. Make sure the tape drive can do it. */ if (sksz % phyblk) { - pax_warn(1, + paxwarn(1, "Tape drive unable to backspace requested amount"); lstrval = -1; return(-1); @@ -1002,7 +1002,7 @@ ar_rev(sksz) mb.mt_op = MTBSR; mb.mt_count = sksz/phyblk; if (ioctl(arfd, MTIOCTOP, &mb) < 0) { - sys_warn(1,errno, "Unable to backspace tape %d blocks.", + syswarn(1,errno, "Unable to backspace tape %d blocks.", mb.mt_count); lstrval = -1; return(-1); @@ -1024,7 +1024,7 @@ ar_rev(sksz) * physical block size if ok (ok > 0), -1 otherwise */ -#if __STDC__ +#ifdef __STDC__ static int get_phys(void) #else @@ -1050,7 +1050,7 @@ get_phys() while ((res = read(arfd, scbuf, sizeof(scbuf))) > 0) padsz += res; if (res < 0) { - sys_warn(1, errno, "Unable to locate tape filemark."); + syswarn(1, errno, "Unable to locate tape filemark."); return(-1); } } @@ -1062,7 +1062,7 @@ get_phys() mb.mt_op = MTBSF; mb.mt_count = 1; if (ioctl(arfd, MTIOCTOP, &mb) < 0) { - sys_warn(1, errno, "Unable to backspace over tape filemark."); + syswarn(1, errno, "Unable to backspace over tape filemark."); return(-1); } @@ -1073,11 +1073,11 @@ get_phys() mb.mt_op = MTBSR; mb.mt_count = 1; if (ioctl(arfd, MTIOCTOP, &mb) < 0) { - sys_warn(1, errno, "Unable to backspace over last tape block."); + syswarn(1, errno, "Unable to backspace over last tape block."); return(-1); } if ((phyblk = read(arfd, scbuf, sizeof(scbuf))) <= 0) { - sys_warn(1, errno, "Cannot determine archive tape blocksize."); + syswarn(1, errno, "Cannot determine archive tape blocksize."); return(-1); } @@ -1088,13 +1088,13 @@ get_phys() while ((res = read(arfd, scbuf, sizeof(scbuf))) > 0) ; if (res < 0) { - sys_warn(1, errno, "Unable to locate tape filemark."); + syswarn(1, errno, "Unable to locate tape filemark."); return(-1); } mb.mt_op = MTBSF; mb.mt_count = 1; if (ioctl(arfd, MTIOCTOP, &mb) < 0) { - sys_warn(1, errno, "Unable to backspace over tape filemark."); + syswarn(1, errno, "Unable to backspace over tape filemark."); return(-1); } @@ -1114,7 +1114,7 @@ get_phys() * never fail). */ if (padsz % phyblk) { - pax_warn(1, "Tape drive unable to backspace requested amount"); + paxwarn(1, "Tape drive unable to backspace requested amount"); return(-1); } @@ -1125,7 +1125,7 @@ get_phys() mb.mt_op = MTBSR; mb.mt_count = padsz/phyblk; if (ioctl(arfd, MTIOCTOP, &mb) < 0) { - sys_warn(1,errno,"Unable to backspace tape over %d pad blocks", + syswarn(1,errno,"Unable to backspace tape over %d pad blocks", mb.mt_count); return(-1); } @@ -1142,7 +1142,7 @@ get_phys() * 0 when ready to continue, -1 when all done */ -#if __STDC__ +#ifdef __STDC__ int ar_next(void) #else @@ -1160,10 +1160,10 @@ ar_next() * also be called via a signal handler, so we must prevent a race. */ if (sigprocmask(SIG_BLOCK, &s_mask, &o_mask) < 0) - sys_warn(0, errno, "Unable to set signal mask"); + syswarn(0, errno, "Unable to set signal mask"); ar_close(); - if (sigprocmask(SIG_SETMASK, &o_mask, (sigset_t *)NULL) < 0) - sys_warn(0, errno, "Unable to restore signal mask"); + if (sigprocmask(SIG_SETMASK, &o_mask, NULL) < 0) + syswarn(0, errno, "Unable to restore signal mask"); if (done || !wr_trail) return(-1); @@ -1276,7 +1276,7 @@ ar_next() if ((arcname = strdup(buf)) == NULL) { done = 1; lstrval = -1; - pax_warn(0, "Cannot save archive name."); + paxwarn(0, "Cannot save archive name."); return(-1); } freeit = 1; |