Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

55 lines
1.1 KiB

/***************************** Module Header ****************************\
* Copyright (c) 1990-1999 Microsoft Corporation
*
* Module Name: util.c
*
* Extended functions for opening files on environment paths.
*
* Created: 01-May-90
*
* History:
* 01-May-90 created by SMeans
*
\************************************************************************/
#include <stdio.h>
#include <string.h>
FILE *pfopen(const char *path, char *search, const char *type)
{
char szTmp[256];
char *pszEnd;
char c;
FILE *fp;
if (!(pszEnd = search)) {
return fopen(path, type);
}
c = *search;
while (c) {
while (*pszEnd && *pszEnd != ';') {
pszEnd++;
}
c = *pszEnd;
*pszEnd = '\0';
strcpy(szTmp, search);
*pszEnd = c;
if (szTmp[strlen(szTmp) - 1] != '\\') {
strcat(szTmp, "\\");
}
strcat(szTmp, path);
if (fp = fopen(szTmp, type)) {
return fp;
}
search = ++pszEnd;
}
return (FILE *)NULL;
}