From 1f683b526329e503fa3e8bfc25e2baf56c12037e Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Sun, 17 Jul 2005 20:08:56 +0000 Subject: rev 1.52 Show the port number (tty slot, pppoe session id etc) under ``show physical''. From brian FreeBSD --- usr.sbin/ppp/ppp/physical.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/usr.sbin/ppp/ppp/physical.c b/usr.sbin/ppp/ppp/physical.c index 045eb6a4000..7634c8fe980 100644 --- a/usr.sbin/ppp/ppp/physical.c +++ b/usr.sbin/ppp/ppp/physical.c @@ -16,7 +16,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $OpenBSD: physical.c,v 1.38 2005/07/17 19:13:25 brad Exp $ + * $OpenBSD: physical.c,v 1.39 2005/07/17 20:08:55 brad Exp $ * */ @@ -444,16 +444,25 @@ physical_ShowStatus(struct cmdargs const *arg) struct physical *p = arg->cx->physical; struct cd *cd; const char *dev; - int n; + int n, slot; prompt_Printf(arg->prompt, "Name: %s\n", p->link.name); prompt_Printf(arg->prompt, " State: "); if (p->fd < 0) prompt_Printf(arg->prompt, "closed\n"); - else if (p->handler && p->handler->openinfo) - prompt_Printf(arg->prompt, "open (%s)\n", (*p->handler->openinfo)(p)); - else - prompt_Printf(arg->prompt, "open\n"); + else { + slot = physical_Slot(p); + if (p->handler && p->handler->openinfo) { + if (slot == -1) + prompt_Printf(arg->prompt, "open (%s)\n", (*p->handler->openinfo)(p)); + else + prompt_Printf(arg->prompt, "open (%s, port %d)\n", + (*p->handler->openinfo)(p), slot); + } else if (slot == -1) + prompt_Printf(arg->prompt, "open\n"); + else + prompt_Printf(arg->prompt, "open (port %d)\n", slot); + } prompt_Printf(arg->prompt, " Device: %s", *p->name.full ? p->name.full : -- cgit v1.2.3