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

📄 getpwinfo.c

📁 <B>Digital的Unix操作系统VAX 4.2源码</B>
💻 C
字号:
#ifndef lintstatic char sccsid[] = "@(#)getpwinfo.c	4.1 (decvax!larry) 7/2/90";#endif#include "uucp.h"#include <pwd.h>/******* *	guinfo(uid, name, path)	get passwd file info for uid *	int uid; *	char *path, *name; * *	return codes:  0  |  FAIL * *	modified 3/16/81 to use the "real" login name -- mcnc!dennis */guinfo(uid, name, path)int uid;register char *path, *name;{	struct passwd *pwd;	struct passwd *getpwuid(), *getpwnam();	char *getlogin(), *l;	if ((l = getlogin()) != NULL) {		pwd = getpwnam(l);		if (pwd->pw_uid == uid)			goto setup;	}	if ((pwd = getpwuid(uid)) == NULL) {		/* can not find uid in passwd file */		*path = '\0';		return(FAIL);	}    setup:	strcpy(path, pwd->pw_dir);	strcpy(name, pwd->pw_name);	return(0);}/*** *	gninfo(name, uid, path)	get passwd file info for name *	char *path, *name; *	int *uid; * *	return codes:  0  |  FAIL */gninfo(name, uid, path)char *path, *name;int *uid;{	struct passwd *pwd;	struct passwd *getpwnam();	if ((pwd = getpwnam(name)) == NULL) {		/* can not find name in passwd file */		*path = '\0';		return(FAIL);	}	strcpy(path, pwd->pw_dir);	*uid = pwd->pw_uid;	return(0);}

⌨️ 快捷键说明

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