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

📄 mkldir_path.c

📁 操作系统SunOS 4.1.3版本的源码
💻 C
字号:
#ifndef lint#ifdef SunB1static	char		mls_sccsid[] = "@(#)mkldir_path.c 1.1 92/07/30 SMI; SunOS MLS";#elsestatic	char		sccsid[] = "@(#)mkldir_path.c 1.1 92/07/30 SMI";#endif /* SunB1 */#endif lint/* *	Copyright (c) 1989 Sun Microsystems, Inc. *//* *	Name:		mkldir_path.c * *	Description:	Make a labeled directory path.  Including any missing *		path elements.  Equivalent to the "mkdir -Z label -p" command. *		This routine should not use dirname() since it might be called *		with the return value of dirname() call. * *	Note:	If name points to read-only memory, then this routine will fail. */#include <sys/types.h>#include <sys/label.h>#include <errno.h>#include <string.h>#include "install.h"#include "menu.h"/* *	Local constants: */#define	MODE		02755/* *	Local routines: */static	void		fatal();voidmkldir_path(name, label_p)	char *		name;	blabel_t *	label_p;{	char *		slash_p;		/* ptr to slash */	/*	 *	First, just try to make the directory	 */	if (mkldir(name, MODE, label_p) == 0)		return;	/*	 *	Directory already exists.	 */	if (errno == EEXIST)		return;	/*	 *	Some failure other than "no such entry"	 */	if (errno != ENOENT)		fatal(name, errno);	/*	 *	Strip off the last path element and try again recusively.	 */	slash_p = strrchr(name, '/');	if (slash_p == 0)		fatal(name, errno);	*slash_p = '\0';	mkldir_path(name, label_p);	*slash_p = '/';	/*	 *	Back from recursion so this should work	 */	if (mkldir(name, MODE, label_p) != 0)		fatal(name, errno);} /* end mkldir_path() */static voidfatal(name, code)	char *		name;	int		code;{	menu_log("%s: %s: %s.", progname, name, err_mesg(code));	menu_abort(1);} /* end fatal() */

⌨️ 快捷键说明

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