perf tools: Move get_term_dimensions from top to util.c
It is used by util/help.c so it should be a lib function and included in libperf.a. Code move only. Signed-off-by: David Ahern <dsahern@gmail.com> Link: http://lkml.kernel.org/r/1358185681-90926-1-git-send-email-dsahern@gmail.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:

کامیت شده توسط
Arnaldo Carvalho de Melo

والد
b7c14a0b6a
کامیت
2c803e5248
@@ -220,3 +220,25 @@ void dump_stack(void)
|
||||
#else
|
||||
void dump_stack(void) {}
|
||||
#endif
|
||||
|
||||
void get_term_dimensions(struct winsize *ws)
|
||||
{
|
||||
char *s = getenv("LINES");
|
||||
|
||||
if (s != NULL) {
|
||||
ws->ws_row = atoi(s);
|
||||
s = getenv("COLUMNS");
|
||||
if (s != NULL) {
|
||||
ws->ws_col = atoi(s);
|
||||
if (ws->ws_row && ws->ws_col)
|
||||
return;
|
||||
}
|
||||
}
|
||||
#ifdef TIOCGWINSZ
|
||||
if (ioctl(1, TIOCGWINSZ, ws) == 0 &&
|
||||
ws->ws_row && ws->ws_col)
|
||||
return;
|
||||
#endif
|
||||
ws->ws_row = 25;
|
||||
ws->ws_col = 80;
|
||||
}
|
||||
|
@@ -271,4 +271,7 @@ void dump_stack(void);
|
||||
|
||||
extern unsigned int page_size;
|
||||
|
||||
struct winsize;
|
||||
void get_term_dimensions(struct winsize *ws);
|
||||
|
||||
#endif
|
||||
|
مرجع در شماره جدید
Block a user