version 1.90.2.6, 2005/07/24 10:22:41 |
version 1.90.2.7, 2005/07/24 10:29:36 |
|
|
/* $NetBSD$ */ |
/* $NetBSD$ */ |
|
|
/*- |
/*- |
* Copyright (c) 1996-2004 The NetBSD Foundation, Inc. |
* Copyright (c) 1996-2005 The NetBSD Foundation, Inc. |
* All rights reserved. |
* All rights reserved. |
* |
* |
* This code is derived from software contributed to The NetBSD Foundation |
* This code is derived from software contributed to The NetBSD Foundation |
Line 645 cmdscanner(void) |
|
Line 645 cmdscanner(void) |
|
fprintf(ttyout, "%s ", p); |
fprintf(ttyout, "%s ", p); |
(void)fflush(ttyout); |
(void)fflush(ttyout); |
} |
} |
if (fgets(line, sizeof(line), stdin) == NULL) { |
num = getline(stdin, line, sizeof(line), NULL); |
|
switch (num) { |
|
case -1: /* EOF */ |
|
case -2: /* error */ |
if (fromatty) |
if (fromatty) |
putc('\n', ttyout); |
putc('\n', ttyout); |
quit(0, NULL); |
quit(0, NULL); |
} |
/* NOTREACHED */ |
num = strlen(line); |
case -3: /* too long; try again */ |
if (num == 0) |
|
break; |
|
if (line[--num] == '\n') { |
|
if (num == 0) |
|
break; |
|
line[num] = '\0'; |
|
} else if (num == sizeof(line) - 2) { |
|
fputs("Sorry, input line is too long.\n", |
fputs("Sorry, input line is too long.\n", |
ttyout); |
ttyout); |
while ((ch = getchar()) != '\n' && ch != EOF) |
continue; |
/* void */; |
case 0: /* empty; try again */ |
|
continue; |
|
default: /* all ok */ |
break; |
break; |
} /* else it was a line without a newline */ |
} |
#ifndef NO_EDITCOMPLETE |
#ifndef NO_EDITCOMPLETE |
} else { |
} else { |
const char *buf; |
const char *buf; |