prompt.c (74457d3d4327f7169df5e5596a955d1862b76270) | prompt.c (5284761414ce1ef5f00cb7e3f93076682b591a5e) |
---|---|
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 --- 65 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 ? */ | 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 --- 65 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 --- |