fileutil(3) — UNIX Programmer’s Manual
NAME
fileutil - file utilities
SYNOPSIS
#include <text/fileutil.h>
DESCRIPTION
These functions provide information about files and directories. They constitute the file utilities of the text library, libtext. The link editor searches this library under the "-ltext" option. Declarations for these functions may be obtained either from the include file <text/fileutil.h>, or from the master include file <text/text.h>.
SUMMARY
long fdSize(int fd)
Returns the size in bytes of the file referred to by fd.
long fileSize(char ∗f);
Returns the size of in bytes of the file named f.
long fdWriteDate(int fd)
Returns the modification date of the file referred to by fd, or -1 in the event of an error.
long fileInode(char ∗f);
Returns the inode number of the file named f.
unsigned short fileMode(char ∗f);
Returns the mode of the file named f.
isDirectory(char ∗s);
True if s is the name of a directory.
char ∗ firstLine(char ∗file);
Returns a pointer to a static array containing the first 80 bytes of file, mapping newlines to \.
char ∗ filetype(char ∗file, struct stat ∗statbuf, char ∗desc);
Attempts to determine the type of file from its name, from the first 512 bytes of the file, and the stat buffer. Returns the type, a short string containing no blanks, which is used as a prefix for type specific files during index construction and in the Digital Librarian. If desc is supplied, then a longer description is returned as well. The strings returned are either part of an allocated table, or static arrays, and should not be freed. If statbuf is not supplied, the file will be lstat’ed. See the file IndexingPaper in the directory /NextLibrary/Documentation/NeXT/RelNotes for more information.
char ∗ filedescFromType(char ∗type)
Given a type, as returned by filetype, returns the matching description.
char ∗ filetypeFromDesc(char ∗desc)
Given a description, as returned by filetype, returns the matching type.
SEE ALSO
text(3), search(3), ixBuild(1)
/NextLibrary/Documentation/NeXT/RelNotes/IndexingPaper
NeXT, Inc. — July 7, 1989