version 1.18, 2000/07/07 21:15:23 |
version 1.19, 2000/07/24 04:06:12 |
|
|
#include <curses.h> /* for bool typedef */ |
#include <curses.h> /* for bool typedef */ |
#include <dump_entry.h> |
#include <dump_entry.h> |
|
|
MODULE_ID("$From: tset.c,v 0.41 2000/03/12 00:03:00 tom Exp $") |
MODULE_ID("$From: tset.c,v 0.42 2000/07/09 23:17:34 tom Exp $") |
|
|
extern char **environ; |
extern char **environ; |
|
|
|
|
{"2400", B2400}, |
{"2400", B2400}, |
{"4800", B4800}, |
{"4800", B4800}, |
{"9600", B9600}, |
{"9600", B9600}, |
|
/* sgttyb may define up to this point */ |
|
#ifdef B19200 |
{"19200", B19200}, |
{"19200", B19200}, |
|
#endif |
|
#ifdef B38400 |
{"38400", B38400}, |
{"38400", B38400}, |
|
#endif |
|
#ifdef B19200 |
{"19200", B19200}, |
{"19200", B19200}, |
|
#endif |
|
#ifdef B38400 |
{"38400", B38400}, |
{"38400", B38400}, |
|
#endif |
#ifdef B19200 |
#ifdef B19200 |
{"19200", B19200}, |
{"19200", B19200}, |
#else |
#else |
|
|
* Returns a "good" value for the erase character. This is loosely based on |
* Returns a "good" value for the erase character. This is loosely based on |
* the BSD4.4 logic. |
* the BSD4.4 logic. |
*/ |
*/ |
|
#ifdef TERMIOS |
static int |
static int |
default_erase(void) |
default_erase(void) |
{ |
{ |
|
|
|
|
return result; |
return result; |
} |
} |
|
#endif |
|
|
/* |
/* |
* Update the values of the erase, interrupt, and kill characters in 'mode'. |
* Update the values of the erase, interrupt, and kill characters in 'mode'. |
|
|
/* |
/* |
* Tell the user if a control key has been changed from the default value. |
* Tell the user if a control key has been changed from the default value. |
*/ |
*/ |
|
#ifdef TERMIOS |
static void |
static void |
report(const char *name, int which, unsigned def) |
report(const char *name, int which, unsigned def) |
{ |
{ |
#ifdef TERMIOS |
|
unsigned older, newer; |
unsigned older, newer; |
char *p; |
char *p; |
|
|
|
|
(void) fprintf(stderr, "control-%c (^%c).\n", newer, newer); |
(void) fprintf(stderr, "control-%c (^%c).\n", newer, newer); |
} else |
} else |
(void) fprintf(stderr, "%c.\n", newer); |
(void) fprintf(stderr, "%c.\n", newer); |
#endif |
|
} |
} |
|
#endif |
|
|
/* |
/* |
* Convert the obsolete argument forms into something that getopt can handle. |
* Convert the obsolete argument forms into something that getopt can handle. |
|
|
void wrtermcap (char *); |
void wrtermcap (char *); |
#endif /* __OpenBSD__ */ |
#endif /* __OpenBSD__ */ |
|
|
#ifdef TERMIOS |
if (GET_TTY(STDERR_FILENO, &mode) < 0) |
if (tcgetattr(STDERR_FILENO, &mode) < 0) |
|
failed("standard error"); |
failed("standard error"); |
|
|
oldmode = mode; |
oldmode = mode; |
|
#ifdef TERMIOS |
ospeed = cfgetospeed(&mode); |
ospeed = cfgetospeed(&mode); |
#else |
#else |
if (gtty(STDERR_FILENO, &mode) < 0) |
|
failed("standard error"); |
|
|
|
oldmode = mode; |
|
ospeed = mode.sg_ospeed; |
ospeed = mode.sg_ospeed; |
#endif |
#endif |
|
|
|
|
* If erase, kill and interrupt characters could have been |
* If erase, kill and interrupt characters could have been |
* modified and not -Q, display the changes. |
* modified and not -Q, display the changes. |
*/ |
*/ |
|
#ifdef TERMIOS |
if (!quiet) { |
if (!quiet) { |
report("Erase", VERASE, CERASE); |
report("Erase", VERASE, CERASE); |
report("Kill", VKILL, CINTR); |
report("Kill", VKILL, CINTR); |
report("Interrupt", VINTR, CKILL); |
report("Interrupt", VINTR, CKILL); |
} |
} |
|
#endif |
} |
} |
|
|
#ifdef __OpenBSD__ |
#ifdef __OpenBSD__ |