From: Keith Bostic Date: Sat, 2 Apr 1994 22:46:04 +0000 (-0800) Subject: prototype getfdtype X-Git-Tag: BSD-4_4_Lite2-Snapshot-Development~2880 X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/commitdiff_plain/20e35472580d62a36529459f5fa47eacd2925881 prototype getfdtype SCCS-vsn: bin/dd/dd.c 8.4 --- diff --git a/usr/src/bin/dd/dd.c b/usr/src/bin/dd/dd.c index ed7ba8ba84..428a6d9963 100644 --- a/usr/src/bin/dd/dd.c +++ b/usr/src/bin/dd/dd.c @@ -16,7 +16,7 @@ static char copyright[] = #endif /* not lint */ #ifndef lint -static char sccsid[] = "@(#)dd.c 8.3 (Berkeley) %G%"; +static char sccsid[] = "@(#)dd.c 8.4 (Berkeley) %G%"; #endif /* not lint */ #include @@ -39,6 +39,7 @@ static char sccsid[] = "@(#)dd.c 8.3 (Berkeley) %G%"; static void dd_close __P((void)); static void dd_in __P((void)); +static void getfdtype __P((IO *)); static void setup __P((void)); IO in, out; /* input/output state */ @@ -70,21 +71,6 @@ main(argc, argv) exit(0); } -static void -getfdtype(io) - IO *io; -{ - struct mtget mt; - struct stat sb; - - if (fstat(io->fd, &sb)) - err(1, "%s", io->name); - if (S_ISCHR(sb.st_mode)) - io->flags |= ioctl(io->fd, MTIOCGET, &mt) ? ISCHR : ISTAPE; - else if (lseek(io->fd, (off_t)0, SEEK_CUR) == -1 && errno == ESPIPE) - io->flags |= ISPIPE; /* XXX fixed in 4.4BSD */ -} - static void setup() { @@ -186,6 +172,21 @@ setup() (void)time(&st.start); /* Statistics timestamp. */ } +static void +getfdtype(io) + IO *io; +{ + struct mtget mt; + struct stat sb; + + if (fstat(io->fd, &sb)) + err(1, "%s", io->name); + if (S_ISCHR(sb.st_mode)) + io->flags |= ioctl(io->fd, MTIOCGET, &mt) ? ISCHR : ISTAPE; + else if (lseek(io->fd, (off_t)0, SEEK_CUR) == -1 && errno == ESPIPE) + io->flags |= ISPIPE; /* XXX fixed in 4.4BSD */ +} + static void dd_in() {