isatty.c
来自「这是一个同样来自贝尔实验室的和UNIX有着渊源的操作系统, 其简洁的设计和实现易」· C语言 代码 · 共 30 行
C
30 行
#include "lib.h"#include <string.h>#include <sys/types.h>#include <sys/stat.h>#include "sys9.h"#include "dir.h"int_isatty(int fd){ int t; char buf[64]; if(_FD2PATH(fd, buf, sizeof buf) < 0) return 0; /* might be /mnt/term/dev/cons */ return strlen(buf) >= 9 && strcmp(buf+strlen(buf)-9, "/dev/cons") == 0;}/* The FD_ISTTY flag is set via _isatty in _fdsetup or open */intisatty(fd){ if(_fdinfo[fd].flags&FD_ISTTY) return 1; else return 0;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?