/*- * Copyright (c) 1991, 1993, 1994 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Keith Muller of the University of California, San Diego and Lance * Visser of Convex Computer Corporation. * * %sccs.include.redist.c% */ #ifndef lint static char sccsid[] = "@(#)misc.c 8.3 (Berkeley) 04/02/94"; #endif /* not lint */ #include #include #include #include #include #include #include #include "dd.h" #include "extern.h" void summary() { time_t secs; char buf[100]; (void)time(&secs); if ((secs -= st.start) == 0) secs = 1; /* Use snprintf(3) so that we don't reenter stdio(3). */ (void)snprintf(buf, sizeof(buf), "%u+%u records in\n%u+%u records out\n", st.in_full, st.in_part, st.out_full, st.out_part); (void)write(STDERR_FILENO, buf, strlen(buf)); if (st.swab) { (void)snprintf(buf, sizeof(buf), "%u odd length swab %s\n", st.swab, (st.swab == 1) ? "block" : "blocks"); (void)write(STDERR_FILENO, buf, strlen(buf)); } if (st.trunc) { (void)snprintf(buf, sizeof(buf), "%u truncated %s\n", st.trunc, (st.trunc == 1) ? "block" : "blocks"); (void)write(STDERR_FILENO, buf, strlen(buf)); } (void)snprintf(buf, sizeof(buf), "%u bytes transferred in %u secs (%u bytes/sec)\n", st.bytes, secs, st.bytes / secs); (void)write(STDERR_FILENO, buf, strlen(buf)); } /* ARGSUSED */ void summaryx(notused) int notused; { summary(); } /* ARGSUSED */ void terminate(notused) int notused; { exit(0); }