⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ttyslot.c

📁 <B>Digital的Unix操作系统VAX 4.2源码</B>
💻 C
字号:
#ifndef lintstatic	char	*sccsid = "@(#)ttyslot.c	4.1	(ULTRIX)	7/3/90";#endif lint/* @(#)ttyslot.c	4.4 (Berkeley) 1/30/85 *//* * Return the number of the slot in the utmp file * corresponding to the current user: try for file 0, 1, 2. * Definition is the line number in the /etc/ttys file. */#include "ttyent.h"char	*ttyname();char	*rindex();#define	NULL	0ttyslot(){	register struct ttyent *ty;	register char *tp, *p;	register s;	if ((tp = ttyname(0)) == NULL &&	    (tp = ttyname(1)) == NULL &&	    (tp = ttyname(2)) == NULL)		return(0);	if ((p = rindex(tp, '/')) == NULL)		p = tp;	else		p++;	setttyent();	s = 0;	while ((ty = getttyent()) != NULL) {		s++;		if (strcmp(ty->ty_name, p) == 0) {			endttyent();			return (s);		}	}	endttyent();	return (0);}

⌨️ 快捷键说明

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