.TP
.B GVPRPATH
Colon\(hyseparated list of directories to be searched to find
-the file specified by the \-f option.
+the file specified by the \-f option. \fBgvpr\fP has a default list built in. If \fBGVPRPATH\fP
+is not defined, the default list is used. If \fBGVPRPATH\fP starts with colon, the list is formed
+by appending \fBGVPRPATH\fP to the default list. If \fBGVPRPATH\fP ends with colon, the list is formed
+by appending the default list to \fBGVPRPATH\fP. Otherwise, \fBGVPRPATH\fP is used for the list.
+.P
+On Windows systems, replace ``colon'' with ``semicolon'' in the previous paragraph.
.SH BUGS AND WARNINGS
Scripts should be careful deleting nodes during \fBN{}\fP and \fBE{}\fP
blocks using BFS and DFS traversals as these rely on stacks and queues of
#define LISTSEP ':'
#endif
+static Sfio_t*
+concat (char* pfx, char* sfx, char** sp)
+{
+ Sfio_t *pathp;
+ if (!(pathp = sfstropen())) {
+ error(ERROR_ERROR, "Could not open buffer");
+ return 0;
+ }
+ sfprintf(pathp, "%s%s", pfx, sfx);
+ *sp = sfstruse(pathp);
+ return pathp;
+}
+
/* resolve:
* Translate -f arg parameter into a pathname.
* If arg contains '/', return arg.
char *path;
char *s;
char *cp;
+ char c;
char *fname = 0;
Sfio_t *fp;
+ Sfio_t *pathp = NULL;
size_t sz;
#ifdef WIN32_DLL
path = getenv("GVPRPATH");
if (!path)
path = getenv("GPRPATH"); // deprecated
- if (!path)
+ if (path && (c = *path)) {
+ if (c == LISTSEP) {
+ pathp = concat(DFLT_GVPRPATH, path, &path);
+ }
+ else if ((c = path[strlen(path)-1]) == LISTSEP) {
+ pathp = concat(path, DFLT_GVPRPATH, &path);
+ }
+ }
+ else
path = DFLT_GVPRPATH;
if (!(fp = sfstropen())) {
error(ERROR_ERROR, "Could not find file \"%s\" in GVPRPATH", arg);
sfclose(fp);
+ if (pathp)
+ sfclose(pathp);
return fname;
}