From owner-svn-src-all@freebsd.org Sun May 20 18:11:59 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6C840EEA5C0; Sun, 20 May 2018 18:11:59 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 22678693AF; Sun, 20 May 2018 18:11:59 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0398A19D6A; Sun, 20 May 2018 18:11:59 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4KIBw9h082076; Sun, 20 May 2018 18:11:58 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4KIBwrr082075; Sun, 20 May 2018 18:11:58 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201805201811.w4KIBwrr082075@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Sun, 20 May 2018 18:11:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r333932 - head/usr.bin/top X-SVN-Group: head X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: head/usr.bin/top X-SVN-Commit-Revision: 333932 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 May 2018 18:11:59 -0000 Author: eadler Date: Sun May 20 18:11:58 2018 New Revision: 333932 URL: https://svnweb.freebsd.org/changeset/base/333932 Log: top(1): unconditionally assume we are on FreeBSD (more unifdef) Now that we're our own upstream, remove useless ifdefs. Modified: head/usr.bin/top/screen.c Modified: head/usr.bin/top/screen.c ============================================================================== --- head/usr.bin/top/screen.c Sun May 20 18:03:40 2018 (r333931) +++ head/usr.bin/top/screen.c Sun May 20 18:11:58 2018 (r333932) @@ -24,27 +24,8 @@ #include #include -#ifdef CBREAK -# include -# define SGTTY -#else -# ifdef TCGETA -# define TERMIO -# include -# else # define TERMIOS # include -# endif -#endif -#if defined(TERMIO) || defined(TERMIOS) -# ifndef TAB3 -# ifdef OXTABS -# define TAB3 OXTABS -# else -# define TAB3 0 -# endif -# endif -#endif #include #include #include "screen.h" @@ -75,23 +56,11 @@ char *end_standout; char *terminal_init; char *terminal_end; -#ifdef SGTTY -static struct sgttyb old_settings; -static struct sgttyb new_settings; -#endif -#ifdef TERMIO -static struct termio old_settings; -static struct termio new_settings; -#endif -#ifdef TERMIOS static struct termios old_settings; static struct termios new_settings; -#endif static char is_a_terminal = No; -#ifdef TOStop static int old_lword; static int new_lword; -#endif #define STDIN 0 #define STDOUT 1 @@ -217,24 +186,10 @@ int interactive; get_screensize(); /* if stdout is not a terminal, pretend we are a dumb terminal */ -#ifdef SGTTY - if (ioctl(STDOUT, TIOCGETP, &old_settings) == -1) - { - smart_terminal = No; - } -#endif -#ifdef TERMIO - if (ioctl(STDOUT, TCGETA, &old_settings) == -1) - { - smart_terminal = No; - } -#endif -#ifdef TERMIOS if (tcgetattr(STDOUT, &old_settings) == -1) { smart_terminal = No; } -#endif } void @@ -242,61 +197,6 @@ init_screen() { /* get the old settings for safe keeping */ -#ifdef SGTTY - if (ioctl(STDOUT, TIOCGETP, &old_settings) != -1) - { - /* copy the settings so we can modify them */ - new_settings = old_settings; - - /* turn on CBREAK and turn off character echo and tab expansion */ - new_settings.sg_flags |= CBREAK; - new_settings.sg_flags &= ~(ECHO|XTABS); - (void) ioctl(STDOUT, TIOCSETP, &new_settings); - - /* remember the erase and kill characters */ - ch_erase = old_settings.sg_erase; - ch_kill = old_settings.sg_kill; - -#ifdef TOStop - /* get the local mode word */ - (void) ioctl(STDOUT, TIOCLGET, &old_lword); - - /* modify it */ - new_lword = old_lword | LTOSTOP; - (void) ioctl(STDOUT, TIOCLSET, &new_lword); -#endif - /* remember that it really is a terminal */ - is_a_terminal = Yes; - - /* send the termcap initialization string */ - putcap(terminal_init); - } -#endif -#ifdef TERMIO - if (ioctl(STDOUT, TCGETA, &old_settings) != -1) - { - /* copy the settings so we can modify them */ - new_settings = old_settings; - - /* turn off ICANON, character echo and tab expansion */ - new_settings.c_lflag &= ~(ICANON|ECHO); - new_settings.c_oflag &= ~(TAB3); - new_settings.c_cc[VMIN] = 1; - new_settings.c_cc[VTIME] = 0; - (void) ioctl(STDOUT, TCSETA, &new_settings); - - /* remember the erase and kill characters */ - ch_erase = old_settings.c_cc[VERASE]; - ch_kill = old_settings.c_cc[VKILL]; - - /* remember that it really is a terminal */ - is_a_terminal = Yes; - - /* send the termcap initialization string */ - putcap(terminal_init); - } -#endif -#ifdef TERMIOS if (tcgetattr(STDOUT, &old_settings) != -1) { /* copy the settings so we can modify them */ @@ -319,7 +219,6 @@ init_screen() /* send the termcap initialization string */ putcap(terminal_init); } -#endif if (!is_a_terminal) { @@ -344,18 +243,7 @@ end_screen() /* if we have settings to reset, then do so */ if (is_a_terminal) { -#ifdef SGTTY - (void) ioctl(STDOUT, TIOCSETP, &old_settings); -#ifdef TOStop - (void) ioctl(STDOUT, TIOCLSET, &old_lword); -#endif -#endif -#ifdef TERMIO - (void) ioctl(STDOUT, TCSETA, &old_settings); -#endif -#ifdef TERMIOS (void) tcsetattr(STDOUT, TCSADRAIN, &old_settings); -#endif } } @@ -366,18 +254,7 @@ reinit_screen() /* install our settings if it is a terminal */ if (is_a_terminal) { -#ifdef SGTTY - (void) ioctl(STDOUT, TIOCSETP, &new_settings); -#ifdef TOStop - (void) ioctl(STDOUT, TIOCLSET, &new_lword); -#endif -#endif -#ifdef TERMIO - (void) ioctl(STDOUT, TCSETA, &new_settings); -#endif -#ifdef TERMIOS (void) tcsetattr(STDOUT, TCSADRAIN, &new_settings); -#endif } /* send init string */ @@ -392,7 +269,6 @@ get_screensize() { -#ifdef TIOCGWINSZ struct winsize ws; @@ -408,25 +284,6 @@ get_screensize() } } -#else -#ifdef TIOCGSIZE - - struct ttysize ts; - - if (ioctl (1, TIOCGSIZE, &ts) != -1) - { - if (ts.ts_lines != 0) - { - screen_length = ts.ts_lines; - } - if (ts.ts_cols != 0) - { - screen_width = ts.ts_cols - 1; - } - } - -#endif /* TIOCGSIZE */ -#endif /* TIOCGWINSZ */ (void) strncpy(lower_left, tgoto(cursor_motion, 0, screen_length - 1), sizeof(lower_left) - 1);