Digital的Unix操作系统VAX 4.2源码

源代码在线查看: directory.3s

软件大小: 51179 K
上传用户: zhuying0000
关键词: Digital Unix 4.2 VAX
下载地址: 免注册下载 普通下载 VIP

相关代码

				..From teklabs!ogcvax!root  Tue Aug  3 05:14:38 1982				..TH DIRECTORY 3  "OGC Revision  8/02/82"				.TH DIRECTORY 3X 8/1/82				.UC 4.1b Compatability				.SH NAME				opendir, readdir, telldir, seekdir, rewinddir, closedir \- flexible length directory operations				.SH SYNOPSIS				.B #include 				.PP				.SM				.B DIR				.B *opendir(filename)				.br				.B char *filename;				.PP				.SM				.B struct direct				.B *readdir(dirp)				.br				.B DIR *dirp;				.PP				.SM				.B long				.B telldir(dirp)				.br				.B DIR *dirp;				.PP				.SM				.B seekdir(dirp, loc)				.br				.B DIR *dirp;				.br				.B long loc;				.PP				.SM				.B rewinddir(dirp)				.br				.B DIR *dirp;				.PP				.SM				.B closedir(dirp)				.br				.B DIR *dirp;				.PP				.SM				.B cc ... -lndir				.SH DESCRIPTION				The purpose of this library is to simulate				the new flexible length directory names of 4.2bsd Unix				on top of the old directory structure of 4.1bsd.				It allows programs to be converted immediately				to the new directory access interface,				so that they need only be relinked				when 4.2bsd becomes available.				.PP				.I opendir				opens the directory named by				.I filename				and associates a				.I directory stream				with it.				.I opendir				returns a pointer to be used to identify the				.I directory stream				in subsequent operations.				The pointer				.SM				.B NULL				is returned if				.I filename				cannot be accessed or is not a directory.				.PP				.I readdir				returns a pointer to the next directory entry.				It returns				.B NULL				upon reaching the end of the directory or detecting				an invalid				.I seekdir				operation.				.PP				.I telldir				returns the current location associated with the named				.I directory stream.				.PP				.I seekdir				sets the position of the next				.I readdir				operation on the				.I directory stream.				The new position reverts to the one associated with the				.I directory stream				when the				.I telldir				operation was performed.				Values returned by				.I telldir				are good only for the lifetime of the DIR pointer from 				which they are derived.				If the directory is closed and then reopened, 				the 				.I telldir				value may be invalidated				due to undetected directory compaction.				It is safe to use a previous				.I telldir				value immediately after a call to				.I opendir				and before any calls to				.I readdir.				.PP				.I rewinddir				resets the position of the named				.I directory stream				to the beginning of the directory.				.PP				.I closedir				causes the named				.I directory stream				to be closed,				and the structure associated with the DIR pointer to be freed.				.PP				See /usr/include/dir.h for a description of the fields available in				a directory entry.				The preferred way to search the current directory for entry "name" is:				.br				.sp					len = strlen(name);				.br					dirp = opendir(".");				.br					for (dp = readdir(dirp); dp != NULL; dp = readdir(dir))				.br						if (dp->d_namlen == len && !strcmp(dp->d_name, name)) {				.br							closedir(dirp);				.br							return FOUND;				.br						}				.br					closedir(dirp);				.br					return NOT_FOUND;				.SH LINKING				This library is accessed by specifying "-lndir" as the				last argument to the compile line, e.g.:				.br				.sp					cc -o prog prog.c -lndir				.SH "SEE ALSO"				/usr/include/dir.h,				open(2),				close(2),				read(2),				lseek(2)				.SH AUTHOR				Kirk McKusick.				Report problems to mckusick@berkeley or ucbvax!mckusick.							

相关资源