[BACK]Return to screen.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / top

Diff for /src/usr.bin/top/screen.c between version 1.21 and 1.22

version 1.21, 2017/03/15 04:24:14 version 1.22, 2019/10/08 07:26:59
Line 46 
Line 46 
 #include <stdlib.h>  #include <stdlib.h>
 #include <term.h>  #include <term.h>
 #include <unistd.h>  #include <unistd.h>
   #include <stdbool.h>
   
 #include "top.h"  #include "top.h"
 #include "screen.h"  #include "screen.h"
 #include "layout.h"  #include "layout.h"
 #include "boolean.h"  
   
 int     screen_length, screen_width;  int     screen_length, screen_width;
 char    ch_erase, ch_kill, smart_terminal;  char    ch_erase, ch_kill, smart_terminal;
   
 static struct termios old_settings, new_settings;  static struct termios old_settings, new_settings;
 static char is_a_terminal = No;  static char is_a_terminal = false;
   
 void  void
 init_termcap(int interactive)  init_termcap(int interactive)
Line 70 
Line 70 
   
         if (!interactive) {          if (!interactive) {
                 /* pretend we have a dumb terminal */                  /* pretend we have a dumb terminal */
                 smart_terminal = No;                  smart_terminal = false;
                 return;                  return;
         }          }
         /* assume we have a smart terminal until proven otherwise */          /* assume we have a smart terminal until proven otherwise */
         smart_terminal = Yes;          smart_terminal = true;
   
         /* get the terminal name */          /* get the terminal name */
         term_name = getenv("TERM");          term_name = getenv("TERM");
Line 82 
Line 82 
         /* if there is no TERM, assume it's a dumb terminal */          /* if there is no TERM, assume it's a dumb terminal */
         /* patch courtesy of Sam Horrocks at telegraph.ics.uci.edu */          /* patch courtesy of Sam Horrocks at telegraph.ics.uci.edu */
         if (term_name == NULL) {          if (term_name == NULL) {
                 smart_terminal = No;                  smart_terminal = false;
                 return;                  return;
         }          }
   
Line 94 
Line 94 
                         warnx("no termcap entry for a `%s' terminal", term_name);                          warnx("no termcap entry for a `%s' terminal", term_name);
   
                 /* pretend it's dumb and proceed */                  /* pretend it's dumb and proceed */
                 smart_terminal = No;                  smart_terminal = false;
                 return;                  return;
         }          }
   
         /* "hardcopy" immediately indicates a very stupid terminal */          /* "hardcopy" immediately indicates a very stupid terminal */
         if (tgetflag("hc")) {          if (tgetflag("hc")) {
                 smart_terminal = No;                  smart_terminal = false;
                 return;                  return;
         }          }
   
Line 118 
Line 118 
   
         /* get necessary capabilities */          /* get necessary capabilities */
         if (tgetstr("cl", NULL) == NULL || tgetstr("cm", NULL) == NULL) {          if (tgetstr("cl", NULL) == NULL || tgetstr("cm", NULL) == NULL) {
                 smart_terminal = No;                  smart_terminal = false;
                 return;                  return;
         }          }
   
Line 131 
Line 131 
   
         /* if stdout is not a terminal, pretend we are a dumb terminal */          /* if stdout is not a terminal, pretend we are a dumb terminal */
         if (tcgetattr(STDOUT_FILENO, &old_settings) == -1)          if (tcgetattr(STDOUT_FILENO, &old_settings) == -1)
                 smart_terminal = No;                  smart_terminal = false;
 }  }
   
 void  void
Line 152 
Line 152 
                 ch_erase = old_settings.c_cc[VERASE];                  ch_erase = old_settings.c_cc[VERASE];
                 ch_kill = old_settings.c_cc[VKILL];                  ch_kill = old_settings.c_cc[VKILL];
   
                 is_a_terminal = Yes;                  is_a_terminal = true;
 #if 0  #if 0
                 /* send the termcap initialization string */                  /* send the termcap initialization string */
                 putcap(terminal_init);                  putcap(terminal_init);
Line 160 
Line 160 
         }          }
         if (!is_a_terminal) {          if (!is_a_terminal) {
                 /* not a terminal at all---consider it dumb */                  /* not a terminal at all---consider it dumb */
                 smart_terminal = No;                  smart_terminal = false;
         }          }
   
         if (smart_terminal)          if (smart_terminal)

Legend:
Removed from v.1.21  
changed lines
  Added in v.1.22