p4char*
p4_environment_Q(p4char* str, p4cell l)
{
auto char query[32];
register p4cell len = l;
if (len < 31 )
{
memset (query, 0, sizeof(query));
strncpy (query, (char*) str, len );
query[len] = '\0' ;
len = strlen (query);
p4_upper (query, len);
}
if (0 < len && len < 32 && PFE.environ_wl)
{
int i = 3;
while (--i)
{
p4char* nfa = p4_search_wordlist (query, len, PFE.environ_wl);
if (nfa) return nfa;
if (len < 25)
{
strcat (query, "-EXT" );
len = strlen (query);
continue;
}else
break;
}
}
#ifndef ENV_EXT_DLOPEN
#define ENV_EXT_DLOPEN 1
#endif
#if ! ENV_EXT_DLOPEN
return 0;
#else
if (25 < l || l < 4)
return 0;
if (! strncmp ((str) + l-4, "-ext" , 4))
{
extern void* p4_loadm (const p4char*, int);
len = l;
strncpy (query, str, len);
strncpy (query + len-4, ".O" , 4);
if (p4_search_wordlist (query, len-2, PFE.atexit_wl))
return 0;
if (! p4_loadm (query, len-4))
return 0;
}
else if (! strncmp ((str) + l-4, "-EXT" , 4))
{
extern void* p4_loadm (const p4char*, int);
len = l;
strncpy (query, str, len);
strncpy (query + len-4, ".O" , 4);
if (p4_search_wordlist (query, len-2, PFE.atexit_wl))
return 0;
if (! p4_loadm (query, len-4))
{
p4_lower (query, len-4);
if (p4_search_wordlist (query, len-2, PFE.atexit_wl))
return 0;
if (! p4_loadm (query, len-4))
return 0;
}
}else if (str[0] == '-' && isalnum(str[1]) &&
(memchr (str, '.' , l) || memchr (str, '/' , l)))
{
if (str[l-1] == '*' && str[l-2] == '.' )
l -= 2;
if (! p4_required (str+1, l-1))
return 0;
}else{
return 0;
}
{
register p4char* nfa = p4_search_wordlist (str, len, PFE.environ_wl);
if (nfa) return nfa;
}
p4_header_comma (str, len, PFE.environ_wl);
FX_RUNTIME1(p4_value);
FX_UCOMMA (P4_FALSE);
return p4_search_wordlist (str, len, PFE.environ_wl);
#endif
} |