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

📄 fileops.c

📁 将rft格式文件转换成html格式文件
💻 C
字号:
/* * fileops.c -- file operations for UNIX versions of translators. *//* * UnixOpenLibFile () - Open a library file.  Looks in the following * directories: * - Looks in current directory. * - if RTFLIBDIR environment variable is set, looks in directory named by it. * - Looks in executable program's directory, if UnixSetProgPath() has * been called. * - Looks in library directory, LIBDIR. * * Exception: if file is an absolute pathname, look only for file as named. * * Returns NULL if file cannot be found and opened. */ # include	<stdio.h> # include	"rtf.h"# include	"rtf-unix.h" extern char	*getenv (); static char	*progPath = (char *) NULL;  voidUnixSetProgPath (path)char	*path;{int	i, j, n;	n = strlen (path);	for (j = -1, i = 0; i < n; i++)	{		if (path[i] == '/')			j = i;	}	if (j < 0)		/* no slash found */	{		path = ".";		j = 1;	}	if ((progPath = RTFAlloc (j + 1)) != (char *) NULL)	{		(void) strncpy (progPath, path, j);		progPath[j] = '\0';	}}  FILE *UnixOpenLibFile (file, mode)char	*file;char	*mode;{FILE	*f;char	buf[rtfBufSiz];char	*p; 	if ((f = fopen (file, mode)) != (FILE *) NULL)	{		return (f);	}	/* if abolute pathname, give up, else look in library */	if (file[0] == '/')	{		return ((FILE *) NULL);	}	if ((p = getenv ("RTFLIBDIR")) != (char *) NULL)	{		sprintf (buf, "%s/%s", p, file);		if ((f = fopen (buf, mode)) != (FILE *) NULL)			return (f);	}	if (progPath != (char *) NULL)	{		sprintf (buf, "%s/%s", progPath, file);		if ((f = fopen (buf, mode)) != (FILE *) NULL)			return (f);	}	sprintf (buf, "%s/%s", LIBDIR, file);	f = fopen (buf, mode);	/* NULL if it fails */	return (f);}

⌨️ 快捷键说明

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