if there is no console, cngetc should act like getc and return -1
make callers aware of this in those cases where it can occur.
This commit is contained in:
parent
eb651d9f73
commit
75680b05c6
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=19268
@ -23,7 +23,7 @@
|
||||
* any improvements or extensions that they make and grant Carnegie the
|
||||
* rights to redistribute these changes.
|
||||
*
|
||||
* $Id: db_input.c,v 1.13 1996/05/08 04:28:34 gpalmer Exp $
|
||||
* $Id: db_input.c,v 1.14 1996/08/10 13:38:44 joerg Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -219,6 +219,13 @@ db_inputchar(c)
|
||||
db_lc = db_le;
|
||||
goto redraw;
|
||||
|
||||
case -1:
|
||||
/*
|
||||
* eek! the console returned eof.
|
||||
* probably that means we HAVE no console.. we should try bail
|
||||
* XXX
|
||||
*/
|
||||
c = '\r';
|
||||
case '\n':
|
||||
case '\r':
|
||||
*db_le++ = c;
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)cons.c 7.2 (Berkeley) 5/9/91
|
||||
* $Id: cons.c,v 1.47 1996/09/14 04:25:32 bde Exp $
|
||||
* $Id: cons.c,v 1.48 1996/10/16 00:19:38 julian Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -90,7 +90,7 @@ static dev_t cn_dev_t;
|
||||
SYSCTL_OPAQUE(_machdep, CPU_CONSDEV, consdev, CTLTYPE_OPAQUE|CTLFLAG_RD,
|
||||
&cn_dev_t, sizeof cn_dev_t, "T,dev_t", "");
|
||||
static int cn_mute;
|
||||
SYSCTL_INT(_kern, KERN_CONSMUTE, consmute, CTLFLAG_RW, &cn_mute, 0, "");
|
||||
SYSCTL_INT(_kern, OID_AUTO, consmute, CTLFLAG_RW, &cn_mute, 0, "");
|
||||
|
||||
int cons_unavail = 0; /* XXX:
|
||||
* physical console not available for
|
||||
@ -302,7 +302,7 @@ cngetc()
|
||||
{
|
||||
int c;
|
||||
if ((cn_tab == NULL) || cn_mute)
|
||||
return (0);
|
||||
return (-1);
|
||||
c = (*cn_tab->cn_getc)(cn_tab->cn_dev);
|
||||
if (c == '\r') c = '\n'; /* console input is always ICRNL */
|
||||
return (c);
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)swapgeneric.c 5.5 (Berkeley) 5/9/91
|
||||
* $Id: swapgeneric.c,v 1.15 1995/12/06 09:04:42 peter Exp $
|
||||
* $Id: swapgeneric.c,v 1.16 1996/06/12 15:10:30 joerg Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -190,6 +190,7 @@ void gets(cp)
|
||||
for (;;) {
|
||||
printf("%c", c = cngetc()&0177);
|
||||
switch (c) {
|
||||
case -1:
|
||||
case '\n':
|
||||
case '\r':
|
||||
*lp++ = '\0';
|
||||
|
@ -46,7 +46,7 @@
|
||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
**
|
||||
** $Id: userconfig.c,v 1.61 1996/10/20 18:35:35 phk Exp $
|
||||
** $Id: userconfig.c,v 1.62 1996/10/28 17:14:58 imp Exp $
|
||||
**/
|
||||
|
||||
/**
|
||||
@ -1358,6 +1358,7 @@ yesnocancel(char *str)
|
||||
for(;;)
|
||||
switch(getchar())
|
||||
{
|
||||
case -1:
|
||||
case 'n':
|
||||
case 'N':
|
||||
return(0);
|
||||
@ -1545,6 +1546,7 @@ editval(int x, int y, int width, int hex, int min, int max, int *val, int ro)
|
||||
VetRet(KEY_TAB); /* verify and maybe return */
|
||||
break;
|
||||
|
||||
case -1:
|
||||
case 'q':
|
||||
case 'Q':
|
||||
VetRet(KEY_EXIT);
|
||||
@ -2210,7 +2212,7 @@ visuserconfig(void)
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: userconfig.c,v 1.61 1996/10/20 18:35:35 phk Exp $
|
||||
* $Id: userconfig.c,v 1.62 1996/10/28 17:14:58 imp Exp $
|
||||
*/
|
||||
|
||||
#include "scbus.h"
|
||||
@ -2638,6 +2640,7 @@ introfunc(CmdParm *parms)
|
||||
extended = 0;
|
||||
break;
|
||||
|
||||
case -1:
|
||||
case 'Q':
|
||||
case 'q':
|
||||
clear();
|
||||
@ -2763,7 +2766,7 @@ cngets(char *input, int maxin)
|
||||
continue;
|
||||
}
|
||||
printf("%c", c);
|
||||
if ((++nchars == maxin) || (c == '\n') || (c == '\r')) {
|
||||
if ((++nchars == maxin) || (c == '\n') || (c == '\r') || ( c == -1)) {
|
||||
*input = '\0';
|
||||
break;
|
||||
}
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)kern_shutdown.c 8.3 (Berkeley) 1/21/94
|
||||
* $Id: kern_shutdown.c,v 1.7 1996/09/13 09:17:06 bde Exp $
|
||||
* $Id: kern_shutdown.c,v 1.8 1996/09/14 04:31:01 bde Exp $
|
||||
*/
|
||||
|
||||
#include "opt_ddb.h"
|
||||
@ -229,7 +229,7 @@ boot(howto)
|
||||
printf("\n");
|
||||
printf("The operating system has halted.\n");
|
||||
printf("Please press any key to reboot.\n\n");
|
||||
cngetc();
|
||||
while (cngetc() == -1); /* no console, halt means STOP HERE */
|
||||
} else {
|
||||
if (howto & RB_DUMP) {
|
||||
if (!cold) {
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)cons.c 7.2 (Berkeley) 5/9/91
|
||||
* $Id: cons.c,v 1.47 1996/09/14 04:25:32 bde Exp $
|
||||
* $Id: cons.c,v 1.48 1996/10/16 00:19:38 julian Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -90,7 +90,7 @@ static dev_t cn_dev_t;
|
||||
SYSCTL_OPAQUE(_machdep, CPU_CONSDEV, consdev, CTLTYPE_OPAQUE|CTLFLAG_RD,
|
||||
&cn_dev_t, sizeof cn_dev_t, "T,dev_t", "");
|
||||
static int cn_mute;
|
||||
SYSCTL_INT(_kern, KERN_CONSMUTE, consmute, CTLFLAG_RW, &cn_mute, 0, "");
|
||||
SYSCTL_INT(_kern, OID_AUTO, consmute, CTLFLAG_RW, &cn_mute, 0, "");
|
||||
|
||||
int cons_unavail = 0; /* XXX:
|
||||
* physical console not available for
|
||||
@ -302,7 +302,7 @@ cngetc()
|
||||
{
|
||||
int c;
|
||||
if ((cn_tab == NULL) || cn_mute)
|
||||
return (0);
|
||||
return (-1);
|
||||
c = (*cn_tab->cn_getc)(cn_tab->cn_dev);
|
||||
if (c == '\r') c = '\n'; /* console input is always ICRNL */
|
||||
return (c);
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)sysctl.h 8.1 (Berkeley) 6/2/93
|
||||
* $Id: sysctl.h,v 1.46 1996/10/07 04:32:42 pst Exp $
|
||||
* $Id: sysctl.h,v 1.47 1996/10/16 00:19:40 julian Exp $
|
||||
*/
|
||||
|
||||
#ifndef _SYS_SYSCTL_H_
|
||||
@ -77,6 +77,13 @@ struct ctlname {
|
||||
#define CTLFLAG_NOLOCK 0x20000000 /* XXX Don't Lock */
|
||||
#define CTLFLAG_ANYBODY 0x10000000 /* All users can set this var */
|
||||
|
||||
/*
|
||||
* USE THIS instead of a hardwired number from the categories below
|
||||
* to get dynamically assigned sysctl entries using the linker-set
|
||||
* technology. This is the way nearly all new sysctl variables should
|
||||
* be implimented.
|
||||
* e.g. SYSCTL_INT(_parent, OID_AUTO, name, CTLFLAG_RW, &variable, 0, "");
|
||||
*/
|
||||
#define OID_AUTO (-1)
|
||||
|
||||
#ifdef KERNEL
|
||||
@ -223,8 +230,7 @@ int sysctl_handle_opaque SYSCTL_HANDLER_ARGS;
|
||||
#define KERN_MAXSOCKBUF 31 /* int: max size of a socket buffer */
|
||||
#define KERN_PS_STRINGS 32 /* int: address of PS_STRINGS */
|
||||
#define KERN_USRSTACK 33 /* int: address of USRSTACK */
|
||||
#define KERN_CONSMUTE 34 /* Mute the console output? */
|
||||
#define KERN_MAXID 35 /* number of valid kern ids */
|
||||
#define KERN_MAXID 34 /* number of valid kern ids */
|
||||
|
||||
#define CTL_KERN_NAMES { \
|
||||
{ 0, 0 }, \
|
||||
@ -261,7 +267,6 @@ int sysctl_handle_opaque SYSCTL_HANDLER_ARGS;
|
||||
{ "maxsockbuf", CTLTYPE_INT }, \
|
||||
{ "ps_strings", CTLTYPE_INT }, \
|
||||
{ "usrstack", CTLTYPE_INT }, \
|
||||
{ "consmute", CTLTYPE_INT }, \
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user