亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? cp_vt.c

?? Simple Cube plotting using frame buffers
?? C
字號:
// cp_vt.c //// Copyright (c) 2006, Mike Acton <macton@cellperformance.com>// // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated // documentation files (the "Software"), to deal in the Software without restriction, including without// limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of// the Software, and to permit persons to whom the Software is furnished to do so, subject to the following// conditions://// The above copyright notice and this permission notice shall be included in all copies or substantial// portions of the Software.//// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO// EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN// AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE// OR OTHER DEALINGS IN THE SOFTWARE.// NOTES:// From http://www.linuxjournal.com/article/2597////     "Console ttys are used when the keyboard and monitor are directly connected to the system without running//     the X Window System. Since you can have several virtual consoles, the devices are tty0 through tty63. In//     theory you can have 64 virtual consoles, but most people use only a few. The device /dev/console is//     identical to tty0 and is needed for historical reasons. If your system lets you log in on consoles 1//     through 6, then when you run X Windows System, X uses console 7, so you'll need /dev/tty1 through /dev///     tty7 on your system. I recommend having files up through /dev/tty12. For more information on using//     virtual consoles, see the article Keyboards, Consoles and VT Cruising by John Fisk in the November 1996//     issue of Linux Journal"#include <stdio.h>#include <stdint.h>#include <fcntl.h>#include <unistd.h>#include <sys/ioctl.h>#include <linux/vt.h>#include <linux/kd.h>#include "cp_vt.h"static inline const char*select_error_str( int existing_error, const char* const existing_error_str, int new_error, const char* const new_error_str ){  // Only report the first error found - any error that follows is probably just a cascading effect.  const char* error_str = (char*)( (~(intptr_t)existing_error & (intptr_t)new_error & (intptr_t)new_error_str)                                 |  ((intptr_t)existing_error & (intptr_t)existing_error_str) );  return (error_str);}intcp_vt_open_graphics(cp_vt* restrict vt){  const char*    error_str      = NULL;  int            error          = 0;  // Open the current tty   // From http://tldp.org/HOWTO/Text-Terminal-HOWTO-6.html#ss6.3  // (An excellent overview by David S. Lawyer)  //  //     "In Linux the PC monitor is usually called the console and has several device special files associated  //     with it: vc/0 (tty0), vc/1 (tty1), vc/2 (tty2), etc. When you log in you are on vc/1. To go to vc/2  //     (on the same screen) press down the 2 keys Alt(left)-F3. For vc/3 use Left Alt-F3, etc. These (vc/1,  //     vc/2, vc/3, etc.) are called "virtual terminals". vc/0 (tty0) is just an alias for the current virtual  //     terminal and it's where messages from the system are sent. Thus messages from the system will be seen  //     on the console (monitor) regardless of which virtual terminal it is displaying."  const int   cur_tty                = open( "/dev/tty0", O_RDWR );  const int   open_cur_tty_error     = (cur_tty >> ((sizeof(int)*8)-1));  const char* open_cur_tty_error_str = "Could not open /dev/tty0. Check permissions.";    error_str = select_error_str( error, error_str, open_cur_tty_error, open_cur_tty_error_str );  error     = error | open_cur_tty_error;  // From: http://www.linuxjournal.com/article/2783  // (A little out of date, but a nice primer.)  //  //     "VT_GETSTATE returns the state of all VT's in the kernel in the structure:  //  //         struct vt_stat {  //               ushort v_active;   //               ushort v_signal;   //               ushort v_state;  //          };  //  //      v_active        the currently active VT   //      v_state         mask of all the opened VT's  //  //      v_active holds the number of the active VT (starting from 1), while v_state   //      holds a mask where there is a 1 for each VT that has been opened by some process.   //      Note that VT 0 is always opened in this scenario, since it refers to the current VT.  //  //      Bugs:  //      The v_signal member is unsupported."  struct vt_stat  vts;  const int   get_state_error     = ioctl( cur_tty, VT_GETSTATE, &vts );  const char* get_state_error_str = "VT_GETSTATE failed on /dev/tty0";  error_str = select_error_str( error, error_str, get_state_error, get_state_error_str );  error     = error | get_state_error;  vt->prev_tty_ndx = vts.v_active;  // From: http://opensolaris.org/os/project/vconsole/vt.7i.txt  // (Close enough to Linux and a pretty good source of documentation.)  //  // "VT_OPENQRY  //     This call is used to find an available VT.    The argu-  //     ment to the    ioctl is a pointer to an integer.  The integer  //     will be filled in with the number of the first avail-  //     able VT that no other process has open (and    hence, is  //     available to be opened).  If there are no available  //     VTs, then -1 will be filled in."  const int   open_query_error     = ioctl( cur_tty, VT_OPENQRY, &vt->tty_ndx);  const char* open_query_error_str = "No open ttys available";  error_str = select_error_str( error, error_str, open_query_error, open_query_error_str );  error     = error | open_query_error;  const int   close_cur_tty_error     = close( cur_tty );  const char* close_cur_tty_error_str = "Could not close parent tty";  error_str = select_error_str( error, error_str, close_cur_tty_error, close_cur_tty_error_str );  error     = error | close_cur_tty_error;  char tty_file_name[11];  (void)snprintf( tty_file_name, 11, "/dev/tty%d", vt->tty_ndx );  const int   tty                = open( tty_file_name, O_RDWR );  const int   open_tty_error     = (cur_tty >> ((sizeof(int)*8)-1));  const char* open_tty_error_str = "Could not open tty";  error_str = select_error_str( error, error_str, open_tty_error, open_tty_error_str );  error     = error | open_tty_error;  vt->tty = tty;  // From: http://opensolaris.org/os/project/vconsole/vt.7i.txt  // (Close enough to Linux and a pretty good source of documentation.)  //  // "VT_ACTIVATE  //    This call has the effect of making the VT specified in  //    the argument the active VT. The VT manager will cause  //    a switch to occur in the same manner as if a hotkey had  //    initiated the switch.  If the specified VT is not open  //    or does not exist the call will fail and errno will be  //    set to ENXIO."  //  // "VT_WAITACTIVE  //    If the specified VT is already active, this call  //    returns immediately. Otherwise, it will sleep until  //    the specified VT becomes active, at which point it will  //    return."  const int   activate_tty_error     = ioctl( vt->tty, VT_ACTIVATE, vt->tty_ndx );  const char* activate_tty_error_str = "Could not activate tty";  error_str = select_error_str( error, error_str, activate_tty_error, activate_tty_error_str );  error     = error | activate_tty_error;  const int   waitactive_tty_error     = ioctl( vt->tty, VT_WAITACTIVE, vt->tty_ndx );  const char* waitactive_tty_error_str = "Could not switch to tty";  error_str = select_error_str( error, error_str, waitactive_tty_error, waitactive_tty_error_str );  error     = error | waitactive_tty_error;  // From: http://opensolaris.org/os/project/vconsole/vt.7i.txt  // (Close enough to Linux and a pretty good source of documentation.)  //  //  "KDSETMODE  //   This call is used to set the text/graphics mode to the VT.  //  //      KD_TEXT indicates that console text will be displayed on the screen  //      with this VT. Normally KD_TEXT is combined with VT_AUTO mode for  //      text console terminals, so that the console text display will  //      automatically be saved and restored on the hot key screen switches.  //  //      KD_GRAPHICS indicates that the user/application, usually Xserver,  //      will have direct control of the display for this VT in graphics  //      mode. Normally KD_GRAPHICS is combined with VT_PROCESS mode for  //      this VT indicating direct control of the display in graphics mode.  //      In this mode, all writes to this VT using the write system call are  //      ignored, and the user is responsible for saving and restoring the  //      display on the hot key screen switches."  // Save the current VT mode. This is most likely KD_TEXT.  const int   kdgetmode_error     = ioctl( vt->tty, KDGETMODE, &vt->prev_kdmode );  const char* kdgetmode_error_str = "Could not get mode for tty";  error_str = select_error_str( error, error_str, kdgetmode_error, kdgetmode_error_str );  error     = error | kdgetmode_error;    // Set VT to GRAPHICS (user draw) mode  const int   kdsetmode_graphics_error     = ioctl( vt->tty, KDSETMODE, KD_GRAPHICS );  const char* kdsetmode_graphics_error_str = "Could not set graphics mode for tty";  error_str = select_error_str( error, error_str, kdsetmode_graphics_error, kdsetmode_graphics_error_str );  error     = error | kdsetmode_graphics_error;  //  // Not bothering with VT_PROCESS, VT_AUTO is fine for our purposes.  //   // If vt blanking is active, for example when running this program from a remote terminal,   // setting KD_GRAPHICS will not disable the blanking. Reset to KD_TEXT from KD_GRAPHICS will  // force disable blanking. Then return to KD_GRAPHICS for drawing.  //  // Note: KD_TEXT (default) to KD_TEXT will do nothing, so blanking will not be disable unless  // the mode is changing. i.e. the initial set to KD_GRAPHICS above is useful.  const int   kdsetmode_text_error     = ioctl( vt->tty, KDSETMODE, KD_TEXT );  const char* kdsetmode_text_error_str = "Could not set text mode for tty";  error_str = select_error_str( error, error_str, kdsetmode_text_error, kdsetmode_text_error_str );  error     = error | kdsetmode_text_error;  const int   kdsetmode_graphics_reset_error     = ioctl( vt->tty, KDSETMODE, KD_GRAPHICS );  const char* kdsetmode_graphics_reset_error_str = "Could not reset graphics mode for tty";  error_str = select_error_str( error, error_str, kdsetmode_graphics_reset_error, kdsetmode_graphics_reset_error_str );  error     = error | kdsetmode_graphics_reset_error;  if ( error == -1 )  {      printf("ERROR: vt_graphics_open: %s\n",error_str);      return (-1);  }  return (0);}intcp_vt_close(cp_vt* restrict vt){  const char*    error_str      = NULL;  int            error          = 0;  // Reset previous mode on tty (likely KD_TEXT)  const int   kdsetmode_error     = ioctl( vt->tty, KDSETMODE, vt->prev_kdmode );  const char* kdsetmode_error_str = "Could not reset previous mode for tty";  error_str = select_error_str( error, error_str, kdsetmode_error, kdsetmode_error_str );  error     = error | kdsetmode_error;  // Restore previous tty  const int   activate_tty_error     = ioctl( vt->tty, VT_ACTIVATE, vt->prev_tty_ndx );  const char* activate_tty_error_str = "Could not activate previous tty";  error_str = select_error_str( error, error_str, activate_tty_error, activate_tty_error_str );  error     = error | activate_tty_error;  const int   waitactive_tty_error     = ioctl( vt->tty, VT_WAITACTIVE, vt->prev_tty_ndx );  const char* waitactive_tty_error_str = "Could not switch to previous tty";  error_str = select_error_str( error, error_str, waitactive_tty_error, waitactive_tty_error_str );  error     = error | waitactive_tty_error;  // Close tty  const int   close_tty_error     = close( vt->tty );  const char* close_tty_error_str = "Could not close tty";  error_str = select_error_str( error, error_str, close_tty_error, close_tty_error_str );  error     = error | close_tty_error;  if ( error == -1 )  {      printf("ERROR: vt_close: %s\n",error_str);      return (-1);  }  return (0);}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91丨porny丨首页| 午夜av一区二区| 欧美精品九九99久久| 经典三级视频一区| 日韩一区日韩二区| 精品欧美黑人一区二区三区| 亚洲成av人**亚洲成av**| www.在线欧美| 国产日韩欧美精品电影三级在线| 亚洲福利一二三区| 欧美人妇做爰xxxⅹ性高电影| 亚洲国产一二三| 91论坛在线播放| 椎名由奈av一区二区三区| 欧美日韩三级一区二区| 色天使久久综合网天天| 黄色日韩网站视频| 欧美第一区第二区| 伊人色综合久久天天| 久久久久国产精品厨房| 3d成人动漫网站| 99精品桃花视频在线观看| 1000部国产精品成人观看| 成人综合婷婷国产精品久久蜜臀 | 在线看国产一区二区| 亚洲综合图片区| 久久婷婷一区二区三区| 成人免费视频一区二区| 精品一区二区在线播放| 婷婷六月综合亚洲| 亚洲地区一二三色| 亚洲综合在线视频| 亚洲综合av网| 一区二区三区国产豹纹内裤在线| 国产精品伦一区| 国产精品日产欧美久久久久| 精品久久一区二区| 欧美成人一区二区三区在线观看| 欧美电影影音先锋| 91麻豆精品国产自产在线| 欧美高清性hdvideosex| 91精品婷婷国产综合久久性色| 欧美日韩综合一区| 欧美人体做爰大胆视频| 91 com成人网| 欧美成人性战久久| 精品国产免费人成在线观看| 欧美精品一区二区久久婷婷| 久久久亚洲精品一区二区三区| 久久老女人爱爱| 国产精品素人一区二区| 国产精品九色蝌蚪自拍| 最新日韩在线视频| 亚洲午夜久久久久久久久电影院 | 欧美日韩小视频| 欧美日韩免费一区二区三区| 7777精品伊人久久久大香线蕉超级流畅 | 成人av免费网站| av中文字幕亚洲| 色婷婷狠狠综合| 777奇米四色成人影色区| 精品少妇一区二区三区视频免付费 | 国产在线视频一区二区| 国产成人在线观看免费网站| 91免费视频大全| 欧美久久久久久蜜桃| 久久婷婷国产综合国色天香| 中文字幕一区av| 三级不卡在线观看| 黄色日韩网站视频| 91九色最新地址| 欧美一区二区三区视频在线观看| 久久婷婷成人综合色| 一区二区三区加勒比av| 精品中文字幕一区二区小辣椒| 国产精品亚洲成人| 色网综合在线观看| 欧美大尺度电影在线| 国产精品美女久久久久久| 亚洲动漫第一页| 国产精品一区二区x88av| 91浏览器在线视频| 精品精品欲导航| 日韩理论片网站| 免费观看在线综合色| 成人免费av网站| 欧美精品日韩精品| 国产精品久久精品日日| 蜜臀va亚洲va欧美va天堂| 成人av电影免费在线播放| 91精品国产一区二区三区蜜臀 | 亚洲国产美女搞黄色| 国产麻豆精品视频| 欧美日韩国产首页| 欧美国产日韩一二三区| 成人h动漫精品一区二| 中文字幕av一区 二区| 爽好久久久欧美精品| 成人午夜短视频| 91精品国产一区二区| 亚洲人午夜精品天堂一二香蕉| 免费观看在线色综合| 一本一道波多野结衣一区二区| 欧美v国产在线一区二区三区| 亚洲美女免费视频| 成人午夜电影久久影院| 日韩欧美成人一区| 亚洲国产美女搞黄色| 91丨国产丨九色丨pron| 欧美高清在线一区| 激情综合色综合久久| 欧美巨大另类极品videosbest| 日韩毛片一二三区| 国产在线精品一区在线观看麻豆| 欧美日韩一二三| 亚洲午夜视频在线| 欧洲亚洲国产日韩| 最新日韩av在线| www.亚洲激情.com| 久久久99精品免费观看不卡| 美女性感视频久久| 91精品国产色综合久久ai换脸| 一区二区不卡在线视频 午夜欧美不卡在| 懂色av中文字幕一区二区三区| 精品久久国产老人久久综合| 日本网站在线观看一区二区三区| 在线一区二区三区| 亚洲激情校园春色| av亚洲精华国产精华| 国产精品毛片久久久久久| 国产成人鲁色资源国产91色综| 国产91精品久久久久久久网曝门| 日本高清不卡视频| 国产精品久久久久天堂| 国产69精品久久99不卡| 国产亚洲福利社区一区| 韩国成人精品a∨在线观看| 亚洲一区二区三区视频在线| 国产精品久久久久影院亚瑟 | 亚洲一区中文日韩| 色吧成人激情小说| 亚洲人成伊人成综合网小说| 91在线播放网址| 日韩伦理av电影| 日本精品视频一区二区三区| 最新热久久免费视频| av亚洲精华国产精华精| 亚洲精品国产无套在线观| 日本久久电影网| 婷婷久久综合九色综合绿巨人 | 久久精品二区亚洲w码| 欧美成人乱码一区二区三区| 久久99精品视频| 国产日韩欧美电影| 丁香激情综合五月| 亚洲精品视频自拍| 欧美美女一区二区| 日本不卡的三区四区五区| 欧美不卡123| 不卡在线观看av| 亚洲综合偷拍欧美一区色| 欧美一区二区免费视频| 国产在线不卡视频| 亚洲色图20p| 7777精品伊人久久久大香线蕉经典版下载 | 老司机午夜精品| 国产清纯在线一区二区www| jvid福利写真一区二区三区| 洋洋成人永久网站入口| 欧美一卡2卡三卡4卡5免费| 国产伦精品一区二区三区免费迷 | 亚洲五月六月丁香激情| 精品日产卡一卡二卡麻豆| av在线综合网| 日韩精品乱码免费| 久久综合狠狠综合久久综合88| 豆国产96在线|亚洲| 亚洲亚洲精品在线观看| 精品国产免费一区二区三区四区| 成人av中文字幕| 日韩电影免费在线观看网站| 国产欧美日韩麻豆91| 欧美视频在线播放| 国产高清不卡二三区| 亚洲一区二区三区四区在线观看| 欧美哺乳videos| 欧美伊人久久久久久久久影院 | 欧美主播一区二区三区美女| 激情图片小说一区| 亚洲国产cao| 国产精品网站导航| 日韩欧美国产小视频| 一本久久精品一区二区| 国内精品视频一区二区三区八戒 | 亚洲天堂免费看| 久久噜噜亚洲综合| 91精品国产入口在线| 色婷婷一区二区| 国产酒店精品激情| 三级不卡在线观看|