Deleted Added
full compact
misc.c (99109) misc.c (111629)
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 *

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

36 */
37
38#ifndef lint
39#if 0
40static char sccsid[] = "@(#)misc.c 8.3 (Berkeley) 4/2/94";
41#endif
42#endif /* not lint */
43#include <sys/cdefs.h>
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 *

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

36 */
37
38#ifndef lint
39#if 0
40static char sccsid[] = "@(#)misc.c 8.3 (Berkeley) 4/2/94";
41#endif
42#endif /* not lint */
43#include <sys/cdefs.h>
44__FBSDID("$FreeBSD: head/bin/dd/misc.c 99109 2002-06-30 05:13:54Z obrien $");
44__FBSDID("$FreeBSD: head/bin/dd/misc.c 111629 2003-02-27 18:04:54Z markm $");
45
46#include <sys/types.h>
47#include <sys/time.h>
48
49#include <errno.h>
45
46#include <sys/types.h>
47#include <sys/time.h>
48
49#include <errno.h>
50#include <inttypes.h>
50#include <stdio.h>
51#include <stdlib.h>
52#include <string.h>
53#include <unistd.h>
54
55#include "dd.h"
56#include "extern.h"
57

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

63 char buf[100];
64
65 (void)gettimeofday(&tv, (struct timezone *)NULL);
66 secs = tv.tv_sec + tv.tv_usec * 1e-6 - st.start;
67 if (secs < 1e-6)
68 secs = 1e-6;
69 /* Use snprintf(3) so that we don't reenter stdio(3). */
70 (void)snprintf(buf, sizeof(buf),
51#include <stdio.h>
52#include <stdlib.h>
53#include <string.h>
54#include <unistd.h>
55
56#include "dd.h"
57#include "extern.h"
58

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

64 char buf[100];
65
66 (void)gettimeofday(&tv, (struct timezone *)NULL);
67 secs = tv.tv_sec + tv.tv_usec * 1e-6 - st.start;
68 if (secs < 1e-6)
69 secs = 1e-6;
70 /* Use snprintf(3) so that we don't reenter stdio(3). */
71 (void)snprintf(buf, sizeof(buf),
71 "%qu+%qu records in\n%qu+%qu records out\n",
72 "%ju+%ju records in\n%ju+%ju records out\n",
72 st.in_full, st.in_part, st.out_full, st.out_part);
73 (void)write(STDERR_FILENO, buf, strlen(buf));
74 if (st.swab) {
73 st.in_full, st.in_part, st.out_full, st.out_part);
74 (void)write(STDERR_FILENO, buf, strlen(buf));
75 if (st.swab) {
75 (void)snprintf(buf, sizeof(buf), "%qu odd length swab %s\n",
76 (void)snprintf(buf, sizeof(buf), "%ju odd length swab %s\n",
76 st.swab, (st.swab == 1) ? "block" : "blocks");
77 (void)write(STDERR_FILENO, buf, strlen(buf));
78 }
79 if (st.trunc) {
77 st.swab, (st.swab == 1) ? "block" : "blocks");
78 (void)write(STDERR_FILENO, buf, strlen(buf));
79 }
80 if (st.trunc) {
80 (void)snprintf(buf, sizeof(buf), "%qu truncated %s\n",
81 (void)snprintf(buf, sizeof(buf), "%ju truncated %s\n",
81 st.trunc, (st.trunc == 1) ? "block" : "blocks");
82 (void)write(STDERR_FILENO, buf, strlen(buf));
83 }
84 (void)snprintf(buf, sizeof(buf),
82 st.trunc, (st.trunc == 1) ? "block" : "blocks");
83 (void)write(STDERR_FILENO, buf, strlen(buf));
84 }
85 (void)snprintf(buf, sizeof(buf),
85 "%qu bytes transferred in %.6f secs (%.0f bytes/sec)\n",
86 "%ju bytes transferred in %.6f secs (%.0f bytes/sec)\n",
86 st.bytes, secs, st.bytes / secs);
87 (void)write(STDERR_FILENO, buf, strlen(buf));
88}
89
90/* ARGSUSED */
91void
92summaryx(int notused __unused)
93{

--- 14 unchanged lines hidden ---
87 st.bytes, secs, st.bytes / secs);
88 (void)write(STDERR_FILENO, buf, strlen(buf));
89}
90
91/* ARGSUSED */
92void
93summaryx(int notused __unused)
94{

--- 14 unchanged lines hidden ---