1*280d8c66SLionel Sambuc /* $NetBSD: print.c,v 1.11 2005/01/12 17:04:35 xtraeme Exp $ */
2*280d8c66SLionel Sambuc
3*280d8c66SLionel Sambuc /*-
4*280d8c66SLionel Sambuc * Copyright (c) 1991, 1993
5*280d8c66SLionel Sambuc * The Regents of the University of California. All rights reserved.
6*280d8c66SLionel Sambuc *
7*280d8c66SLionel Sambuc * Redistribution and use in source and binary forms, with or without
8*280d8c66SLionel Sambuc * modification, are permitted provided that the following conditions
9*280d8c66SLionel Sambuc * are met:
10*280d8c66SLionel Sambuc * 1. Redistributions of source code must retain the above copyright
11*280d8c66SLionel Sambuc * notice, this list of conditions and the following disclaimer.
12*280d8c66SLionel Sambuc * 2. Redistributions in binary form must reproduce the above copyright
13*280d8c66SLionel Sambuc * notice, this list of conditions and the following disclaimer in the
14*280d8c66SLionel Sambuc * documentation and/or other materials provided with the distribution.
15*280d8c66SLionel Sambuc * 3. Neither the name of the University nor the names of its contributors
16*280d8c66SLionel Sambuc * may be used to endorse or promote products derived from this software
17*280d8c66SLionel Sambuc * without specific prior written permission.
18*280d8c66SLionel Sambuc *
19*280d8c66SLionel Sambuc * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20*280d8c66SLionel Sambuc * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21*280d8c66SLionel Sambuc * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22*280d8c66SLionel Sambuc * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23*280d8c66SLionel Sambuc * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24*280d8c66SLionel Sambuc * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25*280d8c66SLionel Sambuc * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26*280d8c66SLionel Sambuc * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27*280d8c66SLionel Sambuc * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28*280d8c66SLionel Sambuc * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29*280d8c66SLionel Sambuc * SUCH DAMAGE.
30*280d8c66SLionel Sambuc */
31*280d8c66SLionel Sambuc
32*280d8c66SLionel Sambuc #if HAVE_NBTOOL_CONFIG_H
33*280d8c66SLionel Sambuc #include "nbtool_config.h"
34*280d8c66SLionel Sambuc #endif
35*280d8c66SLionel Sambuc
36*280d8c66SLionel Sambuc #include <sys/cdefs.h>
37*280d8c66SLionel Sambuc #if defined(__RCSID) && !defined(lint)
38*280d8c66SLionel Sambuc #if 0
39*280d8c66SLionel Sambuc static char sccsid[] = "@(#)print.c 8.1 (Berkeley) 6/6/93";
40*280d8c66SLionel Sambuc #else
41*280d8c66SLionel Sambuc __RCSID("$NetBSD: print.c,v 1.11 2005/01/12 17:04:35 xtraeme Exp $");
42*280d8c66SLionel Sambuc #endif
43*280d8c66SLionel Sambuc #endif /* not lint */
44*280d8c66SLionel Sambuc
45*280d8c66SLionel Sambuc #include <sys/types.h>
46*280d8c66SLionel Sambuc #include <stdio.h>
47*280d8c66SLionel Sambuc #include "extern.h"
48*280d8c66SLionel Sambuc
49*280d8c66SLionel Sambuc void
pcrc(char * fn,u_int32_t val,off_t len)50*280d8c66SLionel Sambuc pcrc(char *fn, u_int32_t val, off_t len)
51*280d8c66SLionel Sambuc {
52*280d8c66SLionel Sambuc (void)printf("%lu %lld", (unsigned long)val, (long long)len);
53*280d8c66SLionel Sambuc if (fn)
54*280d8c66SLionel Sambuc (void)printf(" %s", fn);
55*280d8c66SLionel Sambuc (void)printf("\n");
56*280d8c66SLionel Sambuc }
57*280d8c66SLionel Sambuc
58*280d8c66SLionel Sambuc void
psum1(char * fn,u_int32_t val,off_t len)59*280d8c66SLionel Sambuc psum1(char *fn, u_int32_t val, off_t len)
60*280d8c66SLionel Sambuc {
61*280d8c66SLionel Sambuc (void)printf("%lu %lld", (unsigned long)val,
62*280d8c66SLionel Sambuc (long long)(len + 1023) / 1024);
63*280d8c66SLionel Sambuc if (fn)
64*280d8c66SLionel Sambuc (void)printf(" %s", fn);
65*280d8c66SLionel Sambuc (void)printf("\n");
66*280d8c66SLionel Sambuc }
67*280d8c66SLionel Sambuc
68*280d8c66SLionel Sambuc void
psum2(char * fn,u_int32_t val,off_t len)69*280d8c66SLionel Sambuc psum2(char *fn, u_int32_t val, off_t len)
70*280d8c66SLionel Sambuc {
71*280d8c66SLionel Sambuc (void)printf("%lu %lld", (unsigned long)val,
72*280d8c66SLionel Sambuc (long long)(len + 511) / 512);
73*280d8c66SLionel Sambuc if (fn)
74*280d8c66SLionel Sambuc (void)printf(" %s", fn);
75*280d8c66SLionel Sambuc (void)printf("\n");
76*280d8c66SLionel Sambuc }
77