_export char *
p4_pocket_expanded_filename (const char *nm, int ln,
const char *paths, const char *exts)
{
if (*nm == PFE_DIR_DELIMITER || *nm == '~' )
{
char* path = p4_pocket ();
p4_store_filename (nm, ln, path, P4_POCKET_SIZE);
try_extensions (path, exts);
return path;
}else{
char* path = p4_pocket ();
char* pock;
p4_store_filename (nm, ln, path, P4_POCKET_SIZE);
if (try_extensions (path, exts))
return path;
pock = p4_pocket ();
while (*paths)
{
char *p = pock;
while (*paths && *paths == PFE_PATH_DELIMITER)
{ paths++; }
if (!*paths) break;
do { *p++ = *paths++; }
while (*paths && *paths != PFE_PATH_DELIMITER);
if (p[-1] != PFE_DIR_DELIMITER) *p++ = PFE_DIR_DELIMITER;
if (ln + p-pock > P4_POCKET_SIZE) continue;
strncpy (p, nm, ln);
p4_store_filename (pock, ln + p-pock, path, P4_POCKET_SIZE);
if (try_extensions (path, exts))
return path;
}
p4_store_filename (nm, ln, path, P4_POCKET_SIZE);
return path;
}
} |