int wantread (searchlist,filename,fullname,prompt);
char *searchlist,*filename,*fullname,*prompt;
FILE *fwantread (searchlist,filename,fullname,prompt);
char *searchlist,*filename,*fullname,*prompt;
Searchlist is a list of directories which may contain the file, with the directory names separated by colons. Filename is the name of the file the program wishes to open; if filename is the null string, then the user will be asked immediately for the name of a file to open. When a file is opened, the complete filename is copied into fullname, which must be a string provided by the user.
If openp(3) fails to open the desired file, then an error message is printed along with the message prompt, and the user can type in an alternate filename. The new file name is searched for using the same searchlist. The user may also indicate that no file is acceptable; in this case, wantread will return an error indication.
Fwantread is the same as wantread, but uses fopenp(3) to open a buffered file, and returns a FILE pointer.
Fwantread returns 0 on error, or the FILE pointer of the successfully fopened file.
There should be a way to change the value of searchlist if the search for a file is unsuccessful.