1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
|
/**************************************************************************
**************************************************************************
** **
** termstate.h terminal state functions **
** =========== **
** **
** Purpose: Provides functions to simplifify management of some **
** terminal states. **
** **
** Author: Garrett D'Amore <garrett@sciences.sdsu.edu> **
** **
** Copyright: 1994, Garrett E. D'Amore **
** **
** NO WARRANTY: This program is provided entirely without warranty. **
** The user assumes full responsibility for the use of **
** this program, and agrees to indemnify the author and **
** the copyright holder from any damage or loss that **
** may result from the use of or inability to use this **
** program. In simple language: YOU USE THIS PROGRAM **
** AT YOUR OWN RISK! **
** **
** Warning: None. **
** **
** Restrictions: None. **
** **
** Algorithm: None. **
** **
** References: None. **
** **
** File formats: None. **
** **
** Rev. History: June 4, 1994 Garrett D'Amore **
** -- Initial coding. **
** **
** Notes: None. **
** **
**************************************************************************
**************************************************************************/
/* >>>>>>>>>> Headers <<<<<<<<<< */
#if defined (SGTTY)
#include <sgtty.h>
#elif defined (SYSV_TERMIO)
#include <termio.h>
#else /* POSIX_TERMIOS */
#include <termios.h>
#endif
/* >>>>>>>>>> Types <<<<<<<<<< */
#if defined (SGTTY)
typedef struct sgttyb termstate;
#elif defined (SYSV_TERMIO)
typedef struct termio termstate;
#else /* POSIX_TERMIOS */
typedef struct termios termstate;
#endif
/* >>>>>>>>>> Prototypes <<<<<<<<<< */
/***************************************
*
* save_termstate Save terminal state.
*
* Purpose Saves the terminal state so that we can restore
* it later.
*
* Parameters fd: filedescriptor to save
* state: pointer to area to save state at
*
* Returns zero on success,
* non-zero on failure.
*
*/
int save_termstate (int fd, termstate *state);
/***************************************
*
* restore_termstate Restore terminal state.
*
* Purpose Restores a terminal state saved with
* save_termstate.
*
* Parameters fd: file descriptor associated with terminal
* state: previously saved termstate
*
* Returns zero on success,
* non-zero on error.
*
*/
int restore_termstate (int fd, termstate *state);
/***************************************
*
* raw_termstate Sets a termstate to raw mode.
*
* Purpose Modifies a termstate structure so that
* it has no ouput postprocessing.
*
* Parameters state: terminal state structure to modify
*
* Returns None.
*
*/
void raw_termstate (termstate *state);
|