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

📄 fully_qualify.c

📁 操作系统SunOS 4.1.3版本的源码
💻 C
字号:
#ifndef lintstatic char sccsid[] = "@(#)fully_qualify.c 1.1 92/07/30 Copyr 1988 Sun Micro";#endif/* * Copyright (c) 1988 by Sun Microsystems, Inc. */#include <stdio.h>#include <pwd.h>#include <nse/param.h>#include <nse/util.h>char *_nse_fully_qualify(file, fullfile)	char		*file;	char		*fullfile;{	char		pwd[MAXPATHLEN];	char		*p1;	char		*p2;	struct passwd	*pswd;	if (file[0] == '/') {		strcpy(fullfile, file);	} else if (file[0] == '~') {		if (file[1] == '/') {			_nse_get_user((char *) NULL, pwd);			sprintf(fullfile, "%s%s", pwd, &file[1]);		} else if (file[1] == '\0') {			_nse_get_user((char *) NULL, fullfile);		} else {			p1 = &file[1];			if (p2 = index(file, '/')) { 				strncpy(pwd, p1, p2 - p1 + 1);				if (pswd = getpwnam(pwd)) {					sprintf(fullfile, "%s%s", pswd->pw_dir,						p2);				}			} else {				if (pswd = getpwnam(p1)) {					strcpy(fullfile,  pswd->pw_dir);				}			}		}	} else {		getwd(pwd);		sprintf(fullfile, "%s/%s", pwd, file);	}	return(fullfile);}

⌨️ 快捷键说明

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