Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/pppd/pppd Use PPPIOCGRAWIN to get the last characte...
details: https://anonhg.NetBSD.org/src/rev/f6c88e4695de
branches: trunk
changeset: 551212:f6c88e4695de
user: christos <christos%NetBSD.org@localhost>
date: Mon Sep 01 16:54:27 2003 +0000
description:
Use PPPIOCGRAWIN to get the last characters the remote sent, if we are not
8 bit clean.
diffstat:
usr.sbin/pppd/pppd/sys-bsd.c | 16 ++++++++++++++--
1 files changed, 14 insertions(+), 2 deletions(-)
diffs (46 lines):
diff -r 321545ca4562 -r f6c88e4695de usr.sbin/pppd/pppd/sys-bsd.c
--- a/usr.sbin/pppd/pppd/sys-bsd.c Mon Sep 01 16:51:25 2003 +0000
+++ b/usr.sbin/pppd/pppd/sys-bsd.c Mon Sep 01 16:54:27 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sys-bsd.c,v 1.45 2003/08/17 21:43:29 itojun Exp $ */
+/* $NetBSD: sys-bsd.c,v 1.46 2003/09/01 16:54:27 christos Exp $ */
/*
* sys-bsd.c - System-dependent procedures for setting up
@@ -79,7 +79,7 @@
#if 0
#define RCSID "Id: sys-bsd.c,v 1.47 2000/04/13 12:04:23 paulus Exp "
#else
-__RCSID("$NetBSD: sys-bsd.c,v 1.45 2003/08/17 21:43:29 itojun Exp $");
+__RCSID("$NetBSD: sys-bsd.c,v 1.46 2003/09/01 16:54:27 christos Exp $");
#endif
#endif
@@ -95,6 +95,7 @@
#include <fcntl.h>
#include <termios.h>
#include <signal.h>
+#include <vis.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/socket.h>
@@ -559,8 +560,19 @@
break;
}
if (s != NULL) {
+ struct ppp_rawin win;
+ char buf[4 * sizeof(win.buf) + 1];
+ int i;
warn("Serial link is not 8-bit clean:");
warn("All received characters had %s", s);
+ if (ioctl(ppp_fd, PPPIOCGRAWIN, &win) == -1) {
+ warn("ioctl(PPPIOCGRAWIN): %s", strerror(errno));
+ return;
+ }
+ for (i = 0; i < sizeof(win.buf); i++)
+ win.buf[i] = win.buf[i] & 0x7f;
+ strvisx(buf, (char *)win.buf, win.count, VIS_CSTYLE);
+ warn("Last %d characters were: %s", (int)win.count, buf);
}
}
}
Home |
Main Index |
Thread Index |
Old Index