From 3dcbe7a6c18037b53c98414aa12e97f0ce5d5414 Mon Sep 17 00:00:00 2001 From: pdw <> Date: Thu, 10 Oct 2002 15:55:59 +0000 Subject: [PATCH] Updated SPEC file. Updated to version 0.8pre1. Now compiles with older libpcap (without SLL support). Further fixes to display of rates. --- CHANGES | 2 ++ Makefile | 2 +- iftop.c | 7 ++++++- iftop.spec | 12 +++++++----- ui.c | 6 +++--- 5 files changed, 19 insertions(+), 10 deletions(-) diff --git a/CHANGES b/CHANGES index f133019..00e5c42 100644 --- a/CHANGES +++ b/CHANGES @@ -6,6 +6,8 @@ $Id$ Added support for displaying port numbers Minor fix to rate display Minor fix to netmask handling (specifying /32 was broken) +Updated RPM spec file + Iain Lea 0.7 02/10/02 diff --git a/Makefile b/Makefile index 81e0dcc..88bc5c5 100644 --- a/Makefile +++ b/Makefile @@ -27,7 +27,7 @@ MANDIR = man #MANDIR = share/man # FHS-ish # You shouldn't need to change anything below this point. -VERSION = 0.7 +VERSION = 0.8pre1 CFLAGS += -g -Wall "-DIFTOP_VERSION=\"$(VERSION)\"" LDFLAGS += -g LDLIBS += -lpcap -lpthread -lcurses -lm diff --git a/iftop.c b/iftop.c index 921bb6b..10a71ed 100644 --- a/iftop.c +++ b/iftop.c @@ -346,9 +346,14 @@ void packet_init() { else if(dlt == DLT_RAW) { packet_handler = handle_raw_packet; } +/* + * SLL support not available in older libpcaps + */ +#ifdef DLT_LINUX_SLL else if(dlt == DLT_LINUX_SLL) { - packet_handler = handle_cooked_packet; + packet_handler = handle_cooked_packet; } +#endif else { fprintf(stderr, "Unsupported datalink type: %d\n" "Please email pdw@ex-parrot.com, quoting the datalink type and what you were\n" diff --git a/iftop.spec b/iftop.spec index f33ae97..6a94f0c 100644 --- a/iftop.spec +++ b/iftop.spec @@ -1,10 +1,10 @@ Summary: iftop - provides realtime bandwith usage on an interface Name: iftop -Version: 0.3 +Version: 0.8pre1 Release: 1 License: GPL Group: Applications/Internet -Source0: http://www.ex-parrot.com/~pdw/iftop/download/iftop-0.3.tar.gz +Source0: http://www.ex-parrot.com/~pdw/iftop/download/iftop-0.8pre1.tar.gz URL: http://www.ex-parrot.com/~pdw/iftop/ Buildroot: %{_tmppath}/%{name}-%{version}-%(id -u -n) Packager: Riku Meskanen @@ -29,19 +29,21 @@ make make DESTDIR=$RPM_BUILD_ROOT iftop gzip -9 iftop.8 mkdir -p ${RPM_BUILD_ROOT}%{_sbindir} ${RPM_BUILD_ROOT}%{_mandir}/man8 -install -o root -g root -m 755 iftop ${RPM_BUILD_ROOT}%{_sbindir} -install -o root -g root -m 644 iftop.8.gz ${RPM_BUILD_ROOT}%{_mandir}/man8 +install -m 755 iftop ${RPM_BUILD_ROOT}%{_sbindir} +install -m 644 iftop.8.gz ${RPM_BUILD_ROOT}%{_mandir}/man8 %clean rm -rf $RPM_BUILD_ROOT %files -%defattr(644,root,root,755) +%defattr(-,root,root) %doc README CHANGES COPYING TODO INSTALL %attr(755,root,root) %{_sbindir}/iftop %{_mandir}/man8/* %changelog +* Fri Aug 30 2002 Iain Lea +- Updated build for Red Hat 7.3 version * Sat Apr 13 2002 Riku Meskanen - Initial build for Red Hat 7.2 version diff --git a/ui.c b/ui.c index a4c10cd..40e8e39 100644 --- a/ui.c +++ b/ui.c @@ -63,11 +63,11 @@ int screen_line_compare(void* a, void* b) { } void readable_size(float n, char* buf, int bsize, int ksize, int bytes) { - if(n >= ksize * ksize) { + if(n >= 10 * ksize * ksize) { snprintf(buf, bsize, " %4.1f%s", n / (ksize * ksize), bytes ? "MB" : "M"); } - if(n >= 100 * ksize) { - snprintf(buf, bsize, " %4.0f%s", n / ksize, bytes ? "KB" : "K" ); + if(n >= ksize * ksize) { + snprintf(buf, bsize, " %4.2f%s", n / (ksize * ksize), bytes ? "MB" : "M" ); } else if(n >= ksize) { snprintf(buf, bsize, " %4.1f%s", n / ksize, bytes ? "KB" : "K" );