ctermid.c

来自「操作系统源代码」· C语言 代码 · 共 33 行

C
33
字号
/*  ctermid(3) * *  Author: Terrence Holm          Aug. 1988 * * *  Ctermid(3) returns a pointer to a string naming the controlling *  terminal. If <name_space> is NULL then local PRIVATE storage *  is used, otherwise <name_space> must point to storage of at *  least L_ctermid characters. * *  Returns a pointer to "/dev/tty". */#include <lib.h>#include <string.h>#include <stdio.h>_PROTOTYPE( char *ctermid, (char *name_space));#ifndef L_ctermid#define L_ctermid  9#endifchar *ctermid(name_space)char *name_space;{  PRIVATE char termid[L_ctermid];  if (name_space == (char *)NULL) name_space = termid;  strcpy(name_space, "/dev/tty");  return(name_space);}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?