{"id":208582,"date":"2014-01-10T02:00:03","date_gmt":"2014-01-09T22:00:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=208582"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=208582","title":{"rendered":"<span class=\"post_title\">\u0422\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u0447.2. \u0412\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t\u0418\u0442\u0430\u043a, \u0432\u0442\u043e\u0440\u0430\u044f \u0447\u0430\u0441\u0442\u044c. \u0417\u0434\u0435\u0441\u044c \u044f \u0440\u0430\u0441\u043a\u0440\u043e\u044e \u043a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u0430 \u0442\u0430\u043a \u0436\u0435 \u043e \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0438 \u044d\u0442\u0438\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438. \u0422\u0443\u0442 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0442\u0440\u043e\u043d\u0443\u0442\u044c \u0432\u043e\u043f\u0440\u043e\u0441, \u043f\u043e\u0434\u043d\u044f\u0442\u044b\u0439 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445 \u043a \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c\u0443 <a href=\"http:\/\/habrahabr.ru\/post\/205222\/\">\u043f\u043e\u0441\u0442\u0443<\/a> \u2014 \u00ab\u0410 \u0437\u0430\u0447\u0435\u043c \u044d\u0442\u043e \u0432\u0441\u0435 \u043d\u0443\u0436\u043d\u043e?\u00bb. \u041f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0442\u0430\u043a\u0438\u0445 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432 \u0432 21-\u043c \u0432\u0435\u043a\u0435 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0430\u043f\u043b\u0430\u044f\u043d\u0441\u044b \u043d\u0430 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043c\u0430\u0448\u0438\u043d\u0430\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0442 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b. \u0427\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u043e\u043d\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0438\u0437 \u0441\u0435\u0431\u044f \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0434\u0438\u0441\u0442\u0440\u0438\u0431\u0443\u0442\u0438\u0432 Linux \u0438\u043b\u0438 \u043d\u0430\u0431\u043e\u0440 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c\u043e\u0435 \u044f\u0434\u0440\u043e + busybox. \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0442\u0430\u043a\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u043a\u0438\u0439 \u0444\u0440\u043e\u043d\u0442\u044d\u043d\u0434 \u0434\u043b\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u0430, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0439 \u043e\u0434\u043d\u0438\u043c \u0432\u0437\u0433\u043b\u044f\u0434\u043e\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0443\u0437\u043b\u043e\u0432 \u0438\u043b\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043d\u0435\u043a\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0432 \u0443\u0434\u043e\u0431\u043d\u043e\u0439 \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0444\u043e\u0440\u043c\u0435. \u041f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0437\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u0444\u0440\u043e\u043d\u0442\u044d\u043d\u0434\u044b \u0443 VMware ESXi (vDirector, vCenter etc), Citrix Xen, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043e\u0447\u0435\u0442\u0430\u044e\u0442 \u043a\u0430\u043a \u043c\u043e\u0449\u044c web-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430, \u0442\u0430\u043a \u0438 TUI \u043a\u0430\u043a \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0438\/\u0438\u043b\u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438\/\u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u043a\u0438. \u041f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u044f\u0441\u044c \u043f\u043e \u0434\u0435\u0441\u044f\u0442\u043a\u0430\u043c \u043c\u0430\u0448\u0438\u043d \u043c\u043e\u0436\u043d\u043e \u043e\u0434\u043d\u0438\u043c \u0432\u0437\u0433\u043b\u044f\u0434\u043e\u043c \u0443\u0432\u0438\u0434\u0435\u0442\u044c, \u0432\u0441\u0435 \u043b\u0438 \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u0438\u043b\u0438 \u0431\u044b\u0441\u0442\u0440\u043e \u0443\u0437\u043d\u0430\u0442\u044c IP \u0430\u0434\u0440\u0435\u0441, \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u0432 \u044e\u0437\u0435\u0440\u0443 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043a\u043e\u043d\u0441\u043e\u043b\u0438, \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044f \u0435\u043c\u0443 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e, \u0447\u0442\u043e \u0435\u043c\u0443 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0437\u043d\u0430\u0442\u044c (foolproof).<br \/>  <img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/08b\/38f\/2a8\/08b38f2a85b1390bc99c4f32eefcdca2.gif\"\/><br \/>  <a name=\"habracut\"><\/a><\/p>\n<p>  \u0427\u0442\u043e\u0431\u044b \u043d\u0435 \u0437\u0430\u0433\u043b\u044f\u0434\u044b\u0432\u0430\u0442\u044c \u0432 \u043f\u0440\u043e\u0448\u043b\u044b\u0439 \u043f\u043e\u0441\u0442, \u043d\u0430\u043f\u043e\u043c\u043d\u044e, \u0447\u0442\u043e \u0432\u0441\u0435 \u00ab\u0432\u0438\u0434\u0436\u0435\u0442\u044b\u00bb \u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e \u0447\u0435\u0440\u0435\u0437 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443, \u0441\u043e\u0437\u0434\u0430\u044e\u0449\u0443\u044e \u043f\u043e\u0434\u043e\u0431\u0438\u0435 \u0441\u043b\u043e\u0435\u0432, \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u0447\u0442\u043e-\u0442\u043e \u0441\u0432\u043e\u0451 (\u0442\u0435\u043d\u044c, \u043e\u0444\u043e\u0440\u043c\u043b\u0435\u043d\u0438\u0435, \u0432\u0435\u0440\u0445\u043d\u0438\u0439 \u0441\u043b\u043e\u0439, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u0434\u043b\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f). \u0418 \u0432\u0441\u0435 \u044d\u0442\u043e \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u043e \u0432 \u043f\u0430\u043d\u0435\u043b\u044c, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0442\u044c, \u0441\u043a\u0440\u044b\u0432\u0430\u0442\u044c \u0438 \u0443\u0434\u0430\u043b\u044f\u0442\u044c \u0432\u0441\u0435 \u0441\u043b\u043e\u0438 \u043a\u0430\u043a \u043e\u0434\u043d\u043e \u0446\u0435\u043b\u043e\u0435.<\/p>\n<pre><code class=\"cpp\">struct _cursed_window {     WINDOW *background;     WINDOW *decoration;     WINDOW *overlay;     PANEL *panel; }; typedef struct _cursed_window cursed; <\/code><\/pre>\n<p>  \u0420\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u044f \u0441\u043a\u0440\u0438\u043d\u0448\u043e\u0442\u044b, \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c, \u043a\u0430\u043a \u0440\u0430\u0437\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f \u0446\u0432\u0435\u0442\u0430 \u043d\u0430 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0438\u0437 \u043d\u0438\u0445. \u0425\u043e\u0442\u044f \u043a\u043e\u0434 \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435, \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0446\u0432\u0435\u0442\u0430 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0430 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430. \u042f \u043e\u0441\u0442\u0430\u0432\u0438\u043b \u044d\u0442\u043e \u043a\u0430\u043a \u043f\u0440\u0438\u043c\u0435\u0440.<\/p>\n<p>  \u042f \u043d\u0435 \u0431\u0443\u0434\u0443 \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u0442\u0430\u043a\u0438\u043c\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438 \u043a\u0430\u043a getch(), wgetch(), scanw, \u0438 \u0441\u043e\u0442\u043e\u0432\u0430\u0440\u0438\u0449\u0438. \u042d\u0442\u043e \u043f\u043e \u0441\u0443\u0442\u0438 \u0430\u043d\u0430\u043b\u043e\u0433\u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0438\u0437 \u0421 \u0441 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f\u043c\u0438.<\/p>\n<h5>\u041c\u0435\u043d\u044e<\/h5>\n<p>  \u041c\u0435\u043d\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u043e \u0438 \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e. \u0414\u0432\u0438\u0436\u043e\u043a \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0440\u0430\u0437\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u0438\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u043c\u0435\u043d\u044e, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0435. \u041b\u044e\u0431\u044b\u0435 \u043f\u0443\u043d\u043a\u0442\u044b \u043c\u0435\u043d\u044e \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u043c\u0438 \u0438\u043b\u0438 \u043d\u0435\u0442. \u0422\u0430\u043a \u0436\u0435 \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0441\u043a\u0440\u043e\u043b\u043b\u0438\u043d\u0433\u0430, \u043f\u043e\u0438\u0441\u043a\u0430 \u043f\u043e \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u0438 \u0438 \u043f\u0440\u043e\u0447\u0438\u0435 \u0440\u0430\u0434\u043e\u0441\u0442\u0438, \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u043f\u0440\u043e\u0449\u0430\u044e\u0449\u0438\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0432\u0435\u0441\u044c\u043c\u0430 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0438 \u043d\u0430\u0432\u043e\u0440\u043e\u0447\u0435\u043d\u043d\u044b\u0445 \u043c\u0435\u043d\u044e.<br \/>  \u041d\u0430\u043f\u0438\u0448\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0435 \u0432\u044b\u0431\u043e\u0440\u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.<\/p>\n<pre><code class=\"cpp\">int32_t  tui_make_menu (const char **choices, size_t choices_num) <\/code><\/pre>\n<p>  \u041d\u0430 \u0432\u0445\u043e\u0434\u0435 \u0443 \u043d\u0430\u0441 \u043c\u0430\u0441\u0441\u0438\u0432 \u0441\u043e \u0441\u0442\u0440\u043e\u043a\u0430\u043c\u0438 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0432\u044b\u0431\u043e\u0440\u0430 \u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044d\u0442\u0438\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432. \u0412\u043e\u0442 \u0442\u0430\u043a\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043d\u0430\u0441 \u0441\u043f\u0438\u0441\u043e\u043a \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c.<\/p>\n<pre><code class=\"cpp\">const char *choices[] = \t{ \t\t&quot;Restore&quot;, \t\t&quot;Quick backup&quot;, \t\t&quot;Adv. backup&quot;, \t\t &quot;Add machine&quot;, \t\t&quot;Exit&quot;, \t\t NULL, \t}; <\/code><\/pre>\n<p>  \u0410 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u044d\u0442\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a  <\/p>\n<pre><code class=\"cpp\">if(tui_make_menu(choices,(sizeof choices\/sizeof choices[0]))==4) \tdo_something(); <\/code><\/pre>\n<p>  \u0410 \u0432 \u0441\u0430\u043c\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0442\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043c\u0435\u043d\u044e \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u044d\u0442\u043e\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0441\u0442\u0440\u043e\u043a.<\/p>\n<pre><code class=\"cpp\">ITEM **my_items = (ITEM **)calloc(choices_num, sizeof(ITEM *)); for(int32_t  i = 0; i &lt; choices_num; ++i)         my_items[i] = new_item(choices[i], &quot;&quot;); MENU *my_menu = new_menu((ITEM **)my_items); <\/code><\/pre>\n<p>  \u0412 \u0432\u044b\u0437\u043e\u0432\u0435 new_item \u044f \u0443\u043a\u0430\u0437\u0430\u043b \u0432\u0442\u043e\u0440\u044b\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u043f\u0443\u0441\u0442\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443, \u044d\u0442\u043e \u043f\u043e\u0441\u0442\u0444\u0438\u043a\u0441 \u0434\u043b\u044f \u043f\u0443\u043d\u043a\u0442\u0430 \u043c\u0435\u043d\u044e, \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c\u0441\u044f \u0441\u043f\u0440\u0430\u0432\u0430 \u043a\u0430\u043a \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 \u0433\u043e\u0440\u044f\u0447\u0435\u0439 \u043a\u043b\u0430\u0432\u0438\u0448\u0438). <br \/>  \u0417\u0430\u0434\u0430\u0434\u0438\u043c \u043e\u043a\u043d\u043e \u0434\u043b\u044f \u043c\u0435\u043d\u044e  <\/p>\n<pre><code class=\"cpp\">set_menu_win(my_menu, new-&gt;overlay); <\/code><\/pre>\n<p>  \u0410 \u0442\u0430\u043a \u0436\u0435 \u0437\u0430\u0434\u0430\u0434\u0438\u043c \u0441\u0438\u043c\u0432\u043e\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043c\u0430\u0440\u043a\u0435\u0440\u043e\u043c \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u0443\u043d\u043a\u0442\u0430 \u043c\u0435\u043d\u044e.  <\/p>\n<pre><code class=\"cpp\">set_menu_mark(my_menu, &quot; * &quot;); <\/code><\/pre>\n<p>  \u041d\u0443 \u0438 \u0440\u0430\u0441\u043a\u0440\u0430\u0441\u0438\u043c \u043d\u0430\u0448\u0435 \u043c\u0435\u043d\u044e.  <\/p>\n<pre><code class=\"cpp\">set_menu_fore(my_menu, COLOR_PAIR(1) | A_REVERSE); set_menu_back(my_menu, COLOR_PAIR(2)); set_menu_grey(my_menu, COLOR_PAIR(3)); <\/code><\/pre>\n<p>  \u0418 \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u0443\u0435\u043c \u0435\u0433\u043e  <\/p>\n<pre><code class=\"cpp\">post_menu(my_menu); <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage3\/ee9\/668\/4df\/ee96684df7ae60e5c6193a16daa747e7.png\"\/><\/p>\n<p>  \u041a\u0430\u043a \u0438 \u0432\u0441\u0435\u0433\u0434\u0430, \u0436\u0438\u0437\u043d\u0435\u0434\u0435\u044f\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0434\u0432\u0438\u0436\u043a\u0430 \u043c\u044b \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u043c \u0432 \u0440\u0443\u0447\u043d\u043e\u043c, \u043d\u043e \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435.<\/p>\n<pre><code class=\"cpp\">do     {         switch(user_key)         {         case KEY_MOUSE:             menu_driver(my_menu, KEY_MOUSE);             touchwin(panel_window(new-&gt;panel));             update_panels();             doupdate();             sleep(1);             goto mouse_end;         case KEY_DOWN:             menu_driver(my_menu, REQ_DOWN_ITEM);             break;         case KEY_UP:             menu_driver(my_menu, REQ_UP_ITEM);             break;         }         touchwin(panel_window(new-&gt;panel));         update_panels();         doupdate();     } while((user_key = wgetch(new-&gt;overlay)) != 0xD); <\/code><\/pre>\n<p>  \u0414\u0430-\u0434\u0430. \u0421\u0434\u0435\u043b\u0430\u0435\u043c \u043e\u0442\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435 \u0438 \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043e \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u043c\u044b\u0448\u043a\u043e\u0439.<\/p>\n<h6>\u041c\u044b\u0448\u044c<\/h6>\n<p>  Ncurses \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u043c \u0431\u0435\u0437 \u043e\u0441\u043e\u0431\u043e\u0433\u043e \u0443\u0441\u043b\u043e\u0436\u043d\u0435\u043d\u0438\u044f \u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u0434\u0430 \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0443\u0436\u0435 \u0434\u0435\u043b\u0430\u043b\u0438 \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u043e\u0439, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u044b\u0448\u043a\u0438. \u0414\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0440\u0435\u0430\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u043c\u044b\u0448\u043a\u0438 \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u043c\u0430\u0441\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c.  <\/p>\n<pre><code class=\"cpp\">mousemask(ALL_MOUSE_EVENTS, NULL); <\/code><\/pre>\n<p>  \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u0441\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u044b, \u043d\u043e \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435, \u0435\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0437\u0430\u0445\u043e\u0442\u0435\u0442\u044c \u0440\u0435\u0430\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u0434\u0432\u043e\u0439\u043d\u043e\u0439 \u043a\u043b\u0438\u043a \u043f\u0440\u0430\u0432\u043e\u0439 \u043a\u043d\u043e\u043f\u043a\u043e\u0439 <i>BUTTON2_DOUBLE_CLICKED<\/i> \u0438\u043b\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043e\u0442\u043f\u0443\u0441\u043a\u0430\u043d\u0438\u0435 \u043b\u0435\u0432\u043e\u0439 \u043a\u043d\u043e\u043f\u043a\u0438 <i>BUTTON1_RELEASED<\/i> \u0438 \u0442.\u0434.<\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u043c \u0446\u0438\u043a\u043b\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0432\u0432\u043e\u0434\u0430 \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c case KEY_MOUSE \u0438 \u0443\u0436\u0435 \u0434\u0430\u043b\u0435\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0432 \u0434\u0432\u0438\u0436\u043e\u043a \u043c\u0435\u043d\u044e \u0438\u043b\u0438 \u0436\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0441\u0432\u043e\u0435. \u0412 \u043f\u0435\u0440\u0432\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0434\u0432\u0438\u0436\u043e\u043a \u043c\u0435\u043d\u044e \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442, \u043a\u0430\u043a \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043f\u0435\u0440\u0435\u043d\u0435\u0441\u0442\u0438 \u043c\u0430\u0440\u043a\u0435\u0440 \u043c\u0435\u043d\u044e. <br \/>  \u041e\u0447\u0435\u043d\u044c \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e, \u0435\u0441\u043b\u0438 \u0440\u0430\u0431\u043e\u0442\u0430 \u0438\u0434\u0435\u0442 \u0447\u0435\u0440\u0435\u0437 VNC \u0441 \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0430\u0434\u0435\u043a\u0432\u0430\u0442\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u043e\u0439 \u043c\u044b\u0448\u043a\u0438.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b\u0441\u044f \u0438 \u0432\u044b\u0431\u0440\u0430\u043b \u043f\u0443\u043d\u043a\u0442 \u043c\u0435\u043d\u044e, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0443\u0437\u043d\u0430\u0442\u044c \u0435\u0433\u043e \u0432\u044b\u0431\u043e\u0440<\/p>\n<pre><code class=\"cpp\">mouse_end: int32_t user_selection = item_index(current_item(my_menu)); <\/code><\/pre>\n<p>  \u0423\u0431\u0438\u0440\u0430\u0435\u043c \u043c\u0443\u0441\u043e\u0440<\/p>\n<pre><code class=\"cpp\">unpost_menu(my_menu); free_menu(my_menu); for(int32_t i = 0; i &lt; choices_num; ++i)     free_item(my_items[i]); tui_del_win(new); <\/code><\/pre>\n<p>  \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435<\/p>\n<pre><code class=\"cpp\">return (user_selection); <\/code><\/pre>\n<h5>\u0424\u043e\u0440\u043c\u044b \u0438 \u043f\u043e\u043b\u044f<\/h5>\n<p>  \u041f\u043e\u043b\u0435 \u0432\u0432\u043e\u0434\u0430 \u0432 ncurses \u0438\u043c\u0435\u0435\u0442 \u0432\u0435\u0441\u044c\u043c\u0430 \u043c\u043e\u0449\u043d\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0439 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0435\u043a\u0441\u0442\u043e\u043c, \u0432\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c \u0432 \u0448\u0438\u0440\u043e\u043a\u0438\u0445 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u0445. \u041d\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u043d\u0430\u043c \u0442\u0435\u043a\u0441\u0442 \u043e\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438 \u043d\u0430 \u0435\u0451 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u0438 \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441 \u044d\u0442\u0438\u043c \u043f\u043e\u043b\u0435\u043c \u0434\u0435\u043b\u0430\u0442\u044c.<\/p>\n<pre><code class=\"cpp\">char * tui_make_input(const char *info, int32_t max_len); <\/code><\/pre>\n<p>  \u0422\u043e \u0435\u0441\u0442\u044c \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0437\u0430\u0434\u0430\u0442\u044c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0443\u044e \u0434\u043b\u0438\u043d\u0443 \u043f\u043e\u043b\u044f \u0438 \u043d\u0435\u043a\u043e\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0435 \u043f\u043e\u0441\u043b\u0430\u043d\u0438\u0435, \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u044e\u0449\u0435\u0435, \u0447\u0442\u043e \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043e\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c.<\/p>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0431\u0443\u0444\u0435\u0440 \u0441 \u043d\u0430\u0448\u0438\u043c \u043f\u043e\u043b\u0435\u043c \u0432\u0432\u043e\u0434\u0430. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0440\u0430\u0437\u043c\u0435\u0440 \u043f\u043e\u043b\u044f \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d, \u043d\u043e \u043f\u043e\u043b\u0435 \u043c\u043e\u0436\u0435\u0442 \u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0442\u044c\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438, <br \/>  \u0422\u0430\u043a\u043e\u0439 \u0441\u0442\u0438\u043b\u044c \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u0435\u043d.  <\/p>\n<pre><code class=\"cpp\">FIELD *field[2]; field[0] = new_field(1, max_len, 0, 0, 0, 0); field[1] = NULL; <\/code><\/pre>\n<pre><code class=\"cpp\">FORM  *my_form; set_field_back(field[0], A_UNDERLINE);  <\/code><\/pre>\n<p>  \u041f\u043e\u043b\u0435 \u0432 max_len \u0437\u043d\u0430\u043a\u043e\u0432 \u0434\u043b\u0438\u043d\u043e\u0439, \u0432 1 \u0441\u0442\u0440\u043e\u043a\u0443 \u0432\u044b\u0441\u043e\u0442\u043e\u0439. \u041c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u043e\u0434\u043d\u043e \u043f\u043e\u043b\u0435 \u0434\u043b\u044f \u0444\u043e\u0440\u043c\u044b, \u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043c\u043e\u0436\u043d\u043e \u0438\u0445 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0443\u0433\u043e\u0434\u043d\u043e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0444\u043e\u0440\u043c\u0430 \u0432\u0432\u043e\u0434\u0430 \u043b\u043e\u0433\u0438\u043d\u0430\/\u043f\u0430\u0440\u043e\u043b\u044f. \u0422\u043e\u0433\u0434\u0430 \u044d\u0442\u0438 \u043f\u043e\u043b\u044f \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u043e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442\u044c \u0432 \u043d\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u0435 \u043f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u043a\u043b\u0430\u0432\u0438\u0448\u0438 \u0438\/\u0438\u043b\u0438 \u043f\u0440\u0438 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u0444\u043e\u0440\u043c\u044b (\u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443 \u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u0444\u043e\u0440\u043c\u0430 \u0432\u0432\u043e\u0434\u0430 \u0441\u0435\u0440\u0438\u0439\u043d\u043e\u0433\u043e \u043d\u043e\u043c\u0435\u0440\u0430).<br \/>  \u0410 \u0442\u0430\u043a\u0436\u0435 \u0432\u043a\u043b\u044e\u0447\u0438\u043b\u0438 \u043e\u043f\u0446\u0438\u044e \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u044f \u0432\u0432\u043e\u0434\u0430 \u043d\u0438\u0436\u043d\u0438\u043c \u043f\u043e\u0434\u0447\u0435\u0440\u043a\u0438\u0432\u0430\u043d\u0438\u0435\u043c.<\/p>\n<h6>\u0422\u0438\u043f\u044b<\/h6>\n<p>  \u041a\u0430\u0436\u0434\u043e\u0435 \u043f\u043e\u043b\u0435 \u043c\u043e\u0436\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u043e\u0434\u0438\u043d \u0438\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u0438\u043f\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0437\u0430\u0434\u0430\u044e\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:  <\/p>\n<pre><code class=\"cpp\">set_field_type(field[0],TYPE_ALPHA); <\/code><\/pre>\n<p>  \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0444\u0438\u043b\u044c\u0442\u0440 \u043d\u0430 \u0431\u0443\u043a\u0432\u044b, \u0438 \u0432\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c \u0446\u0438\u0444\u0440\u044b \u0438\u043b\u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0437\u043d\u0430\u043a\u0438, \u043d\u0435 \u043e\u0442\u043d\u043e\u0441\u044f\u0449\u0438\u0435\u0441\u044f \u043a \u0430\u043b\u0444\u0430\u0432\u0438\u0442\u0443, \u043d\u0435 \u0431\u0443\u0434\u0443\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u044b. \u041d\u0430 \u0441\u043a\u0440\u0438\u043d\u0448\u043e\u0442\u0435 \u043f\u0440\u0438\u043c\u0435\u0440 \u0442\u0430\u043a\u043e\u0433\u043e \u043f\u043e\u043b\u044f \u0432\u0432\u043e\u0434\u0430 \u0441 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u043c \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u043c TYPE_IPV4. \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u043e\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0446\u0438\u0444\u0440 \u0438 \u0442\u043e\u0447\u043a\u0438, \u043d\u043e \u043d\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0441\u0430\u043c\u043e\u0433\u043e \u0430\u0434\u0440\u0435\u0441\u0430. \u041d\u043e \u0438 \u0442\u0443\u0442 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u043a\u0430\u0436\u0434\u0443\u044e \u043d\u0430\u0436\u0430\u0442\u0443\u044e \u043a\u043b\u0430\u0432\u0438\u0448\u0443 (\u043f\u0440\u043e\u0448\u0435\u0434\u0448\u0443\u044e \u0444\u0438\u043b\u044c\u0442\u0440) \u0438, \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0432, \u0440\u0435\u0448\u0430\u0442\u044c \u2014 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c \u0435\u0451 \u0438\u043b\u0438 \u043d\u0435\u0442 \u0438\u043b\u0438 \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435.<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage3\/b3a\/897\/130\/b3a8971302a926f6eb1e3ff75a68c509.png\"\/><\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0448\u0438 \u043f\u043e\u043b\u044f \u043c\u044b \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u0435\u043c \u0432 \u0444\u043e\u0440\u043c\u0443<\/p>\n<pre><code class=\"cpp\">my_form = new_form(field); set_form_sub(my_form, new-&gt;overlay); post_form(my_form); <\/code><\/pre>\n<p>  \u0410 \u0442\u0430\u043a \u0436\u0435 \u043f\u0435\u0447\u0430\u0442\u0430\u0435\u043c \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435.  <\/p>\n<pre><code class=\"cpp\">mvwprintw(new-&gt;decoration,1,1, info); <\/code><\/pre>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u0444\u043e\u0440\u043c\u044b<\/p>\n<pre><code class=\"cpp\">uint32_t user_key=0; do     {         switch(user_key)         {         case 0xD:         form_driver(my_form, REQ_VALIDATION);        \t         goto check;         default:         form_driver(my_form, user_key);         break;         }         touchwin(panel_window(new-&gt;panel));         update_panels();         doupdate();     } while((user_key = getch()) != KEY_F(12)); <\/code><\/pre>\n<p>  \u041c\u044b \u0436\u0434\u0435\u043c \u0432 \u0446\u0438\u043a\u043b\u0435 \u043e\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u043a\u043b\u0430\u0432\u0438\u0448\u0438, \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u043d\u0435 \u0412\u0412\u041e\u0414 \u2014 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u043a\u043b\u0430\u0432\u0438\u0448\u0443 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0443 \u043f\u043e\u043b\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u0436\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442 \u0444\u0438\u043b\u044c\u0442\u0440 \u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d, \u0435\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e. \u0415\u0441\u043b\u0438 \u044d\u0442\u043e \u043a\u043b\u0430\u0432\u0438\u0448\u0430 \u0412\u0412\u041e\u0414 \u2014 \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u043f\u043e\u043b\u044f \u0438 \u0432\u044b\u0445\u043e\u0434\u0438\u043c \u0438\u0437 \u0446\u0438\u043a\u043b\u0430.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0434\u0435\u043b\u043e \u0437\u0430 \u043c\u0430\u043b\u044b\u043c \u2014 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u043e, \u0447\u0442\u043e \u0432\u0432\u0435\u043b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c:  <\/p>\n<pre><code class=\"cpp\">check: char *result=0; asprintf(&result, &quot;%s&quot;, field_buffer(field[0], 0)); <\/code><\/pre>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u043f\u043e\u0434\u0447\u0438\u0449\u0430\u0435\u043c \u0437\u0430 \u0441\u043e\u0431\u043e\u0439 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442<\/p>\n<pre><code class=\"cpp\">unpost_form(my_form); free_field(field[0]); free_form(my_form); tui_del_win(new); return result; <\/code><\/pre>\n<p>  \u0420\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f, \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u0438 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044f \u0432\u0432\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435 \u0438\u043b\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e:  <\/p>\n<pre><code class=\"cpp\">set_field_buffer(field[0], 0, \u00abDefault\u00bb); <\/code><\/pre>\n<p>  \u041d\u0443 \u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0434\u0440\u0443\u0433\u0438\u0445 \u043e\u043f\u0446\u0438\u0439. \u0425\u043e\u0447\u0443 \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0438 \u0441 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435\u043c\/\u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u0435\u043c \u0437\u043d\u0430\u043a\u043e\u0432 \u0438\u043b\u0438 \u0446\u0435\u043b\u044b\u0445 \u0441\u043b\u043e\u0432 \u043b\u0435\u0436\u0430\u0442 \u043d\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435. \u0412 \u0442\u043e\u043c \u0436\u0435 \u0446\u0438\u043a\u043b\u0435 do-while \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0442\u043b\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u043d\u0443\u0436\u043d\u044b\u0445 \u043a\u043b\u0430\u0432\u0438\u0448 \u0438 \u0447\u0435\u0440\u0435\u0437 form_driver \u0434\u0435\u043b\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043d\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0437\u043d\u0430\u043a\u0430, \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u043f\u043e \u0431\u0443\u043a\u0432\u0430\u043c \u0438\u043b\u0438 \u0441\u043b\u043e\u0432\u0430\u043c. \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u043e\u0440\u043c \u043c\u043e\u0436\u043d\u043e \u0431\u0435\u0437 \u043e\u0441\u043e\u0431\u043e\u0439 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0439 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0439 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440, \u043b\u044c\u0432\u0438\u043d\u0430\u044f \u0434\u043e\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0442\u0435\u043a\u0441\u0442\u043e\u043c \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043b\u044f\u0436\u0435\u0442 \u043d\u0430 \u0434\u0432\u0438\u0436\u043e\u043a ncurses. \u0412\u0435\u0434\u044c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0434\u0430\u0436\u0435 \u0432\u044b\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u043d\u0438\u0435 \u0442\u0435\u043a\u0441\u0442\u0430 \u043f\u043e \u043f\u043e\u043b\u044f\u043c, \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0446\u0435\u043b\u044b\u0445 \u0441\u043b\u043e\u0432 \u0438 \u043f\u0440\u043e\u0447\u0438\u0435 \u0440\u0430\u0434\u043e\u0441\u0442\u0438.<\/p>\n<h5>\u041a\u043d\u043e\u043f\u043a\u0438<\/h5>\n<p>  \u0422\u0430\u043a \u043a\u0430\u043a ncurses \u043d\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0433\u043e\u0442\u043e\u0432\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e, \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0435\u0451 \u0441\u0430\u043c\u0438. \u0421\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043a\u043d\u043e\u043f\u043a\u0438 \u044d\u0442\u043e \u043e\u043a\u043d\u043e \u0441 \u0442\u0435\u043d\u044c\u044e, \u0432 \u043d\u0430\u0436\u0430\u0442\u043e\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 \u043e\u043f\u0443\u0441\u043a\u0430\u044e\u0449\u0435\u0435\u0441\u044f \u043d\u0430 \u0441\u0432\u043e\u044e \u0442\u0435\u043d\u044c. \u0412 \u043f\u0440\u043e\u0448\u043b\u043e\u043c \u043f\u043e\u0441\u0442\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u043b, \u0447\u0442\u043e \u0432 \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0442\u0435\u043d\u044c \u043d\u0430\u0435\u0434\u0435\u0442 \u043d\u0430 \u043d\u0438\u0436\u043d\u0435\u0435 \u043e\u043a\u043d\u043e. \u042d\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0438\u0437-\u0437\u0430 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0434\u043b\u044f \u0440\u0438\u0441\u043e\u0432\u0430\u043d\u0438\u044f \u0442\u043e\u0439 \u0436\u0435 \u0442\u0435\u043d\u0438 \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u043b\u043e\u0439, \u0438 \u0441\u043b\u043e\u0439 \u044d\u0442\u043e\u0442 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u044b\u0439. \u041d\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0430\u044f \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u0435\u0433\u043e \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0438 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0435\u0442 \u043a\u0430\u043a \u043d\u0430 \u0441\u043a\u0440\u0438\u043d\u0448\u043e\u0442\u0435 \u0441\u043d\u0438\u0437\u0443<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage3\/166\/a65\/f67\/166a65f67ea3287af1a4adbe0c623611.png\"\/><\/p>\n<p>  \u042d\u0444\u0444\u0435\u043a\u0442 \u00ab\u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e\u0441\u0442\u0438\u00bb \u0432 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442. \u041d\u043e \u044d\u0442\u043e \u043d\u0435 \u0431\u0435\u0434\u0430, \u0435\u0451 \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e. \u0412 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u043b\u0443\u0447\u0430\u0435\u0432, \u043a\u043d\u043e\u043f\u043a\u0443 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u0432\u043d\u0443\u0442\u0440\u0438 \u043e\u043a\u043d\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0431\u0443\u0434\u0435\u043c \u0441\u0447\u0438\u0442\u0430\u0442\u044c, \u0447\u0442\u043e \u043c\u044b \u0437\u043d\u0430\u0435\u043c, \u043d\u0430 \u043a\u0430\u043a\u043e\u043c \u043e\u043a\u043d\u0435 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0430. <br \/>  \u0412 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043c\u044b \u0432\u044b\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u043c \u0442\u0435\u043a\u0441\u0442 \u0432 \u043d\u0438\u0436\u0435\u043b\u0435\u0436\u0430\u0449\u0435\u043c \u043e\u043a\u043d\u0435 \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0435\u0433\u043e \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430\u043c\u0438 (\u0446\u0432\u0435\u0442, \u0440\u0435\u0436\u0438\u043c). ASCII \u043a\u043e\u0434 + \u0430\u0442\u0440\u0438\u0431\u0443\u0442 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u043e\u0434\u0438\u043d \u0431\u0430\u0439\u0442 \u0438 \u043b\u0435\u0436\u0430\u0442 \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0442\u0438\u043f\u0430 chtype (uint8_t). \u0414\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u0435\u0441\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f mvwaddchstr.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434 \u0434\u043b\u044f \u043a\u043d\u043e\u043f\u043a\u0438<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">cursed *tui_new_button(WINDOW *bwin, int32_t  sy, int32_t  sx, const char *label, size_t len) {     cursed *new = malloc (sizeof *new);     int32_t  w = len + 4;     int32_t  h = 5;     new-&gt;background = newwin(h, w + 1, sy, sx);     wbkgd(new-&gt;background, COLOR_PAIR(4));     \/* Get start coordinates of underlying window*\/     int32_t  shad_x, shad_y;     getbegyx(bwin, shad_y, shad_x);      chtype c[len + 7] = {0};     \/* Extract underlying text and copy it to the button's shadow layer *\/     for(int32_t  i=0; i &lt; h; i++)     {         mvwinchnstr(bwin,sy-shad_y + i,sx-shad_x,c, len + 6);         mvwaddchstr(new-&gt;background,i,0, c);     }      wattron(new-&gt;background, COLOR_PAIR(10));     for (int32_t  i = 2; i &lt; w - 1; i++)         mvwaddch(new-&gt;background, h - 1, i, ' ');     for (int32_t  i= 2; i &lt; h; i++)         mvwprintw(new-&gt;background, i, w - 1, &quot;  &quot;);     wattroff(new-&gt;background, COLOR_PAIR(10));      new-&gt;decoration = derwin(new-&gt;background,  h-2, w-2, 1, 1);     wbkgd(new-&gt;decoration, COLOR_PAIR(1));     box(new-&gt;decoration, 0, 0);     int32_t  x, y;     getmaxyx(new-&gt;decoration, y, x);     new-&gt;overlay = derwin(new-&gt;decoration,  y-2, x-2, 1, 1);     wbkgd(new-&gt;overlay, COLOR_PAIR(1));     new-&gt;panel = new_panel(new-&gt;background);      wprintw(new-&gt;overlay, label);     update_panels();     doupdate();     return new; } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage3\/f0c\/e1d\/699\/f0ce1d6994d05a3588e440196047aa1f.png\"\/><\/p>\n<p>  \u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044e \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u043a\u043d\u043e\u043f\u043a\u0438. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 <\/p>\n<blockquote><p>\u00abThe subwindow functions (subwin, derwin, mvderwin, wsyncup, wsyncdown, wcursyncup, syncok) are flaky, incompletely implemented, and not well tested \u00bb,<\/p><\/blockquote>\n<p> \u0442\u043e \u044f \u044d\u0444\u0444\u0435\u043a\u0442 \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u043a\u043d\u043e\u043f\u043a\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b \u0447\u0435\u0440\u0435\u0437 \u0442\u0430\u043a\u0438\u0435 \u0432\u043e\u0442 \u043a\u043e\u0441\u0442\u044b\u043b\u0438. \u0422\u043e \u0435\u0441\u0442\u044c \u044f \u0441\u043a\u0440\u044b\u0432\u0430\u044e \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u0443\u044e \u043f\u0430\u043d\u0435\u043b\u044c \u043a\u043d\u043e\u043f\u043a\u0438, \u0434\u0435\u043b\u0430\u044e \u0434\u0443\u0431\u043b\u0438\u043a\u0430\u0442 \u0431\u0435\u0437 \u0442\u0435\u043d\u0438, \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u044e \u043f\u043e \u0434\u0438\u0430\u0433\u043e\u043d\u0430\u043b\u0438, \u0434\u0435\u043b\u0430\u044e \u043f\u0430\u0443\u0437\u0443 \u0438 \u0443\u0434\u0430\u043b\u044f\u044e \u043a\u043b\u043e\u043d. \u041d\u0443 \u0438 \u0440\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f \u0441\u043d\u043e\u0432\u0430 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u0443\u044e \u043a\u043d\u043e\u043f\u043a\u0443.<\/p>\n<pre><code class=\"cpp\">void tui_toggle_button (cursed *button) { \tint32_t  x, y; \tgetbegyx(button-&gt;background, y, x);   \thide_panel(button-&gt;panel); \tWINDOW *dup_dec = dupwin(button-&gt;decoration); \tPANEL *duppan = new_panel(dup_dec); \tmove_panel(duppan, y + 2, x + 3); \tupdate_panels(); \tdoupdate(); \tusleep(200000); \tdel_panel(duppan); \tshow_panel(button-&gt;panel); } <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage3\/396\/8fc\/39e\/3968fc39e4db7ff3466ecdf56e06d12b.gif\"\/><\/p>\n<h5>\u041e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430.<\/h5>\n<p>  \u041a\u043e\u043c\u0431\u0438\u043d\u0438\u0440\u0443\u044f \u0444\u043e\u0440\u043c\u0443 \u0438 \u043c\u0435\u043d\u044e \u043c\u043e\u0436\u043d\u043e \u0441 \u043b\u0435\u0433\u043a\u043e\u0441\u0442\u044c\u044e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u043f\u0430\u0434\u0430\u044e\u0449\u0438\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0441 \u0430\u0432\u0442\u043e\u043f\u043e\u0438\u0441\u043a\u043e\u043c. \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u043e-\u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043c\u0435\u043d\u044e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c radiobutton. <br \/>  \u0422\u043e\u0442 \u0436\u0435 \u0438\u043d\u0434\u0438\u043a\u0430\u0442\u043e\u0440 \u043f\u0440\u043e\u0433\u0440\u0435\u0441\u0441\u0430 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u043e:<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage3\/c08\/615\/241\/c086152419e37534c429761720c30718.png\"\/><\/p>\n<pre><code class=\"cpp\">void  tui_progress_bar(WINDOW *win, double progress) {     int32_t  height, width;     getmaxyx(win, height, width);     wattron(win, COLOR_PAIR(8));     for (int32_t  i = 0; i &lt; width * progress; i++)     {         mvwaddch(win, (height \/ 2), i, ' ');     }     wattroff(win, COLOR_PAIR(8));     wattron(win, COLOR_PAIR(7));     for (int32_t  i = width * progress; i &lt; width; i++)     {         mvwaddch(win, (height \/ 2), i, ' ');     }     wattroff(win, COLOR_PAIR(7));     wattron(win, A_STANDOUT);     mvwprintw(win, (height \/ 2), (width \/ 2) - 2, &quot;%.0f%%&quot;, progress*100);     wattroff(win, A_STANDOUT); } <\/code><\/pre>\n<p>  \u0422\u043e\u0442 \u0436\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u0441\u0441\u0431\u0430\u0440 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438 \u0432 \u0447\u0438\u0441\u0442\u043e \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445. \u041a\u0430\u043a \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u044b\u0439 \u0438 \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0438\u043d\u0434\u0438\u043a\u0430\u0442\u043e\u0440 \u043f\u0440\u043e\u0433\u0440\u0435\u0441\u0441\u0430, \u0445\u043e\u0442\u044f \u0442\u0430\u043a\u043e\u0435 \u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0447\u0438\u0441\u0442\u043e \u043d\u0430 printf, \u043d\u043e \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0435\u0449\u0451 \u0432 \u0434\u0440\u0443\u0433\u0438\u0445 \u0441\u0442\u0440\u043e\u043a\u0430\u0445.<\/p>\n<h5>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h5>\n<p>  \u0422\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e. \u041c\u043d\u043e\u0433\u0438\u0435 \u043f\u0438\u0448\u0443\u0442 \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u044b\u0435 \u0443\u0442\u0438\u043b\u0438\u0442\u044b, \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u044d\u0442\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0447\u0438\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442. \u041f\u043e\u0447\u0435\u043c\u0443 \u0431\u044b \u0435\u0433\u043e \u043d\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u0435\u0439 \u0438 \u0443\u0434\u043e\u0431\u043d\u0435\u0439 \u0434\u043b\u044f \u0432\u043e\u0441\u043f\u0440\u0438\u044f\u0442\u0438\u044f? \u041d\u0430 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043a\u0440\u0438\u043d\u0448\u043e\u0442\u0435 \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043d\u0438\u0447\u0435\u0433\u043e \u043a\u0440\u043e\u043c\u0435 3 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0432\u044b\u0432\u043e\u0434\u0430 \u0431\u0435\u0437 \u043e\u043a\u043e\u043d \u0438 \u043f\u0430\u043d\u0435\u043b\u0435\u0439. <br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage3\/496\/d53\/bca\/496d53bca5cb05b7e7eb44aaa10f5154.png\"\/><br \/>  \u0415\u0441\u043b\u0438 \u043e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0438 \u0434\u043b\u044f \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432, tui \u043c\u043e\u0436\u043d\u043e \u0432\u043a\u043b\u044e\u0447\u0430\u0442\u044c\/\u0432\u044b\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u043f\u043e \u043a\u043b\u044e\u0447\u0443 \u0432 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430\u0445 \u0437\u0430\u043f\u0443\u0441\u043a\u0430. \u0422\u0430\u043a \u0438\u043b\u0438 \u0438\u043d\u0430\u0447\u0435, \u0435\u0441\u043b\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0433\u0440\u0430\u0444\u0438\u043a\u0443, \u044d\u0442\u043e \u043d\u0435 \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u043e\u043d\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u043e\u0441\u0442\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u043e\u0439. \u0422\u043e\u0442 \u0436\u0435 \u0432\u044b\u0432\u043e\u0434 \u0441\u043f\u0440\u0430\u0432\u043a\u0438 \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u0435\u0439 \u0438\u043b\u0438 \u0434\u0430\u0436\u0435 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043d\u044b\u043c. \u0422\u0435 \u0436\u0435 \u0430\u0432\u0442\u043e\u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043f\u043e TAB \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0438 \u0432\u0430\u0448\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u0441\u043a\u0430\u0436\u0443\u0442 \u0432\u0430\u043c \u0441\u043f\u0430\u0441\u0438\u0431\u043e. \u0425\u043e\u0440\u043e\u0448\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u0442\u0443\u0442 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0443\u0442\u0438\u043b\u0438\u0442\u0430 xe \u0438\u0437 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0442\u0430 Xen Server. \u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u044e\u0437\u0435\u0440 \u043d\u0430\u043f\u0435\u0447\u0430\u0442\u0430\u043b \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e, \u043f\u043e \u043d\u0430\u0436\u0430\u0442\u0438\u044e TAB \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 uuid= \u0438 \u0442\u0443\u0442 \u0436\u0435 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u043e\u043c \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f UUID \u043c\u0430\u0448\u0438\u043d, \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435. \u042d\u0442\u043e \u043d\u0435\u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u0438 \u0443\u0441\u043a\u043e\u0440\u044f\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0443.<\/p>\n<p>  PS: \u0415\u0441\u043b\u0438 \u043a\u0442\u043e-\u0442\u043e \u0445\u043e\u0447\u0435\u0442 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 curses, \u044f \u0432\u044b\u043b\u043e\u0436\u0438\u043b \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0442\u0443\u0442<br \/>  <a href=\"https:\/\/github.com\/Pugnator\/curses_test\">github.com\/Pugnator\/curses_test<\/a><br \/>  \u041f\u0440\u043e\u0448\u0443 \u0441\u0438\u043b\u044c\u043d\u043e \u043d\u0435 \u0440\u0443\u0433\u0430\u0442\u044c \u0437\u0430 \u043a\u043e\u0434 \u2014 \u044f \u043b\u0438\u0448\u044c \u043b\u044e\u0431\u0438\u0442\u0435\u043b\u044c. <br \/>  \u0412 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 bin \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c make<br \/>  \u0415\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e, \u0434\u043e\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c:<br \/>  sudo apt-get install ncurses-dev (\u0434\u043b\u044f debian based)    \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/208582\/\"> http:\/\/habrahabr.ru\/post\/208582\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t\u0418\u0442\u0430\u043a, \u0432\u0442\u043e\u0440\u0430\u044f \u0447\u0430\u0441\u0442\u044c. \u0417\u0434\u0435\u0441\u044c \u044f \u0440\u0430\u0441\u043a\u0440\u043e\u044e \u043a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u0430 \u0442\u0430\u043a \u0436\u0435 \u043e \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0438 \u044d\u0442\u0438\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438. \u0422\u0443\u0442 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0442\u0440\u043e\u043d\u0443\u0442\u044c \u0432\u043e\u043f\u0440\u043e\u0441, \u043f\u043e\u0434\u043d\u044f\u0442\u044b\u0439 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445 \u043a \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c\u0443 <a href=\"http:\/\/habrahabr.ru\/post\/205222\/\">\u043f\u043e\u0441\u0442\u0443<\/a> \u2014 \u00ab\u0410 \u0437\u0430\u0447\u0435\u043c \u044d\u0442\u043e \u0432\u0441\u0435 \u043d\u0443\u0436\u043d\u043e?\u00bb. \u041f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0442\u0430\u043a\u0438\u0445 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432 \u0432 21-\u043c \u0432\u0435\u043a\u0435 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0430\u043f\u043b\u0430\u044f\u043d\u0441\u044b \u043d\u0430 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043c\u0430\u0448\u0438\u043d\u0430\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0442 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b. \u0427\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u043e\u043d\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0438\u0437 \u0441\u0435\u0431\u044f \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0434\u0438\u0441\u0442\u0440\u0438\u0431\u0443\u0442\u0438\u0432 Linux \u0438\u043b\u0438 \u043d\u0430\u0431\u043e\u0440 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c\u043e\u0435 \u044f\u0434\u0440\u043e + busybox. \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0442\u0430\u043a\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u043a\u0438\u0439 \u0444\u0440\u043e\u043d\u0442\u044d\u043d\u0434 \u0434\u043b\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u0430, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0439 \u043e\u0434\u043d\u0438\u043c \u0432\u0437\u0433\u043b\u044f\u0434\u043e\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0443\u0437\u043b\u043e\u0432 \u0438\u043b\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043d\u0435\u043a\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0432 \u0443\u0434\u043e\u0431\u043d\u043e\u0439 \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0444\u043e\u0440\u043c\u0435. \u041f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0437\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u0444\u0440\u043e\u043d\u0442\u044d\u043d\u0434\u044b \u0443 VMware ESXi (vDirector, vCenter etc), Citrix Xen, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043e\u0447\u0435\u0442\u0430\u044e\u0442 \u043a\u0430\u043a \u043c\u043e\u0449\u044c web-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430, \u0442\u0430\u043a \u0438 TUI \u043a\u0430\u043a \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0438\/\u0438\u043b\u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438\/\u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u043a\u0438. \u041f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u044f\u0441\u044c \u043f\u043e \u0434\u0435\u0441\u044f\u0442\u043a\u0430\u043c \u043c\u0430\u0448\u0438\u043d \u043c\u043e\u0436\u043d\u043e \u043e\u0434\u043d\u0438\u043c \u0432\u0437\u0433\u043b\u044f\u0434\u043e\u043c \u0443\u0432\u0438\u0434\u0435\u0442\u044c, \u0432\u0441\u0435 \u043b\u0438 \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u0438\u043b\u0438 \u0431\u044b\u0441\u0442\u0440\u043e \u0443\u0437\u043d\u0430\u0442\u044c IP \u0430\u0434\u0440\u0435\u0441, \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u0432 \u044e\u0437\u0435\u0440\u0443 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043a\u043e\u043d\u0441\u043e\u043b\u0438, \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044f \u0435\u043c\u0443 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e, \u0447\u0442\u043e \u0435\u043c\u0443 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0437\u043d\u0430\u0442\u044c (foolproof).<br \/>  <img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/08b\/38f\/2a8\/08b38f2a85b1390bc99c4f32eefcdca2.gif\"\/>  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-208582","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/208582","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=208582"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/208582\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=208582"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=208582"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=208582"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}