From 0609531ab6b945c4918206f095bc1f6640408654 Mon Sep 17 00:00:00 2001 From: bde Date: Mon, 6 Jul 1998 21:01:54 +0000 Subject: Fixed printf format errors. --- contrib/top/utils.c | 3 +- usr.bin/ar/archive.c | 17 +++--- usr.bin/cap_mkdb/cap_mkdb.c | 6 +- usr.bin/find/ls.c | 2 +- usr.bin/fstat/fstat.c | 52 +++++++++--------- usr.bin/mail/cmd1.c | 2 +- usr.bin/mail/cmd3.c | 2 +- usr.bin/netstat/atalk.c | 12 ++-- usr.bin/netstat/if.c | 4 +- usr.bin/netstat/inet.c | 56 ++++++++++++------- usr.bin/netstat/ipx.c | 124 +++++++++++++++++++++--------------------- usr.bin/netstat/mbuf.c | 9 +-- usr.bin/netstat/unix.c | 4 +- usr.bin/ranlib/touch.c | 4 +- usr.bin/size/size.c | 6 +- usr.bin/tail/reverse.c | 4 +- usr.bin/talk/ctl.c | 4 +- usr.bin/telnet/telnet.c | 2 +- usr.bin/truss/amd64-fbsd32.c | 6 +- usr.bin/truss/amd64-linux32.c | 6 +- usr.bin/truss/i386-fbsd.c | 6 +- usr.bin/truss/i386-linux.c | 6 +- usr.bin/truss/main.c | 6 +- usr.bin/truss/syscalls.c | 12 ++-- usr.bin/uname/uname.c | 10 ++-- usr.bin/vmstat/vmstat.c | 35 +++++++----- 26 files changed, 212 insertions(+), 188 deletions(-) diff --git a/contrib/top/utils.c b/contrib/top/utils.c index e136d2a..94233de 100644 --- a/contrib/top/utils.c +++ b/contrib/top/utils.c @@ -391,7 +391,8 @@ long seconds; { /* standard method produces MMM:SS */ /* we avoid printf as must as possible to make this quick */ - sprintf(result, "%3d:%02d", seconds / 60l, seconds % 60l); + sprintf(result, "%3ld:%02ld", + (long)(seconds / 60), (long)(seconds % 60)); } return(result); } diff --git a/usr.bin/ar/archive.c b/usr.bin/ar/archive.c index 8ab1111..c8803cc 100644 --- a/usr.bin/ar/archive.c +++ b/usr.bin/ar/archive.c @@ -225,19 +225,20 @@ put_arobj(cfp, sb) name, OLDARMAXNAME, name); (void)fflush(stderr); } - (void)sprintf(hb, HDR3, name, sb->st_mtimespec.tv_sec, - sb->st_uid, sb->st_gid, sb->st_mode, sb->st_size, - ARFMAG); + (void)sprintf(hb, HDR3, name, + (long)sb->st_mtimespec.tv_sec, sb->st_uid, + sb->st_gid, sb->st_mode, sb->st_size, ARFMAG); lname = 0; } else if (lname > sizeof(hdr->ar_name) || strchr(name, ' ')) (void)sprintf(hb, HDR1, AR_EFMT1, lname, - sb->st_mtimespec.tv_sec, sb->st_uid, sb->st_gid, - sb->st_mode, sb->st_size + lname, ARFMAG); + (long)sb->st_mtimespec.tv_sec, sb->st_uid, + sb->st_gid, sb->st_mode, sb->st_size + lname, + ARFMAG); else { lname = 0; - (void)sprintf(hb, HDR2, name, sb->st_mtimespec.tv_sec, - sb->st_uid, sb->st_gid, sb->st_mode, sb->st_size, - ARFMAG); + (void)sprintf(hb, HDR2, name, + (long)sb->st_mtimespec.tv_sec, sb->st_uid, + sb->st_gid, sb->st_mode, sb->st_size, ARFMAG); } size = sb->st_size; } else { diff --git a/usr.bin/cap_mkdb/cap_mkdb.c b/usr.bin/cap_mkdb/cap_mkdb.c index 75ba9b7..1e1c201 100644 --- a/usr.bin/cap_mkdb/cap_mkdb.c +++ b/usr.bin/cap_mkdb/cap_mkdb.c @@ -164,7 +164,7 @@ db_build(ifiles) /* Find the end of the name field. */ if ((p = strchr(bp, ':')) == NULL) { - warnx("no name field: %.*s", MIN(len, 20), bp); + warnx("no name field: %.*s", (int)MIN(len, 20), bp); continue; } @@ -193,7 +193,7 @@ db_build(ifiles) /* NOTREACHED */ case 1: warnx("ignored duplicate: %.*s", - key.size, (char *)key.data); + (int)key.size, (char *)key.data); continue; } ++reccnt; @@ -219,7 +219,7 @@ db_build(ifiles) /* NOTREACHED */ case 1: warnx("ignored duplicate: %.*s", - key.size, (char *)key.data); + (int)key.size, (char *)key.data); } t = p + 1; } diff --git a/usr.bin/find/ls.c b/usr.bin/find/ls.c index a1b9dd7..93de47a 100644 --- a/usr.bin/find/ls.c +++ b/usr.bin/find/ls.c @@ -59,7 +59,7 @@ printlong(name, accpath, sb) { char modep[15], *user_from_uid(), *group_from_gid(); - (void)printf("%6lu %4qd ", sb->st_ino, sb->st_blocks); + (void)printf("%6lu %4qd ", (u_long)sb->st_ino, sb->st_blocks); (void)strmode(sb->st_mode, modep); (void)printf("%s %3u %-*s %-*s ", modep, sb->st_nlink, UT_NAMESIZE, user_from_uid(sb->st_uid, 0), UT_NAMESIZE, diff --git a/usr.bin/fstat/fstat.c b/usr.bin/fstat/fstat.c index 481b6cd..eef5698 100644 --- a/usr.bin/fstat/fstat.c +++ b/usr.bin/fstat/fstat.c @@ -42,7 +42,7 @@ static const char copyright[] = static char sccsid[] = "@(#)fstat.c 8.3 (Berkeley) 5/2/95"; #endif static const char rcsid[] = - "$Id: fstat.c,v 1.14 1997/09/18 23:16:17 dima Exp $"; + "$Id: fstat.c,v 1.15 1998/05/16 21:35:37 markm Exp $"; #endif /* not lint */ #include @@ -309,8 +309,8 @@ dofiles(kp) if (p->p_fd == NULL) return; if (!KVM_READ(p->p_fd, &filed0, sizeof (filed0))) { - dprintf(stderr, "can't read filedesc at %x for pid %d\n", - p->p_fd, Pid); + dprintf(stderr, "can't read filedesc at %p for pid %d\n", + (void *)p->p_fd, Pid); return; } /* @@ -341,8 +341,8 @@ dofiles(kp) if (!KVM_READ(filed.fd_ofiles, ofiles, (filed.fd_lastfile+1) * FPSIZE)) { dprintf(stderr, - "can't read file structures at %x for pid %d\n", - filed.fd_ofiles, Pid); + "can't read file structures at %p for pid %d\n", + (void *)filed.fd_ofiles, Pid); return; } } else @@ -351,8 +351,8 @@ dofiles(kp) if (ofiles[i] == NULL) continue; if (!KVM_READ(ofiles[i], &file, sizeof (struct file))) { - dprintf(stderr, "can't read file %d at %x for pid %d\n", - i, ofiles[i], Pid); + dprintf(stderr, "can't read file %d at %p for pid %d\n", + i, (void *)ofiles[i], Pid); continue; } if (file.f_type == DTYPE_VNODE) @@ -389,8 +389,8 @@ vtrans(vp, i, flag) filename = badtype = NULL; if (!KVM_READ(vp, &vn, sizeof (struct vnode))) { - dprintf(stderr, "can't read vnode at %x for pid %d\n", - vp, Pid); + dprintf(stderr, "can't read vnode at %p for pid %d\n", + (void *)vp, Pid); return; } if (vn.v_type == VNON || vn.v_tag == VT_NON) @@ -447,7 +447,7 @@ vtrans(vp, i, flag) (void)sprintf(mode, "%o", fst.mode); else strmode(fst.mode, mode); - (void)printf(" %6d %10s", fst.fileid, mode); + (void)printf(" %6ld %10s", fst.fileid, mode); switch (vn.v_type) { case VBLK: case VCHR: { @@ -482,8 +482,8 @@ ufs_filestat(vp, fsp) struct inode inode; if (!KVM_READ(VTOI(vp), &inode, sizeof (inode))) { - dprintf(stderr, "can't read inode at %x for pid %d\n", - VTOI(vp), Pid); + dprintf(stderr, "can't read inode at %p for pid %d\n", + (void *)VTOI(vp), Pid); return 0; } fsp->fsid = inode.i_dev & 0xffff; @@ -504,8 +504,8 @@ nfs_filestat(vp, fsp) register mode_t mode; if (!KVM_READ(VTONFS(vp), &nfsnode, sizeof (nfsnode))) { - dprintf(stderr, "can't read nfsnode at %x for pid %d\n", - VTONFS(vp), Pid); + dprintf(stderr, "can't read nfsnode at %p for pid %d\n", + (void *)VTONFS(vp), Pid); return 0; } fsp->fsid = nfsnode.n_vattr.va_fsid; @@ -558,7 +558,7 @@ getmnton(m) if (m == mt->m) return (mt->mntonname); if (!KVM_READ(m, &mount, sizeof(struct mount))) { - warnx("can't read mount table at %x", m); + warnx("can't read mount table at %p", (void *)m); return (NULL); } if ((mt = malloc(sizeof (struct mtab))) == NULL) @@ -583,7 +583,7 @@ pipetrans(pi, i, flag) /* fill in socket */ if (!KVM_READ(pi, &pip, sizeof(struct pipe))) { - dprintf(stderr, "can't read pipe at %x\n", pi); + dprintf(stderr, "can't read pipe at %p\n", (void *)pi); goto bad; } @@ -628,26 +628,28 @@ socktrans(sock, i) /* fill in socket */ if (!KVM_READ(sock, &so, sizeof(struct socket))) { - dprintf(stderr, "can't read sock at %x\n", sock); + dprintf(stderr, "can't read sock at %p\n", (void *)sock); goto bad; } /* fill in protosw entry */ if (!KVM_READ(so.so_proto, &proto, sizeof(struct protosw))) { - dprintf(stderr, "can't read protosw at %x", so.so_proto); + dprintf(stderr, "can't read protosw at %p", + (void *)so.so_proto); goto bad; } /* fill in domain */ if (!KVM_READ(proto.pr_domain, &dom, sizeof(struct domain))) { - dprintf(stderr, "can't read domain at %x\n", proto.pr_domain); + dprintf(stderr, "can't read domain at %p\n", + (void *)proto.pr_domain); goto bad; } if ((len = kvm_read(kd, (u_long)dom.dom_name, dname, sizeof(dname) - 1)) < 0) { - dprintf(stderr, "can't read domain name at %x\n", - dom.dom_name); + dprintf(stderr, "can't read domain name at %p\n", + (void *)dom.dom_name); dname[0] = '\0'; } else @@ -678,8 +680,8 @@ socktrans(sock, i) (char *)&inpcb, sizeof(struct inpcb)) != sizeof(struct inpcb)) { dprintf(stderr, - "can't read inpcb at %x\n", - so.so_pcb); + "can't read inpcb at %p\n", + (void *)so.so_pcb); goto bad; } printf(" %x", (int)inpcb.inp_ppcb); @@ -694,8 +696,8 @@ socktrans(sock, i) printf(" %x", (int)so.so_pcb); if (kvm_read(kd, (u_long)so.so_pcb, (char *)&unpcb, sizeof(struct unpcb)) != sizeof(struct unpcb)){ - dprintf(stderr, "can't read unpcb at %x\n", - so.so_pcb); + dprintf(stderr, "can't read unpcb at %p\n", + (void *)so.so_pcb); goto bad; } if (unpcb.unp_conn) { diff --git a/usr.bin/mail/cmd1.c b/usr.bin/mail/cmd1.c index 1f87fa8..25c08fa 100644 --- a/usr.bin/mail/cmd1.c +++ b/usr.bin/mail/cmd1.c @@ -194,7 +194,7 @@ printhead(mesg) if (mp->m_flag & MBOX) dispc = 'M'; parse(headline, &hl, pbuf); - sprintf(wcount, "%3d/%-5ld", mp->m_lines, mp->m_size); + sprintf(wcount, "%3ld/%-5ld", mp->m_lines, mp->m_size); subjlen = screenwidth - 50 - strlen(wcount); name = value("show-rcpt") != NOSTR ? skin(hfield("to", mp)) : nameof(mp, 0); diff --git a/usr.bin/mail/cmd3.c b/usr.bin/mail/cmd3.c index b4d7d44..04cecf6 100644 --- a/usr.bin/mail/cmd3.c +++ b/usr.bin/mail/cmd3.c @@ -336,7 +336,7 @@ messize(msgvec) for (ip = msgvec; *ip != 0; ip++) { mesg = *ip; mp = &message[mesg-1]; - printf("%d: %d/%ld\n", mesg, mp->m_lines, mp->m_size); + printf("%d: %ld/%ld\n", mesg, mp->m_lines, mp->m_size); } return(0); } diff --git a/usr.bin/netstat/atalk.c b/usr.bin/netstat/atalk.c index 6308e73..90ed87d 100644 --- a/usr.bin/netstat/atalk.c +++ b/usr.bin/netstat/atalk.c @@ -36,7 +36,7 @@ static char sccsid[] = "@(#)atalk.c 1.1 (Whistle) 6/6/96"; */ static const char rcsid[] = - "$Id: atalk.c,v 1.9 1997/02/22 19:56:20 peter Exp $"; + "$Id: atalk.c,v 1.10 1997/07/29 06:51:39 charnier Exp $"; #endif /* not lint */ #include @@ -240,8 +240,8 @@ atalkprotopr(off, name) first = 0; } if (Aflag) - printf("%8x ", ppcb); - printf("%-5.5s %6d %6d ", name, sockb.so_rcv.sb_cc, + printf("%8lx ", ppcb); + printf("%-5.5s %6lu %6lu ", name, sockb.so_rcv.sb_cc, sockb.so_snd.sb_cc); printf(Aflag?" %-18.18s":" %-22.22s", atalk_print( (struct sockaddr *)&ddpcb.ddp_lsat,7)); @@ -250,8 +250,9 @@ atalkprotopr(off, name) putchar('\n'); } } + #define ANY(x,y,z) \ - ((x) ? printf("\t%d %s%s%s\n",x,y,plural(x),z) : 0) + ((x) ? printf("\t%lu %s%s%s\n",x,y,plural(x),z) : 0) /* * Dump DDP statistics structure. @@ -278,6 +279,3 @@ ddp_stats(off, name) ANY(ddpstat.ddps_cantforward, "packet", " rcvd for unreachable dest "); ANY(ddpstat.ddps_nosockspace, "packet", " dropped due to no socket space "); } -#undef ANY - - diff --git a/usr.bin/netstat/if.c b/usr.bin/netstat/if.c index ca12cda..d483118 100644 --- a/usr.bin/netstat/if.c +++ b/usr.bin/netstat/if.c @@ -36,7 +36,7 @@ static char sccsid[] = "@(#)if.c 8.3 (Berkeley) 4/28/95"; */ static const char rcsid[] = - "$Id$"; + "$Id: if.c,v 1.23 1997/02/22 19:56:21 peter Exp $"; #endif /* not lint */ #include @@ -196,7 +196,7 @@ intpr(interval, ifnetaddr) char netnum[10]; *(union ipx_net *) &net = sipx->sipx_addr.x_net; - sprintf(netnum, "%lx", ntohl(net)); + sprintf(netnum, "%lx", (u_long)ntohl(net)); printf("ipx:%-8s ", netnum); /* printf("ipx:%-8s ", netname(net, 0L)); */ printf("%-15s ", diff --git a/usr.bin/netstat/inet.c b/usr.bin/netstat/inet.c index 417f7db..314ada5 100644 --- a/usr.bin/netstat/inet.c +++ b/usr.bin/netstat/inet.c @@ -36,7 +36,7 @@ static char sccsid[] = "@(#)inet.c 8.5 (Berkeley) 5/24/95"; */ static const char rcsid[] = - "$Id: inet.c,v 1.28 1998/05/19 16:00:55 pb Exp $"; + "$Id: inet.c,v 1.29 1998/06/09 04:13:01 imp Exp $"; #endif /* not lint */ #include @@ -239,8 +239,12 @@ tcp_stats(off, name) #define p(f, m) if (tcpstat.f || sflag <= 1) \ printf(m, tcpstat.f, plural(tcpstat.f)) +#define p1a(f, m) if (tcpstat.f || sflag <= 1) \ + printf(m, tcpstat.f) #define p2(f1, f2, m) if (tcpstat.f1 || tcpstat.f2 || sflag <= 1) \ printf(m, tcpstat.f1, plural(tcpstat.f1), tcpstat.f2, plural(tcpstat.f2)) +#define p2a(f1, f2, m) if (tcpstat.f1 || tcpstat.f2 || sflag <= 1) \ + printf(m, tcpstat.f1, plural(tcpstat.f1), tcpstat.f2) #define p3(f, m) if (tcpstat.f || sflag <= 1) \ printf(m, tcpstat.f, plurales(tcpstat.f)) @@ -250,7 +254,7 @@ tcp_stats(off, name) p2(tcps_sndrexmitpack, tcps_sndrexmitbyte, "\t\t%lu data packet%s (%lu byte%s) retransmitted\n"); p(tcps_mturesent, "\t\t%lu resend%s initiated by MTU discovery\n"); - p2(tcps_sndacks, tcps_delack, + p2a(tcps_sndacks, tcps_delack, "\t\t%lu ack-only packet%s (%lu delayed)\n"); p(tcps_sndurg, "\t\t%lu URG only packet%s\n"); p(tcps_sndprobe, "\t\t%lu window probe packet%s\n"); @@ -276,7 +280,7 @@ tcp_stats(off, name) p(tcps_rcvafterclose, "\t\t%lu packet%s received after close\n"); p(tcps_rcvbadsum, "\t\t%lu discarded for bad checksum%s\n"); p(tcps_rcvbadoff, "\t\t%lu discarded for bad header offset field%s\n"); - p(tcps_rcvshort, "\t\t%lu discarded because packet too short\n"); + p1a(tcps_rcvshort, "\t\t%lu discarded because packet too short\n"); p(tcps_connattempt, "\t%lu connection request%s\n"); p(tcps_accepts, "\t%lu connection accept%s\n"); p(tcps_badsyn, "\t%lu bad connection attempt%s\n"); @@ -302,7 +306,9 @@ tcp_stats(off, name) p(tcps_predack, "\t%lu correct ACK header prediction%s\n"); p(tcps_preddat, "\t%lu correct data packet header prediction%s\n"); #undef p +#undef p1a #undef p2 +#undef p2a #undef p3 } @@ -326,14 +332,17 @@ udp_stats(off, name) printf("%s:\n", name); #define p(f, m) if (udpstat.f || sflag <= 1) \ printf(m, udpstat.f, plural(udpstat.f)) +#define p1a(f, m) if (udpstat.f || sflag <= 1) \ + printf(m, udpstat.f) p(udps_ipackets, "\t%lu datagram%s received\n"); - p(udps_hdrops, "\t%lu with incomplete header\n"); - p(udps_badlen, "\t%lu with bad data length field\n"); - p(udps_badsum, "\t%lu with bad checksum\n"); - p(udps_noport, "\t%lu dropped due to no socket\n"); - p(udps_noportbcast, "\t%lu broadcast/multicast datagram%s dropped due to no socket\n"); - p(udps_fullsock, "\t%lu dropped due to full socket buffers\n"); - p(udpps_pcbhashmiss, "\t%lu not for hashed pcb\n"); + p1a(udps_hdrops, "\t%lu with incomplete header\n"); + p1a(udps_badlen, "\t%lu with bad data length field\n"); + p1a(udps_badsum, "\t%lu with bad checksum\n"); + p1a(udps_noport, "\t%lu dropped due to no socket\n"); + p(udps_noportbcast, + "\t%lu broadcast/multicast datagram%s dropped due to no socket\n"); + p1a(udps_fullsock, "\t%lu dropped due to full socket buffers\n"); + p1a(udpps_pcbhashmiss, "\t%lu not for hashed pcb\n"); delivered = udpstat.udps_ipackets - udpstat.udps_hdrops - udpstat.udps_badlen - @@ -345,6 +354,7 @@ udp_stats(off, name) printf("\t%lu delivered\n", delivered); p(udps_opackets, "\t%lu datagram%s output\n"); #undef p +#undef p1a } /* @@ -367,15 +377,17 @@ ip_stats(off, name) #define p(f, m) if (ipstat.f || sflag <= 1) \ printf(m, ipstat.f, plural(ipstat.f)) +#define p1a(f, m) if (ipstat.f || sflag <= 1) \ + printf(m, ipstat.f) p(ips_total, "\t%lu total packet%s received\n"); p(ips_badsum, "\t%lu bad header checksum%s\n"); - p(ips_toosmall, "\t%lu with size smaller than minimum\n"); - p(ips_tooshort, "\t%lu with data size < data length\n"); - p(ips_badhlen, "\t%lu with header length < data size\n"); - p(ips_badlen, "\t%lu with data length < header length\n"); - p(ips_badoptions, "\t%lu with bad options\n"); - p(ips_badvers, "\t%lu with incorrect version number\n"); + p1a(ips_toosmall, "\t%lu with size smaller than minimum\n"); + p1a(ips_tooshort, "\t%lu with data size < data length\n"); + p1a(ips_badhlen, "\t%lu with header length < data size\n"); + p1a(ips_badlen, "\t%lu with data length < header length\n"); + p1a(ips_badoptions, "\t%lu with bad options\n"); + p1a(ips_badvers, "\t%lu with incorrect version number\n"); p(ips_fragments, "\t%lu fragment%s received\n"); p(ips_fragdropped, "\t%lu fragment%s dropped (dup or out of space)\n"); p(ips_fragtimeout, "\t%lu fragment%s dropped after timeout\n"); @@ -399,6 +411,7 @@ ip_stats(off, name) p(ips_ofragments, "\t%lu fragment%s created\n"); p(ips_cantfrag, "\t%lu datagram%s that can't be fragmented\n"); #undef p +#undef p1a } static char *icmpnames[] = { @@ -450,6 +463,8 @@ icmp_stats(off, name) #define p(f, m) if (icmpstat.f || sflag <= 1) \ printf(m, icmpstat.f, plural(icmpstat.f)) +#define p1a(f, m) if (icmpstat.f || sflag <= 1) \ + printf(m, icmpstat.f) p(icps_error, "\t%lu call%s to icmp_error\n"); p(icps_oldicmp, @@ -467,8 +482,8 @@ icmp_stats(off, name) p(icps_tooshort, "\t%lu message%s < minimum length\n"); p(icps_checksum, "\t%lu bad checksum%s\n"); p(icps_badlen, "\t%lu message%s with bad length\n"); - p(icps_bmcastecho, "\t%lu multicast echo requests ignored\n"); - p(icps_bmcasttstamp, "\t%lu multicast timestamp requests ignored\n"); + p1a(icps_bmcastecho, "\t%lu multicast echo requests ignored\n"); + p1a(icps_bmcasttstamp, "\t%lu multicast timestamp requests ignored\n"); for (first = 1, i = 0; i < ICMP_MAXTYPE + 1; i++) if (icmpstat.icps_inhist[i] != 0) { if (first) { @@ -480,6 +495,7 @@ icmp_stats(off, name) } p(icps_reflect, "\t%lu message response%s generated\n"); #undef p +#undef p1a mib[3] = ICMPCTL_MASKREPL; len = sizeof i; if (sysctl(mib, 4, &i, &len, (void *)0, 0) < 0) @@ -588,8 +604,8 @@ inetname(inp) line[sizeof(line) - 1] = '\0'; } else { inp->s_addr = ntohl(inp->s_addr); -#define C(x) ((x) & 0xff) - sprintf(line, "%lu.%lu.%lu.%lu", C(inp->s_addr >> 24), +#define C(x) ((u_int)((x) & 0xff)) + sprintf(line, "%u.%u.%u.%u", C(inp->s_addr >> 24), C(inp->s_addr >> 16), C(inp->s_addr >> 8), C(inp->s_addr)); } return (line); diff --git a/usr.bin/netstat/ipx.c b/usr.bin/netstat/ipx.c index d68eae9..215cbd0 100644 --- a/usr.bin/netstat/ipx.c +++ b/usr.bin/netstat/ipx.c @@ -36,7 +36,7 @@ static char sccsid[] = "@(#)ns.c 8.1 (Berkeley) 6/6/93"; */ static const char rcsid[] = - "$Id: ipx.c,v 1.8 1997/05/10 10:03:41 jhay Exp $"; + "$Id: ipx.c,v 1.9 1997/07/29 06:51:39 charnier Exp $"; #endif /* not lint */ #include @@ -153,6 +153,7 @@ ipxprotopr(off, name) } #define ANY(x,y,z) (printf("\t%u %s%s%s\n",x,y,plural(x),z)) +#define ANYl(x,y,z) (printf("\t%lu %s%s%s\n",x,y,plural(x),z)) /* * Dump SPX statistics structure. @@ -181,58 +182,57 @@ spx_stats(off, name) ANY(spx_istat.bdreas, "packet", " dropped out of sequence"); ANY(spx_istat.lstdup, "packet", " duplicating the highest packet"); ANY(spx_istat.notyet, "packet", " refused as exceeding allocation"); - ANY(spxstat.spxs_connattempt, "connection", " initiated"); - ANY(spxstat.spxs_accepts, "connection", " accepted"); - ANY(spxstat.spxs_connects, "connection", " established"); - ANY(spxstat.spxs_drops, "connection", " dropped"); - ANY(spxstat.spxs_conndrops, "embryonic connection", " dropped"); - ANY(spxstat.spxs_closed, "connection", " closed (includes drops)"); - ANY(spxstat.spxs_segstimed, "packet", " where we tried to get rtt"); - ANY(spxstat.spxs_rttupdated, "time", " we got rtt"); - ANY(spxstat.spxs_delack, "delayed ack", " sent"); - ANY(spxstat.spxs_timeoutdrop, "connection", " dropped in rxmt timeout"); - ANY(spxstat.spxs_rexmttimeo, "retransmit timeout", ""); - ANY(spxstat.spxs_persisttimeo, "persist timeout", ""); - ANY(spxstat.spxs_keeptimeo, "keepalive timeout", ""); - ANY(spxstat.spxs_keepprobe, "keepalive probe", " sent"); - ANY(spxstat.spxs_keepdrops, "connection", " dropped in keepalive"); - ANY(spxstat.spxs_sndtotal, "total packet", " sent"); - ANY(spxstat.spxs_sndpack, "data packet", " sent"); - ANY(spxstat.spxs_sndbyte, "data byte", " sent"); - ANY(spxstat.spxs_sndrexmitpack, "data packet", " retransmitted"); - ANY(spxstat.spxs_sndrexmitbyte, "data byte", " retransmitted"); - ANY(spxstat.spxs_sndacks, "ack-only packet", " sent"); - ANY(spxstat.spxs_sndprobe, "window probe", " sent"); - ANY(spxstat.spxs_sndurg, "packet", " sent with URG only"); - ANY(spxstat.spxs_sndwinup, "window update-only packet", " sent"); - ANY(spxstat.spxs_sndctrl, "control (SYN|FIN|RST) packet", " sent"); - ANY(spxstat.spxs_sndvoid, "request", " to send a non-existant packet"); - ANY(spxstat.spxs_rcvtotal, "total packet", " received"); - ANY(spxstat.spxs_rcvpack, "packet", " received in sequence"); - ANY(spxstat.spxs_rcvbyte, "byte", " received in sequence"); - ANY(spxstat.spxs_rcvbadsum, "packet", " received with ccksum errs"); - ANY(spxstat.spxs_rcvbadoff, "packet", " received with bad offset"); - ANY(spxstat.spxs_rcvshort, "packet", " received too short"); - ANY(spxstat.spxs_rcvduppack, "duplicate-only packet", " received"); - ANY(spxstat.spxs_rcvdupbyte, "duplicate-only byte", " received"); - ANY(spxstat.spxs_rcvpartduppack, "packet", " with some duplicate data"); - ANY(spxstat.spxs_rcvpartdupbyte, "dup. byte", " in part-dup. packet"); - ANY(spxstat.spxs_rcvoopack, "out-of-order packet", " received"); - ANY(spxstat.spxs_rcvoobyte, "out-of-order byte", " received"); - ANY(spxstat.spxs_rcvpackafterwin, "packet", " with data after window"); - ANY(spxstat.spxs_rcvbyteafterwin, "byte", " rcvd after window"); - ANY(spxstat.spxs_rcvafterclose, "packet", " rcvd after 'close'"); - ANY(spxstat.spxs_rcvwinprobe, "rcvd window probe packet", ""); - ANY(spxstat.spxs_rcvdupack, "rcvd duplicate ack", ""); - ANY(spxstat.spxs_rcvacktoomuch, "rcvd ack", " for unsent data"); - ANY(spxstat.spxs_rcvackpack, "rcvd ack packet", ""); - ANY(spxstat.spxs_rcvackbyte, "byte", " acked by rcvd acks"); - ANY(spxstat.spxs_rcvwinupd, "rcvd window update packet", ""); + ANYl(spxstat.spxs_connattempt, "connection", " initiated"); + ANYl(spxstat.spxs_accepts, "connection", " accepted"); + ANYl(spxstat.spxs_connects, "connection", " established"); + ANYl(spxstat.spxs_drops, "connection", " dropped"); + ANYl(spxstat.spxs_conndrops, "embryonic connection", " dropped"); + ANYl(spxstat.spxs_closed, "connection", " closed (includes drops)"); + ANYl(spxstat.spxs_segstimed, "packet", " where we tried to get rtt"); + ANYl(spxstat.spxs_rttupdated, "time", " we got rtt"); + ANYl(spxstat.spxs_delack, "delayed ack", " sent"); + ANYl(spxstat.spxs_timeoutdrop, "connection", + " dropped in rxmt timeout"); + ANYl(spxstat.spxs_rexmttimeo, "retransmit timeout", ""); + ANYl(spxstat.spxs_persisttimeo, "persist timeout", ""); + ANYl(spxstat.spxs_keeptimeo, "keepalive timeout", ""); + ANYl(spxstat.spxs_keepprobe, "keepalive probe", " sent"); + ANYl(spxstat.spxs_keepdrops, "connection", " dropped in keepalive"); + ANYl(spxstat.spxs_sndtotal, "total packet", " sent"); + ANYl(spxstat.spxs_sndpack, "data packet", " sent"); + ANYl(spxstat.spxs_sndbyte, "data byte", " sent"); + ANYl(spxstat.spxs_sndrexmitpack, "data packet", " retransmitted"); + ANYl(spxstat.spxs_sndrexmitbyte, "data byte", " retransmitted"); + ANYl(spxstat.spxs_sndacks, "ack-only packet", " sent"); + ANYl(spxstat.spxs_sndprobe, "window probe", " sent"); + ANYl(spxstat.spxs_sndurg, "packet", " sent with URG only"); + ANYl(spxstat.spxs_sndwinup, "window update-only packet", " sent"); + ANYl(spxstat.spxs_sndctrl, "control (SYN|FIN|RST) packet", " sent"); + ANYl(spxstat.spxs_sndvoid, "request", " to send a non-existant packet"); + ANYl(spxstat.spxs_rcvtotal, "total packet", " received"); + ANYl(spxstat.spxs_rcvpack, "packet", " received in sequence"); + ANYl(spxstat.spxs_rcvbyte, "byte", " received in sequence"); + ANYl(spxstat.spxs_rcvbadsum, "packet", " received with ccksum errs"); + ANYl(spxstat.spxs_rcvbadoff, "packet", " received with bad offset"); + ANYl(spxstat.spxs_rcvshort, "packet", " received too short"); + ANYl(spxstat.spxs_rcvduppack, "duplicate-only packet", " received"); + ANYl(spxstat.spxs_rcvdupbyte, "duplicate-only byte", " received"); + ANYl(spxstat.spxs_rcvpartduppack, "packet", + " with some duplicate data"); + ANYl(spxstat.spxs_rcvpartdupbyte, "dup. byte", " in part-dup. packet"); + ANYl(spxstat.spxs_rcvoopack, "out-of-order packet", " received"); + ANYl(spxstat.spxs_rcvoobyte, "out-of-order byte", " received"); + ANYl(spxstat.spxs_rcvpackafterwin, "packet", " with data after window"); + ANYl(spxstat.spxs_rcvbyteafterwin, "byte", " rcvd after window"); + ANYl(spxstat.spxs_rcvafterclose, "packet", " rcvd after 'close'"); + ANYl(spxstat.spxs_rcvwinprobe, "rcvd window probe packet", ""); + ANYl(spxstat.spxs_rcvdupack, "rcvd duplicate ack", ""); + ANYl(spxstat.spxs_rcvacktoomuch, "rcvd ack", " for unsent data"); + ANYl(spxstat.spxs_rcvackpack, "rcvd ack packet", ""); + ANYl(spxstat.spxs_rcvackbyte, "byte", " acked by rcvd acks"); + ANYl(spxstat.spxs_rcvwinupd, "rcvd window update packet", ""); } -#undef ANY -#define ANY(x,y,z) (printf("\t%u %s%s%s\n",x,y,plural(x),z)) - /* * Dump IPX statistics structure. */ @@ -247,17 +247,17 @@ ipx_stats(off, name) return; kread(off, (char *)&ipxstat, sizeof (ipxstat)); printf("%s:\n", name); - ANY(ipxstat.ipxs_total, "total packet", " received"); - ANY(ipxstat.ipxs_badsum, "packet", " with bad checksums"); - ANY(ipxstat.ipxs_tooshort, "packet", " smaller than advertised"); - ANY(ipxstat.ipxs_toosmall, "packet", " smaller than a header"); - ANY(ipxstat.ipxs_forward, "packet", " forwarded"); - ANY(ipxstat.ipxs_cantforward, "packet", " not forwardable"); - ANY(ipxstat.ipxs_delivered, "packet", " for this host"); - ANY(ipxstat.ipxs_localout, "packet", " sent from this host"); - ANY(ipxstat.ipxs_odropped, "packet", " dropped due to no bufs, etc."); - ANY(ipxstat.ipxs_noroute, "packet", " discarded due to no route"); - ANY(ipxstat.ipxs_mtutoosmall, "packet", " too big"); + ANYl(ipxstat.ipxs_total, "total packet", " received"); + ANYl(ipxstat.ipxs_badsum, "packet", " with bad checksums"); + ANYl(ipxstat.ipxs_tooshort, "packet", " smaller than advertised"); + ANYl(ipxstat.ipxs_toosmall, "packet", " smaller than a header"); + ANYl(ipxstat.ipxs_forward, "packet", " forwarded"); + ANYl(ipxstat.ipxs_cantforward, "packet", " not forwardable"); + ANYl(ipxstat.ipxs_delivered, "packet", " for this host"); + ANYl(ipxstat.ipxs_localout, "packet", " sent from this host"); + ANYl(ipxstat.ipxs_odropped, "packet", " dropped due to no bufs, etc."); + ANYl(ipxstat.ipxs_noroute, "packet", " discarded due to no route"); + ANYl(ipxstat.ipxs_mtutoosmall, "packet", " too big"); } static struct { diff --git a/usr.bin/netstat/mbuf.c b/usr.bin/netstat/mbuf.c index 1e6d860..5ea7423 100644 --- a/usr.bin/netstat/mbuf.c +++ b/usr.bin/netstat/mbuf.c @@ -36,7 +36,7 @@ static char sccsid[] = "@(#)mbuf.c 8.1 (Berkeley) 6/6/93"; #endif static const char rcsid[] = - "$Id: mbuf.c,v 1.10 1998/04/24 04:30:27 dg Exp $"; + "$Id: mbuf.c,v 1.11 1998/05/15 20:19:18 wollman Exp $"; #endif /* not lint */ #include @@ -130,7 +130,7 @@ mbpr() totmbufs = 0; for (mp = mbtypes; mp->mt_name; mp++) totmbufs += mbstat.m_mtypes[mp->mt_type]; - printf("%u/%u mbufs in use:\n", totmbufs, mbstat.m_mbufs); + printf("%u/%lu mbufs in use:\n", totmbufs, mbstat.m_mbufs); for (mp = mbtypes; mp->mt_name; mp++) if (mbstat.m_mtypes[mp->mt_type]) { seen[mp->mt_type] = YES; @@ -143,8 +143,9 @@ mbpr() printf("\t%u mbufs allocated to \n", mbstat.m_mtypes[i], i); } - printf("%lu/%lu/%lu mbuf clusters in use (current/peak/max)\n", - mbstat.m_clusters - mbstat.m_clfree, mbstat.m_clusters, nmbclusters); + printf("%lu/%lu/%u mbuf clusters in use (current/peak/max)\n", + mbstat.m_clusters - mbstat.m_clfree, mbstat.m_clusters, + nmbclusters); totmem = mbstat.m_mbufs * MSIZE + mbstat.m_clusters * MCLBYTES; totfree = mbstat.m_clfree * MCLBYTES + MSIZE * (mbstat.m_mbufs - totmbufs); diff --git a/usr.bin/netstat/unix.c b/usr.bin/netstat/unix.c index 136a1b6..5f11ba9 100644 --- a/usr.bin/netstat/unix.c +++ b/usr.bin/netstat/unix.c @@ -36,7 +36,7 @@ static char sccsid[] = "@(#)unix.c 8.1 (Berkeley) 6/6/93"; #endif static const char rcsid[] = - "$Id: unix.c,v 1.7 1998/05/16 08:31:49 ache Exp $"; + "$Id: unix.c,v 1.8 1998/05/16 18:04:00 wollman Exp $"; #endif /* not lint */ /* @@ -154,7 +154,7 @@ unixdomainpr(xunp, so) (long)unp->unp_refs.lh_first, (long)unp->unp_reflink.le_next); if (sa) printf(" %.*s", - sa->sun_len - offsetof(struct sockaddr_un, sun_path), + (int)(sa->sun_len - offsetof(struct sockaddr_un, sun_path)), sa->sun_path); putchar('\n'); } diff --git a/usr.bin/ranlib/touch.c b/usr.bin/ranlib/touch.c index 93670b3..bfb10f7 100644 --- a/usr.bin/ranlib/touch.c +++ b/usr.bin/ranlib/touch.c @@ -39,7 +39,7 @@ static char sccsid[] = "@(#)touch.c 8.1 (Berkeley) 6/6/93"; #endif static const char rcsid[] = - "$Id$"; + "$Id: touch.c,v 1.4 1997/08/04 06:48:25 charnier Exp $"; #endif /* not lint */ #include @@ -89,7 +89,7 @@ settime(afd) size = SARMAG + sizeof(hdr->ar_name); if (lseek(afd, size, SEEK_SET) == (off_t)-1) error(archive); - (void)sprintf(buf, "%-12ld", time((time_t *)NULL) + RANLIBSKEW); + (void)sprintf(buf, "%-12ld", (long)time((time_t *)NULL) + RANLIBSKEW); if (write(afd, buf, sizeof(hdr->ar_date)) != sizeof(hdr->ar_date)) error(archive); } diff --git a/usr.bin/size/size.c b/usr.bin/size/size.c index 50fc314..69322d3 100644 --- a/usr.bin/size/size.c +++ b/usr.bin/size/size.c @@ -42,7 +42,7 @@ static const char copyright[] = static char sccsid[] = "@(#)size.c 8.2 (Berkeley) 12/9/93"; #endif static const char rcsid[] = - "$Id$"; + "$Id: size.c,v 1.3 1997/08/11 07:28:19 charnier Exp $"; #endif /* not lint */ #include @@ -109,8 +109,8 @@ show(count, name) (void)printf("text\tdata\tbss\tdec\thex\n"); } total = head.a_text + head.a_data + head.a_bss; - (void)printf("%lu\t%lu\t%lu\t%lu\t%lx", head.a_text, head.a_data, - head.a_bss, total, total); + (void)printf("%lu\t%lu\t%lu\t%lu\t%lx", (u_long)head.a_text, + (u_long)head.a_data, (u_long)head.a_bss, total, total); if (count > 1) (void)printf("\t%s", name); (void)printf("\n"); diff --git a/usr.bin/tail/reverse.c b/usr.bin/tail/reverse.c index 4b66f55..6efe193 100644 --- a/usr.bin/tail/reverse.c +++ b/usr.bin/tail/reverse.c @@ -39,7 +39,7 @@ static char sccsid[] = "@(#)reverse.c 8.1 (Berkeley) 6/6/93"; #endif static const char rcsid[] = - "$Id$"; + "$Id: reverse.c,v 1.7 1997/08/13 06:46:56 charnier Exp $"; #endif /* not lint */ #include @@ -228,7 +228,7 @@ r_buf(fp) } if (enomem) { - warnx("warning: %ld bytes discarded", enomem); + warnx("warning: %qd bytes discarded", enomem); rval = 1; } diff --git a/usr.bin/talk/ctl.c b/usr.bin/talk/ctl.c index 52a986f..f4cdcd1 100644 --- a/usr.bin/talk/ctl.c +++ b/usr.bin/talk/ctl.c @@ -36,7 +36,7 @@ static char sccsid[] = "@(#)ctl.c 8.1 (Berkeley) 6/6/93"; #endif static const char rcsid[] = - "$Id$"; + "$Id: ctl.c,v 1.4 1998/01/14 07:20:59 charnier Exp $"; #endif /* not lint */ /* @@ -110,7 +110,7 @@ print_addr(addr) int i; printf("addr = %lx, port = %o, family = %o zero = ", - addr.sin_addr.s_addr, addr.sin_port, addr.sin_family); + (u_long)addr.sin_addr.s_addr, addr.sin_port, addr.sin_family); for (i = 0; i<8;i++) printf("%o ", (int)addr.sin_zero[i]); putchar('\n'); diff --git a/usr.bin/telnet/telnet.c b/usr.bin/telnet/telnet.c index 9569bbd..5057969 100644 --- a/usr.bin/telnet/telnet.c +++ b/usr.bin/telnet/telnet.c @@ -848,7 +848,7 @@ suboption() TerminalSpeeds(&ispeed, &ospeed); - sprintf((char *)temp, "%c%c%c%c%d,%d%c%c", IAC, SB, TELOPT_TSPEED, + sprintf((char *)temp, "%c%c%c%c%ld,%ld%c%c", IAC, SB, TELOPT_TSPEED, TELQUAL_IS, ospeed, ispeed, IAC, SE); len = strlen((char *)temp+4) + 4; /* temp[3] is 0 ... */ diff --git a/usr.bin/truss/amd64-fbsd32.c b/usr.bin/truss/amd64-fbsd32.c index 2a88655..3096c82 100644 --- a/usr.bin/truss/amd64-fbsd32.c +++ b/usr.bin/truss/amd64-fbsd32.c @@ -31,7 +31,7 @@ #ifndef lint static const char rcsid[] = - "$Id: i386-fbsd.c,v 1.4 1998/01/09 00:39:07 sef Exp $"; + "$Id: i386-fbsd.c,v 1.5 1998/01/09 09:31:40 sef Exp $"; #endif /* not lint */ /* @@ -269,7 +269,7 @@ i386_syscall_exit(int pid, int syscall) { if (!sc) { for (i = 0; i < fsc.nargs; i++) { fsc.s_args[i] = malloc(12); - sprintf(fsc.s_args[i], "0x%x", fsc.args[i]); + sprintf(fsc.s_args[i], "0x%lx", fsc.args[i]); } } else { /* @@ -285,7 +285,7 @@ i386_syscall_exit(int pid, int syscall) { */ if (errorp) { temp = malloc(12); - sprintf(temp, "0x%x", fsc.args[sc->args[i].offset]); + sprintf(temp, "0x%lx", fsc.args[sc->args[i].offset]); } else { temp = print_arg(Procfd, &sc->args[i], fsc.args); } diff --git a/usr.bin/truss/amd64-linux32.c b/usr.bin/truss/amd64-linux32.c index 8052f1c..2d334ba 100644 --- a/usr.bin/truss/amd64-linux32.c +++ b/usr.bin/truss/amd64-linux32.c @@ -31,7 +31,7 @@ #ifndef lint static const char rcsid[] = - "$Id: i386-linux.c,v 1.4 1998/01/09 00:39:10 sef Exp $"; + "$Id: i386-linux.c,v 1.5 1998/01/09 09:31:42 sef Exp $"; #endif /* not lint */ /* @@ -222,7 +222,7 @@ i386_linux_syscall_exit(int pid, int syscall) { if (!sc) { for (i = 0; i < lsc.nargs; i++) { lsc.s_args[i] = malloc(12); - sprintf(lsc.s_args[i], "0x%x", lsc.args[i]); + sprintf(lsc.s_args[i], "0x%lx", lsc.args[i]); } } else { for (i = 0; i < sc->nargs; i++) { @@ -230,7 +230,7 @@ i386_linux_syscall_exit(int pid, int syscall) { if (sc->args[i].type & OUT) { if (errorp) { temp = malloc(12); - sprintf(temp, "0x%x", lsc.args[sc->args[i].offset]); + sprintf(temp, "0x%lx", lsc.args[sc->args[i].offset]); } else { temp = print_arg(Procfd, &sc->args[i], lsc.args); } diff --git a/usr.bin/truss/i386-fbsd.c b/usr.bin/truss/i386-fbsd.c index 2a88655..3096c82 100644 --- a/usr.bin/truss/i386-fbsd.c +++ b/usr.bin/truss/i386-fbsd.c @@ -31,7 +31,7 @@ #ifndef lint static const char rcsid[] = - "$Id: i386-fbsd.c,v 1.4 1998/01/09 00:39:07 sef Exp $"; + "$Id: i386-fbsd.c,v 1.5 1998/01/09 09:31:40 sef Exp $"; #endif /* not lint */ /* @@ -269,7 +269,7 @@ i386_syscall_exit(int pid, int syscall) { if (!sc) { for (i = 0; i < fsc.nargs; i++) { fsc.s_args[i] = malloc(12); - sprintf(fsc.s_args[i], "0x%x", fsc.args[i]); + sprintf(fsc.s_args[i], "0x%lx", fsc.args[i]); } } else { /* @@ -285,7 +285,7 @@ i386_syscall_exit(int pid, int syscall) { */ if (errorp) { temp = malloc(12); - sprintf(temp, "0x%x", fsc.args[sc->args[i].offset]); + sprintf(temp, "0x%lx", fsc.args[sc->args[i].offset]); } else { temp = print_arg(Procfd, &sc->args[i], fsc.args); } diff --git a/usr.bin/truss/i386-linux.c b/usr.bin/truss/i386-linux.c index 8052f1c..2d334ba 100644 --- a/usr.bin/truss/i386-linux.c +++ b/usr.bin/truss/i386-linux.c @@ -31,7 +31,7 @@ #ifndef lint static const char rcsid[] = - "$Id: i386-linux.c,v 1.4 1998/01/09 00:39:10 sef Exp $"; + "$Id: i386-linux.c,v 1.5 1998/01/09 09:31:42 sef Exp $"; #endif /* not lint */ /* @@ -222,7 +222,7 @@ i386_linux_syscall_exit(int pid, int syscall) { if (!sc) { for (i = 0; i < lsc.nargs; i++) { lsc.s_args[i] = malloc(12); - sprintf(lsc.s_args[i], "0x%x", lsc.args[i]); + sprintf(lsc.s_args[i], "0x%lx", lsc.args[i]); } } else { for (i = 0; i < sc->nargs; i++) { @@ -230,7 +230,7 @@ i386_linux_syscall_exit(int pid, int syscall) { if (sc->args[i].type & OUT) { if (errorp) { temp = malloc(12); - sprintf(temp, "0x%x", lsc.args[sc->args[i].offset]); + sprintf(temp, "0x%lx", lsc.args[sc->args[i].offset]); } else { temp = print_arg(Procfd, &sc->args[i], lsc.args); } diff --git a/usr.bin/truss/main.c b/usr.bin/truss/main.c index 8c020e5..c83946a 100644 --- a/usr.bin/truss/main.c +++ b/usr.bin/truss/main.c @@ -31,7 +31,7 @@ #ifndef lint static const char rcsid[] = - "$Id: main.c,v 1.7 1998/01/05 07:30:25 charnier Exp $"; + "$Id: main.c,v 1.8 1998/01/07 06:19:50 jmg Exp $"; #endif /* not lint */ /* @@ -215,10 +215,10 @@ main(int ac, char **av) { funcs->exit_syscall(pid, pfs.val); break; case S_SIG: - fprintf(outfile, "SIGNAL %d\n", pfs.val); + fprintf(outfile, "SIGNAL %lu\n", pfs.val); break; case S_EXIT: - fprintf (outfile, "process exit, rval = %d\n", pfs.val); + fprintf (outfile, "process exit, rval = %lu\n", pfs.val); break; case S_EXEC: funcs = set_etype(); diff --git a/usr.bin/truss/syscalls.c b/usr.bin/truss/syscalls.c index 9c29d52..cf1db2c 100644 --- a/usr.bin/truss/syscalls.c +++ b/usr.bin/truss/syscalls.c @@ -31,7 +31,7 @@ #ifndef lint static const char rcsid[] = - "$Id$"; + "$Id: syscalls.c,v 1.4 1998/01/05 07:30:25 charnier Exp $"; #endif /* not lint */ /* @@ -170,15 +170,15 @@ print_arg(int fd, struct syscall_args *sc, unsigned long *args) { switch (sc->type & ARG_MASK) { case Hex: tmp = malloc(12); - sprintf(tmp, "0x%x", args[sc->offset]); + sprintf(tmp, "0x%lx", args[sc->offset]); break; case Octal: tmp = malloc(13); - sprintf(tmp, "0%o", args[sc->offset]); + sprintf(tmp, "0%lo", args[sc->offset]); break; case Int: tmp = malloc(12); - sprintf(tmp, "%d", args[sc->offset]); + sprintf(tmp, "%ld", args[sc->offset]); break; case String: { @@ -202,7 +202,7 @@ print_arg(int fd, struct syscall_args *sc, unsigned long *args) { } case Ptr: tmp = malloc(12); - sprintf(tmp, "0x%x", args[sc->offset]); + sprintf(tmp, "0x%lx", args[sc->offset]); break; case Ioctl: { @@ -211,7 +211,7 @@ print_arg(int fd, struct syscall_args *sc, unsigned long *args) { tmp = strdup(temp); else { tmp = malloc(12); - sprintf(tmp, "0x%x", args[sc->offset]); + sprintf(tmp, "0x%lx", args[sc->offset]); } } } diff --git a/usr.bin/uname/uname.c b/usr.bin/uname/uname.c index feb3c2b..68fd38b 100644 --- a/usr.bin/uname/uname.c +++ b/usr.bin/uname/uname.c @@ -110,7 +110,7 @@ main(argc, argv) len = sizeof(buf); if (sysctl(mib, 2, &buf, &len, NULL, 0) == -1) err(1, "sysctl"); - (void)printf("%s%.*s", prefix, len, buf); + (void)printf("%s%.*s", prefix, (int)len, buf); prefix = " "; } if (flags & NFLAG) { @@ -119,7 +119,7 @@ main(argc, argv) len = sizeof(buf); if (sysctl(mib, 2, &buf, &len, NULL, 0) == -1) err(1, "sysctl"); - (void)printf("%s%.*s", prefix, len, buf); + (void)printf("%s%.*s", prefix, (int)len, buf); prefix = " "; } if (flags & RFLAG) { @@ -128,7 +128,7 @@ main(argc, argv) len = sizeof(buf); if (sysctl(mib, 2, &buf, &len, NULL, 0) == -1) err(1, "sysctl"); - (void)printf("%s%.*s", prefix, len, buf); + (void)printf("%s%.*s", prefix, (int)len, buf); prefix = " "; } if (flags & VFLAG) { @@ -140,7 +140,7 @@ main(argc, argv) for (p = buf, tlen = len; tlen--; ++p) if (*p == '\n' || *p == '\t') *p = ' '; - (void)printf("%s%.*s", prefix, len, buf); + (void)printf("%s%.*s", prefix, (int)len, buf); prefix = " "; } if (flags & MFLAG) { @@ -149,7 +149,7 @@ main(argc, argv) len = sizeof(buf); if (sysctl(mib, 2, &buf, &len, NULL, 0) == -1) err(1, "sysctl"); - (void)printf("%s%.*s", prefix, len, buf); + (void)printf("%s%.*s", prefix, (int)len, buf); prefix = " "; } (void)printf("\n"); diff --git a/usr.bin/vmstat/vmstat.c b/usr.bin/vmstat/vmstat.c index d1b953e..3701ec4 100644 --- a/usr.bin/vmstat/vmstat.c +++ b/usr.bin/vmstat/vmstat.c @@ -42,7 +42,7 @@ static const char copyright[] = static char sccsid[] = "@(#)vmstat.c 8.1 (Berkeley) 6/6/93"; #endif static const char rcsid[] = - "$Id: vmstat.c,v 1.22 1997/12/05 19:28:28 bde Exp $"; + "$Id: vmstat.c,v 1.23 1998/03/07 23:40:23 dyson Exp $"; #endif /* not lint */ #include @@ -428,20 +428,25 @@ dovmstat(interval, reps) #define rate(x) (((x) + halfuptime) / uptime) /* round */ (void)printf("%8ld%6ld ", (long)pgtok(total.t_avm), (long)pgtok(total.t_free)); - (void)printf("%4lu ", rate(sum.v_vm_faults - osum.v_vm_faults)); + (void)printf("%4lu ", + (u_long)rate(sum.v_vm_faults - osum.v_vm_faults)); (void)printf("%3lu ", - rate(sum.v_reactivated - osum.v_reactivated)); - (void)printf("%3lu ", rate(sum.v_swapin + sum.v_vnodein - + (u_long)rate(sum.v_reactivated - osum.v_reactivated)); + (void)printf("%3lu ", + (u_long)rate(sum.v_swapin + sum.v_vnodein - (osum.v_swapin + osum.v_vnodein))); - (void)printf("%3lu ", rate(sum.v_swapout + sum.v_vnodeout - + (void)printf("%3lu ", + (u_long)rate(sum.v_swapout + sum.v_vnodeout - (osum.v_swapout + osum.v_vnodeout))); - (void)printf("%3lu ", rate(sum.v_tfree - osum.v_tfree)); - (void)printf("%3lu ", rate(sum.v_pdpages - osum.v_pdpages)); + (void)printf("%3lu ", + (u_long)rate(sum.v_tfree - osum.v_tfree)); + (void)printf("%3lu ", + (u_long)rate(sum.v_pdpages - osum.v_pdpages)); dkstats(); (void)printf("%4lu %4lu %3lu ", - rate(sum.v_intr - osum.v_intr), - rate(sum.v_syscall - osum.v_syscall), - rate(sum.v_swtch - osum.v_swtch)); + (u_long)rate(sum.v_intr - osum.v_intr), + (u_long)rate(sum.v_syscall - osum.v_syscall), + (u_long)rate(sum.v_swtch - osum.v_swtch)); cpustats(); (void)printf("\n"); (void)fflush(stdout); @@ -705,21 +710,21 @@ domem() int len, size, first, nkms; long totuse = 0, totfree = 0, totreq = 0; const char *name; - struct malloc_type kmemstats[200],*kmsp; + struct malloc_type kmemstats[200], *kmsp; char *kmemnames[200]; char buf[1024]; struct kmembuckets buckets[MINBUCKET + 16]; kread(X_KMEMBUCKETS, buckets, sizeof(buckets)); kread(X_KMEMSTATISTICS, &kmsp, sizeof(kmsp)); - for (nkms=0; nkms < 200 && kmsp; nkms++) { + for (nkms = 0; nkms < 200 && kmsp != NULL; nkms++) { if (sizeof(kmemstats[0]) != kvm_read(kd, (u_long)kmsp, &kmemstats[nkms], sizeof(kmemstats[0]))) - err(1,"kvm_read(%08x)", (u_long)kmsp); + err(1, "kvm_read(%p)", (void *)kmsp); if (sizeof(buf) != kvm_read(kd, (u_long)kmemstats[nkms].ks_shortdesc, buf, sizeof(buf))) - err(1,"kvm_read(%08x)", - (u_long)kmemstats[nkms].ks_shortdesc); + err(1, "kvm_read(%p)", + (void *)kmemstats[nkms].ks_shortdesc); kmemstats[nkms].ks_shortdesc = strdup(buf); kmsp = kmemstats[nkms].ks_next; } -- cgit v1.1