Bash  5.0-beta2
Bash - Bourne Again shell
winsize.c File Reference
#include "config.h"
#include <stdc.h>
#include "bashtypes.h"
#include <sys/ioctl.h>
#include <stdio.h>

Go to the source code of this file.

Macros

#define input_tty()   (shell_tty != -1) ? shell_tty : fileno (stderr)
 

Functions

void sh_set_lines_and_columns __P ((int, int))
 
void get_new_window_size (int from_sig, int *rp, int *cp)
 

Variables

int errno
 
int shell_tty
 

Macro Definition Documentation

◆ input_tty

#define input_tty ( )    (shell_tty != -1) ? shell_tty : fileno (stderr)

Definition at line 62 of file winsize.c.

Referenced by get_new_window_size().

Function Documentation

◆ __P()

void sh_set_lines_and_columns __P ( (int, int)  )

◆ get_new_window_size()

void get_new_window_size ( int  from_sig,
int *  rp,
int *  cp 
)

Definition at line 76 of file winsize.c.

References input_tty, rl_set_screen_size(), and sh_set_lines_and_columns().

Referenced by default_columns(), get_tty_state(), wait_for(), and yyparse().

79 {
80 #if defined (TIOCGWINSZ)
81  struct winsize win;
82  int tty;
83 
84  tty = input_tty ();
85  if (tty >= 0 && (ioctl (tty, TIOCGWINSZ, &win) == 0) &&
86  win.ws_row > 0 && win.ws_col > 0)
87  {
88  sh_set_lines_and_columns (win.ws_row, win.ws_col);
89 #if defined (READLINE)
90  rl_set_screen_size (win.ws_row, win.ws_col);
91  if (rp)
92  *rp = win.ws_row;
93  if (cp)
94  *cp = win.ws_col;
95 #endif
96  }
97 #endif
98 }
void rl_set_screen_size(int rows, int cols)
Definition: terminal.c:339
void sh_set_lines_and_columns()
#define input_tty()
Definition: winsize.c:62
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ errno

int errno

◆ shell_tty

int shell_tty

Definition at line 190 of file jobs.c.