aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/ppp/throughput.c
diff options
context:
space:
mode:
authorBrian Somers <brian@FreeBSD.org>1998-02-10 03:23:50 +0000
committerBrian Somers <brian@FreeBSD.org>1998-02-10 03:23:50 +0000
commit85b542cf4f3d3d3338529aad0f9f006cdaeef9a8 (patch)
tree9fdd24c83a0136107bd305b7b6c3d41626e818de /usr.sbin/ppp/throughput.c
parentb77776a7f2087e0ff8b0a215e831a1ff3859081a (diff)
downloadsrc-85b542cf4f3d3d3338529aad0f9f006cdaeef9a8.tar.gz
src-85b542cf4f3d3d3338529aad0f9f006cdaeef9a8.zip
Move the terminal/diagnostic socket stuff out of main.c
and into the new `prompt.c'. struct prompt is (of course) a `sort' of descriptor.
Notes
Notes: svn path=/cvs2svn/branches/MP/; revision=33209
Diffstat (limited to 'usr.sbin/ppp/throughput.c')
-rw-r--r--usr.sbin/ppp/throughput.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/usr.sbin/ppp/throughput.c b/usr.sbin/ppp/throughput.c
index 1901b5c9de63..79a33fb4e81f 100644
--- a/usr.sbin/ppp/throughput.c
+++ b/usr.sbin/ppp/throughput.c
@@ -23,14 +23,15 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id$
+ * $Id: throughput.c,v 1.4 1997/12/21 12:11:09 brian Exp $
*/
#include <sys/param.h>
+#include <netinet/in.h>
#include <stdio.h>
+#include <termios.h>
#include <time.h>
-#include <netinet/in.h>
#include "command.h"
#include "mbuf.h"
@@ -40,6 +41,8 @@
#include "defs.h"
#include "loadalias.h"
#include "vars.h"
+#include "descriptor.h"
+#include "prompt.h"
void
throughput_init(struct pppThroughput *t)
@@ -54,22 +57,25 @@ throughput_init(struct pppThroughput *t)
}
void
-throughput_disp(struct pppThroughput *t, FILE *f)
+throughput_disp(struct pppThroughput *t)
{
int secs_up;
secs_up = t->uptime ? time(NULL) - t->uptime : 0;
- fprintf(f, "Connect time: %d secs\n", secs_up);
+ prompt_Printf(&prompt, "Connect time: %d secs\n", secs_up);
if (secs_up == 0)
secs_up = 1;
- fprintf(f, "%ld octets in, %ld octets out\n", t->OctetsIn, t->OctetsOut);
+ prompt_Printf(&prompt, "%ld octets in, %ld octets out\n",
+ t->OctetsIn, t->OctetsOut);
if (Enabled(ConfThroughput)) {
- fprintf(f, " overall %5ld bytes/sec\n",
- (t->OctetsIn+t->OctetsOut)/secs_up);
- fprintf(f, " currently %5d bytes/sec\n", t->OctetsPerSecond);
- fprintf(f, " peak %5d bytes/sec\n", t->BestOctetsPerSecond);
+ prompt_Printf(&prompt, " overall %5ld bytes/sec\n",
+ (t->OctetsIn+t->OctetsOut)/secs_up);
+ prompt_Printf(&prompt, " currently %5d bytes/sec\n", t->OctetsPerSecond);
+ prompt_Printf(&prompt, " peak %5d bytes/sec\n",
+ t->BestOctetsPerSecond);
} else
- fprintf(f, "Overall %ld bytes/sec\n", (t->OctetsIn+t->OctetsOut)/secs_up);
+ prompt_Printf(&prompt, "Overall %ld bytes/sec\n",
+ (t->OctetsIn+t->OctetsOut)/secs_up);
}