Deleted Added
full compact
dd.c (51249) dd.c (51335)
1/*-
2 * Copyright (c) 1991, 1993, 1994
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Keith Muller of the University of California, San Diego and Lance
7 * Visser of Convex Computer Corporation.
8 *

--- 32 unchanged lines hidden (view full) ---

41 The Regents of the University of California. All rights reserved.\n";
42#endif /* not lint */
43
44#ifndef lint
45#if 0
46static char sccsid[] = "@(#)dd.c 8.5 (Berkeley) 4/2/94";
47#endif
48static const char rcsid[] =
1/*-
2 * Copyright (c) 1991, 1993, 1994
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Keith Muller of the University of California, San Diego and Lance
7 * Visser of Convex Computer Corporation.
8 *

--- 32 unchanged lines hidden (view full) ---

41 The Regents of the University of California. All rights reserved.\n";
42#endif /* not lint */
43
44#ifndef lint
45#if 0
46static char sccsid[] = "@(#)dd.c 8.5 (Berkeley) 4/2/94";
47#endif
48static const char rcsid[] =
49 "$FreeBSD: head/bin/dd/dd.c 51249 1999-09-13 21:47:10Z green $";
49 "$FreeBSD: head/bin/dd/dd.c 51335 1999-09-16 19:50:59Z green $";
50#endif /* not lint */
51
52#include <sys/param.h>
53#include <sys/stat.h>
54#include <sys/conf.h>
55#include <sys/filio.h>
56
57#include <ctype.h>

--- 162 unchanged lines hidden (view full) ---

220 } else {
221 if (type & D_TAPE)
222 io->flags |= ISTAPE;
223 else if (type & (D_DISK | D_MEM))
224 io->flags |= ISSEEK;
225 if (S_ISCHR(sb.st_mode) && (type & D_TAPE) == 0)
226 io->flags |= ISCHR;
227 }
50#endif /* not lint */
51
52#include <sys/param.h>
53#include <sys/stat.h>
54#include <sys/conf.h>
55#include <sys/filio.h>
56
57#include <ctype.h>

--- 162 unchanged lines hidden (view full) ---

220 } else {
221 if (type & D_TAPE)
222 io->flags |= ISTAPE;
223 else if (type & (D_DISK | D_MEM))
224 io->flags |= ISSEEK;
225 if (S_ISCHR(sb.st_mode) && (type & D_TAPE) == 0)
226 io->flags |= ISCHR;
227 }
228 } else if (lseek(io->fd, (off_t)0, SEEK_CUR) == 0)
229 io->flags |= ISSEEK;
230 else if (errno == ESPIPE)
228 return;
229 }
230 errno = 0;
231 if (lseek(io->fd, (off_t)0, SEEK_CUR) == -1 && errno == ESPIPE)
231 io->flags |= ISPIPE;
232 io->flags |= ISPIPE;
233 else
234 io->flags |= ISSEEK;
232}
233
234static void
235dd_in()
236{
237 ssize_t n;
238
239 for (;;) {
235}
236
237static void
238dd_in()
239{
240 ssize_t n;
241
242 for (;;) {
240 if (cpy_cnt && (st.in_full + st.in_part) >= cpy_cnt)
243 switch (cpy_cnt) {
244 case -1: /* count=0 was specified */
241 return;
245 return;
246 case 0:
247 break;
248 default:
249 if (st.in_full + st.in_part >= cpy_cnt)
250 return;
251 break;
252 }
242
243 /*
244 * Zero the buffer first if sync; if doing block operations,
245 * use spaces.
246 */
247 if (ddflags & C_SYNC) {
248 if (ddflags & (C_BLOCK | C_UNBLOCK))
249 memset(in.dbp, ' ', in.dbsz);

--- 199 unchanged lines hidden ---
253
254 /*
255 * Zero the buffer first if sync; if doing block operations,
256 * use spaces.
257 */
258 if (ddflags & C_SYNC) {
259 if (ddflags & (C_BLOCK | C_UNBLOCK))
260 memset(in.dbp, ' ', in.dbsz);

--- 199 unchanged lines hidden ---