OPENP(3X) GENIX Programmer's Manual OPENP(3X)
NAME
openp, fopenp - open file using search path
SYNOPSIS
openp (path, fname, fullname, mode)
char *path, *fname, *fullname;
int mode;
#include <stdio.h>
FILE *fopenp (path, fname, fullname, mode)
char *path, *fname, *fullname, *mode;
cc ... -lnsc
DESCRIPTION
Openp constructs a sequence of full pathnames from the file leafname
fname and the sh(1)-style search path path. As each pathname is
constructed, openp attempts to open(2) the file so designated with
the I/O mode mode. As soon as an attempt is successful, openp
returns the resulting file descriptor. On return, fullname points
to the last pathname constructed; on entry it must point to suffi-
cient space to hold the longest of these.
Fopenp is a version of openp that interfaces to the standard I/O
library; it uses fopen(3) in place of open(2) and returns a FILE
pointer in place of a file descriptor.
These functions are kept in the nsc library.
CAVEATS
If fopenp is called with a mode that allows writing, a file early in
the search sequence may be created from scratch, even though a file
later in the search sequence already exists.
DIAGNOSTICS
If no fullname succeeds, openp returns -1, whereas fopenp returns
the pointer NULL.
SEE ALSO
open(2), fopen(3), sh(1)
Printed 11/16/83 1