Deleted Added
full compact
prompt.c (71657) prompt.c (74001)
1/*-
2 * Copyright (c) 1998 Brian Somers <brian@Awfulhak.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
1/*-
2 * Copyright (c) 1998 Brian Somers <brian@Awfulhak.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD: head/usr.sbin/ppp/prompt.c 71657 2001-01-26 01:41:34Z brian $
26 * $FreeBSD: head/usr.sbin/ppp/prompt.c 74001 2001-03-08 23:51:50Z brian $
27 */
28
29#include <sys/param.h>
30#include <netinet/in.h>
31#include <netinet/in_systm.h>
32#include <netinet/ip.h>
33#include <sys/un.h>
34

--- 39 unchanged lines hidden (view full) ---

74#include "datalink.h"
75#include "server.h"
76#include "main.h"
77
78static void
79prompt_Display(struct prompt *p)
80{
81 /* XXX: See Index2Nam() - should we only figure this out once ? */
27 */
28
29#include <sys/param.h>
30#include <netinet/in.h>
31#include <netinet/in_systm.h>
32#include <netinet/ip.h>
33#include <sys/un.h>
34

--- 39 unchanged lines hidden (view full) ---

74#include "datalink.h"
75#include "server.h"
76#include "main.h"
77
78static void
79prompt_Display(struct prompt *p)
80{
81 /* XXX: See Index2Nam() - should we only figure this out once ? */
82 static char shostname[MAXHOSTNAMELEN];
82 static char shostname[MAXHOSTNAMELEN + 1];
83 const char *pconnect, *pauth;
84
85 if (p->TermMode || !p->needprompt)
86 return;
87
88 p->needprompt = 0;
89
90 if (p->nonewline)

--- 13 unchanged lines hidden (view full) ---

104 else if (bundle_Phase(p->bundle) == PHASE_AUTHENTICATE)
105 pconnect = "Ppp";
106 else
107 pconnect = "ppp";
108
109 if (*shostname == '\0') {
110 char *dot;
111
83 const char *pconnect, *pauth;
84
85 if (p->TermMode || !p->needprompt)
86 return;
87
88 p->needprompt = 0;
89
90 if (p->nonewline)

--- 13 unchanged lines hidden (view full) ---

104 else if (bundle_Phase(p->bundle) == PHASE_AUTHENTICATE)
105 pconnect = "Ppp";
106 else
107 pconnect = "ppp";
108
109 if (*shostname == '\0') {
110 char *dot;
111
112 if (gethostname(shostname, sizeof shostname))
112 if (gethostname(shostname, sizeof shostname) || *shostname == '\0')
113 strcpy(shostname, "localhost");
114 else if ((dot = strchr(shostname, '.')))
115 *dot = '\0';
116 }
117
118 fprintf(p->Term, "%s%s%s> ", pconnect, pauth, shostname);
119 fflush(p->Term);
120}

--- 442 unchanged lines hidden ---
113 strcpy(shostname, "localhost");
114 else if ((dot = strchr(shostname, '.')))
115 *dot = '\0';
116 }
117
118 fprintf(p->Term, "%s%s%s> ", pconnect, pauth, shostname);
119 fflush(p->Term);
120}

--- 442 unchanged lines hidden ---