ncurses

Using Python subprocess.call() to launch an ncurses process

老子叫甜甜 提交于 2019-12-31 04:11:16
问题 I'm trying to call ct-ng (http://crosstool-ng.org/) from a SCons SConstruct script, so basically from Python. using the following method: ret = subprocess.call(["/mnt/build/pw_build/crosstool-ng/bin/ct-ng menuconfig"], env=env_cross,shell=True) crosstool-ng uses ncurses to present the user with a menu: Unfortunately when trying to navigate the menus I get: Using cat to display the sequences when using the arrow keys I see: :/mnt/build$ cat > /dev/null ^[OA^[OD^[OB^[OC^[OA^[OB^[OD^[OC^[OA^[OB

Using Python subprocess.call() to launch an ncurses process

ぐ巨炮叔叔 提交于 2019-12-31 04:11:11
问题 I'm trying to call ct-ng (http://crosstool-ng.org/) from a SCons SConstruct script, so basically from Python. using the following method: ret = subprocess.call(["/mnt/build/pw_build/crosstool-ng/bin/ct-ng menuconfig"], env=env_cross,shell=True) crosstool-ng uses ncurses to present the user with a menu: Unfortunately when trying to navigate the menus I get: Using cat to display the sequences when using the arrow keys I see: :/mnt/build$ cat > /dev/null ^[OA^[OD^[OB^[OC^[OA^[OB^[OD^[OC^[OA^[OB

Workaround for ncurses multi-thread read and write

牧云@^-^@ 提交于 2019-12-29 08:21:52
问题 This is what says on http://invisible-island.net/ncurses/ncurses.faq.html#multithread If you have a program which uses curses in more than one thread, you will almost certainly see odd behavior. That is because curses relies upon static variables for both input and output. Using one thread for input and other(s) for output cannot solve the problem, nor can extra screen updates help. This FAQ is not a tutorial on threaded programming. Specifically, it mentions it is not safe even if input and

Reading the Device Status Report ANSI escape sequence reply

拟墨画扇 提交于 2019-12-29 07:35:15
问题 I'm trying to retrieve the coordinates of cursor in a VT100 terminal using the following code: void getCursor(int* x, int* y) { printf("\033[6n"); scanf("\033[%d;%dR", x, y); } I'm using the following ANSI escape sequence: Device Status Report - ESC[6n Reports the cursor position to the application as (as though typed at the keyboard) ESC[n;mR, where n is the row and m is the column. The code compiles and the ANSI sequence is sent, but, upon receiving it, the terminal prints the ^[[x;yR

Statically link ncurses to program

蓝咒 提交于 2019-12-28 22:13:18
问题 I'm having some problems statically linking ncurses to one of my programs Here's a really simple sample program: #include<ncurses.h> int main(){ initscr(); printw("Hello world\n"); refresh(); getch(); endwin(); return 0; } When I compile it with gcc -static -lncurses hello_curses.c -o curses I get these errors: /tmp/ccwHJ6o1.o: In function `main': curses_hello.c:(.text+0x5): undefined reference to `initscr' curses_hello.c:(.text+0x14): undefined reference to `printw' curses_hello.c:(.text

Linux流量监控工具 - iftop (最全面的iftop教程)

流过昼夜 提交于 2019-12-28 21:25:00
在类Unix系统中可以使用top查看系统资源、进程、内存占用等信息。查看网络状态可以使用netstat、nmap等工具。若要查看实时的网络流量,监控TCP/IP连接等,则可以使用 iftop 。 一、iftop是什么? iftop 是类似于top的实时流量监控工具。 官方网站: http://www.ex-parrot.com/~pdw/iftop/ 二、iftop有什么用? iftop 可以用来监控网卡的实时流量(可以指定网段)、反向解析IP、显示端口信息等,详细的将会在后面的使用参数中说明。 三、安装iftop 安装方法1、 编译安装 如果采用编译安装可以到 iftop官网 下载最新的源码包。 安装前需要已经安装好基本的编译所需的环境,比如make、gcc、autoconf等。安装iftop还需要安装libpcap和libcurses。 CentOS上安装所需依赖包: yum install flex byacc libpcap ncurses ncurses-devel libpcap-devel Debian上安装所需依赖包: apt-get install flex byacc libpcap0.8 libncurses5 下载iftop wget http://www.ex-parrot.com/pdw/iftop/download/iftop-0.17.tar.gz

[zz]Linux流量监控工具 – iftop (最全面的iftop教程)

回眸只為那壹抹淺笑 提交于 2019-12-28 21:24:45
在类Unix系统中可以使用top查看系统资源、进程、内存占用等信息。查看网络状态可以使用netstat、nmap等工具。若要查看实时的网络流量,监控TCP/IP连接等,则可以使用 iftop 。 一、iftop是什么? iftop是类似于top的实时流量监控工具。 官方网站: http://www.ex-parrot.com/~pdw/iftop/ 二、iftop有什么用? iftop可以用来监控网卡的实时流量(可以指定网段)、反向解析IP、显示端口信息等,详细的将会在后面的使用参数中说明。 三、安装iftop 安装方法1、 编译安装 如果采用编译安装可以到 iftop官网 下载最新的源码包。 安装前需要已经安装好基本的编译所需的环境,比如make、gcc、autoconf等。安装iftop还需要安装libpcap和libcurses。 CentOS上安装所需依赖包: yum install flex byacc libpcap ncurses ncurses-devel Debian上安装所需依赖包: apt-get install flex byacc libpcap0.8 libncurses5 下载iftop wget http://www.ex-parrot.com/pdw/iftop/download/iftop-0.17.tar.gz tar zxvf iftop-0

case KEY_ENTER not functioning as expected

大憨熊 提交于 2019-12-25 17:44:13
问题 I am trying to create a program that response to keyboard input. At the moment the menu below functions correctly but upon pressing enter I am running into issues. When I press enter nothing happens. I am just wondering why this is happening? Many thanks! #include <ncurses.h> #define MENUMAX 6 void drawmenu(int item) { int c; char mainmenu[] = "Menu"; char menu[MENUMAX] [10] = { "1", "2", "3", "4", "5", "6" }; clear(); attron(A_BOLD | A_UNDERLINE); addstr(mainmenu); attroff(A_BOLD | A

How to build goncurses on os x, centos 6

北城以北 提交于 2019-12-25 07:58:49
问题 OS X, Centos 6 and Debian Squeeze all come with v5.7 of ncurses, but the go wrapper "goncurses" requires 5.9. Trying to build it on any of those platforms will give you an error like this: $ go get -v code.google.com/p/goncurses code.google.com/p/goncurses # code.google.com/p/goncurses /tmp/go-build527609801/code.google.com/p/goncurses/_obj/goncurses.o: In function 'ncurses_is_subwin':src/code.google.com/p/goncurses/goncurses.c:71: undefined reference to `is_subwin' /tmp/go-build527609801

How to keep the terminal from scrolling

亡梦爱人 提交于 2019-12-25 05:44:30
问题 I am writing a simple program in C++ to be run in a terminal window. I would like the output text to be locked in position on the screen. Instead of each new line appearing at the bottom of the screen and pushing everything up, I would like to be able to change a line of text or some characters in a line of text, while keeping other lines above and below it static. I know I have seen this done in terminal, and I believe it was done with C++, but I can't find any documentation on it. I cannot