📄 ioctl.c
字号:
/*************************************************************************** * * * db.* * * open source database kernel * * * * Copyright (c) 2000 Centura Software Corporation. All rights reserved. * * * * Use of this software, whether in source code format, or in executable, * * binary object code form, is governed by the CENTURA OPEN SOURCE LICENSE * * which is fully described in the LICENSE.TXT file, included within this * * distribution of source code files. * * * * Except as provided herein, the contents of this file are subject to the * * Centura Open Source Public License Version 1.0 (the "License"); you may * * not use this file except in compliance with the License. A copy of the * * License will be provided to you by Club ITTIA. * * * * Software distributed under the License is distributed on an "AS IS" * * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the * * License for the specific language governing rights and limitations * * under the License. * * * * The Original Code is db.linux version 1.0, released February 29, 2000. * * * * The Initial Developer of the Original Code is Centura Software * * Corporation. Portions created by Centura Software Corporation are * * Copyright (C) 1984-2000 Centura Software Corporation. All Rights * * Reserved. * * * * This file contains modifications to the Original Code made by ITTIA. * * This file may only be used in accordance with the ITTIA DB.* V.2 * * License Agreement which is available at WWW.ITTIA.COM. * * * **************************************************************************//*-------------------------------------------------------------------------- Terminal I/O Control Module--------------------------------------------------------------------------*/#if defined(QNX) || defined(BSDI) || defined(WIN32)/*************************** QNX VERSION *****************************/ioc_on(){}ioc_off(){}#else /* QNX *//************************* UNIX SYSTEM V VERSION **************************/#include <stdio.h>#include <termio.h>#include <unistd.h>/**************************** LOCAL VARIABLES *****************************/static struct termio tio1, tio2;static int iostat = 0;/* ======================================================================== Turn on program's terminal i/o control*/int ioc_on(){ if (!iostat) { ioctl(0, TCGETA, &tio1); ioctl(0, TCGETA, &tio2); tio2.c_lflag = tio2.c_lflag & ~ISIG; tio2.c_lflag = tio2.c_lflag & ~ICANON; tio2.c_lflag = tio2.c_lflag & ~ECHO; tio2.c_cc[VMIN] = '\1'; tio2.c_cc[VTIME] = '\0'; ioctl(0, TCSETA, &tio2); iostat = 1; } return 0;}/* ======================================================================== Turn off program's terminal i/o control*/int ioc_off(){ if (iostat) { ioctl(0, TCSETA, &tio1); iostat = 0; } return 0;}#endif /* QNX */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -