NAME

dirfiles, filemode, filesize, is_file, is_dir, is_present, is_empty, is_nfs, is_changed, is_writable_file - check paths

SYNOPSIS

#include "stock.h"

int is_file(char *path)
int is_writable_file(char *path)

unsigned int filesize(char *path)
unsigned int filemode(char *path)

int is_dir(char *path)

int is_present(char *path)

int is_empty(char *path)

int is_nfs(char *path)

int is_changed(char *path)

Tbl * dirfiles ( char *path, int flag );

DESCRIPTION

is_file uses stat(2) to test path, returns 1 if path is a plain file, 0 otherwise. is_writable_file uses stat(2) to test path, returns 1 if path is a plain file and permissions allow writing to, or if path doesn't exist, but the directory is writable; if neither condition is true, zero is returned. If path is a plain file, filesize returns its size. filemode returns the mode (permissions) of a file.

is_dir uses stat(2) to test path, returns 1 if path is a directory, 0 otherwise.

is_present uses stat(2) to test path, returns 1 if path exists, 0 otherwise.

is_empty uses stat(2) to test path; for a plain file, it returns 1 if path has a size of zero, 0 otherwise. For a directory, it returns 1 if the path contains no files, 0 otherwise.

is_nfs checks to see if a file or directory is nfs mounted, returning 1 if it is, 0 otherwise

is_changed keeps a list of paths and modification times, and returns 1 when a path's modification time has changed, 0 otherwise. It always returns 1 on the first call with an existing path, and returns 0 if a path does not exist.

dirfiles returns a list of contents of a directory path. If flag is 0, all entries are returned; if flag is 1, only files are returned; if flag is 2 only directories are returned. The returned list is sorted into alphabetic order, and the directories "." and ".." are omitted. The returned Tbl list should be freed with freetbl(list, free).

RETURN VALUES

is_file returns 1 if path is a plain file, 0 otherwise. is_writable_file returns 1 if path is a plain writable or can be created by the caller, 0 otherwise. filesize returns the file size if path is a plain file, 0 otherwise. is_empty returns 1 if path has size 0, 0 otherwise. is_present returns 1 if path exists, 0 otherwise. is_dir returns 1 if path is a directory, 0 otherwise. is_nfs returns 1 if path is on nfs mounted directory, 0 otherwise.

LIBRARY

$(STOCKLIBS)

AUTHOR

Daniel Quinlan

Table of Contents
Antelope Release 4.7 Darwin 7.9.0 2005-07-18
Boulder Real Time Technologies, Inc For more information, contact support@brtt.com