+
+enum ftype
+checktype(fd)
+ int fd;
+{
+ struct stat st;
+ struct mtget mt;
+
+ if (fstat(fd, &st) == -1)
+ return (unknown);
+ if (S_ISFIFO(st.st_mode))
+ return (pipe);
+ if (S_ISCHR(st.st_mode)) {
+ if (ioctl(fd, MTIOCGET, (char *)&mt) != -1)
+ return (tape);
+ return (chr);
+ }
+ return (reg); /* or dir, symlink, blk, or ??? */
+}
+
+advance(fd, fdtype, count)
+{
+
+ switch (fdtype) {
+ case reg:
+ case chr:
+ lseek(fd, count, L_INCR);
+ break;
+ case pipe:
+ case tape:
+ break;
+ default:
+ fprintf(stderr, "dd: unknown input type, can't resynchronize\n");
+ exit(99);
+ }
+}
+