Changeset 8084ce80 in rtems


Ignore:
Timestamp:
Jul 10, 2008, 6:04:19 AM (11 years ago)
Author:
Thomas Doerfler <Thomas.Doerfler@…>
Branches:
4.10, 4.11, 4.9, master
Children:
3210dcb
Parents:
7c007cf
Message:

Restore terminal settings on exit.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libmisc/shell/shell.c

    r7c007cf r8084ce80  
    665665  rtems_status_code  sc;
    666666  struct termios     term;
     667  struct termios     previous_term;
    667668  char              *prompt = NULL;
    668669  int                cmd;
     
    741742  else {
    742743    /* make a raw terminal,Linux Manuals */
    743     if (tcgetattr(fileno(stdin), &term) >= 0) {
     744    if (tcgetattr(fileno(stdin), &previous_term) >= 0) {
     745      term = previous_term;
    744746      term.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON);
    745747      term.c_oflag &= ~OPOST;
     
    914916    free (cmd_argv);
    915917 
    916   if ( stdinToClose )
     918  if (stdinToClose) {
    917919    fclose( stdinToClose );
     920  } else {
     921    if (tcsetattr( fileno( stdin), TCSADRAIN, &previous_term) < 0) {
     922      fprintf(
     923        stderr,
     924        "shell: cannot reset terminal attributes (%s)\n",
     925        shell_env->devname
     926      );
     927    }
     928  }
    918929  if ( stdoutToClose )
    919930    fclose( stdoutToClose );
Note: See TracChangeset for help on using the changeset viewer.