summaryrefslogtreecommitdiff
path: root/net/pload/files/patch-pload.c
diff options
context:
space:
mode:
authorPav Lucistnik <pav@FreeBSD.org>2004-10-18 20:41:21 +0000
committerPav Lucistnik <pav@FreeBSD.org>2004-10-18 20:41:21 +0000
commitf30d42f081c8da76bb6f987d8cd65ace1c12d879 (patch)
tree29f44a3195e43faad673362f872c0689194633dc /net/pload/files/patch-pload.c
parentDocument NTLM authentication vulnerability in squid (diff)
Add pload, an X11 program to monitor network device statistics.
It graphs information using Athena stripchart widgets. PR: ports/72013 Submitted by: J.R. Oldroyd <fbsd@opal.com>
Notes
Notes: svn path=/head/; revision=119743
Diffstat (limited to 'net/pload/files/patch-pload.c')
-rw-r--r--net/pload/files/patch-pload.c73
1 files changed, 73 insertions, 0 deletions
diff --git a/net/pload/files/patch-pload.c b/net/pload/files/patch-pload.c
new file mode 100644
index 000000000000..0fb88df906b1
--- /dev/null
+++ b/net/pload/files/patch-pload.c
@@ -0,0 +1,73 @@
+diff -c pload.c.orig pload.c
+*** pload.c.orig Tue Feb 1 02:11:24 2000
+--- pload.c Wed Sep 22 13:13:46 2004
+***************
+*** 596,608 ****
+ void do_total(char *b, double total)
+ {
+ if (total < 1024.0)
+! sprintf(b, "%s%0.0f b", b, total);
+ else if (total < (1024.0*1024.0))
+! sprintf(b, "%s%0.2f k", b, total/1024.0);
+ else if (total < (1024.0*1024.0*1024.0))
+! sprintf(b, "%s%0.2f M", b, total/1024.0/1024.0);
+ else
+! sprintf(b, "%s%0.2f G", b, total/1024.0/1024.0/1024.0);
+
+ return;
+ }
+--- 596,608 ----
+ void do_total(char *b, double total)
+ {
+ if (total < 1024.0)
+! sprintf(b, "%s%0.0f B", b, total);
+ else if (total < (1024.0*1024.0))
+! sprintf(b, "%s%0.2f kB", b, total/1024.0);
+ else if (total < (1024.0*1024.0*1024.0))
+! sprintf(b, "%s%0.2f MB", b, total/1024.0/1024.0);
+ else
+! sprintf(b, "%s%0.2f GB", b, total/1024.0/1024.0/1024.0);
+
+ return;
+ }
+***************
+*** 610,622 ****
+ void do_rate(char *b, double rate)
+ {
+ if (rate < 1024.0)
+! sprintf(b, "%s%0.0f b/s",b, rate);
+ else if (rate < (1024.0*1024.0))
+! sprintf(b, "%s%0.2f k/s",b, rate/1024.0);
+ else if (rate < (1024.0*1024.0*1024.0))
+! sprintf(b, "%s%0.2f M/s",b, rate/1024.0/1024.0);
+ else
+! sprintf(b, "%s%0.2f G/s", b, rate/1024.0/1024.0/1024.0);
+ return;
+ }
+
+--- 610,622 ----
+ void do_rate(char *b, double rate)
+ {
+ if (rate < 1024.0)
+! sprintf(b, "%s%0.0f B/s",b, rate);
+ else if (rate < (1024.0*1024.0))
+! sprintf(b, "%s%0.2f kB/s",b, rate/1024.0);
+ else if (rate < (1024.0*1024.0*1024.0))
+! sprintf(b, "%s%0.2f MB/s",b, rate/1024.0/1024.0);
+ else
+! sprintf(b, "%s%0.2f GB/s", b, rate/1024.0/1024.0/1024.0);
+ return;
+ }
+
+***************
+*** 643,648 ****
+--- 643,651 ----
+ break;
+ case 'M':
+ do_rate(buff, max);
++ break;
++ case 'd':
++ sprintf(buff, "%s", resources.device);
+ break;
+ case '%': /* literal % */
+ i = strlen(buff);