/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1985-2011 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* David Korn <dgk@research.att.com> *
* Phong Vo <kpv@research.att.com> *
* *
***********************************************************************/
#pragma prototyped
/*
* Glenn Fowler
* AT&T Bell Laboratories
*
* generate 14 char lookup key for lang path in key
* based on 32-bit checksum on path
*
* if key==0 then space is malloc'd
* if attr != 0 then attribute var assignments placed here:
* ATTRIBUTES list of attribute names
*/
#include <ast.h>
#include <ctype.h>
#include <fs3d.h>
#include <preroot.h>
#include <ls.h>
char*
{
}
#include <ast_api.h>
char*
pathkey_20100601(const char* lang, const char* tool, const char* apath, char* key, size_t keysize, char* attr, size_t attrsize)
{
register char* s;
register char* k;
char* t;
char* flags;
char** p;
int c;
unsigned long n;
#if _UWIN
#endif
if (!key)
{
k = key;
for (n &= 0xffffffffL; n; n >>= 4)
*k++ = let[n & 0xf];
*k = 0;
}
else
{
for (c = 0; c < elementsof(env); c++)
env[c] = 0;
n = 0;
/*
* trailing flags in path
*/
{
flags = 0;
else
{
}
}
/*
* 3D
*/
if (!flags && fs3d(FS3D_TEST) && (c = mount(path, tmp, FS3D_GET|FS3D_ALL|FS3D_SIZE(PATH_MAX), NiL)) > 1 && c < PATH_MAX)
/*
* preroot
*/
if (attr)
#if FS_PREROOT
{
if (s = strrchr(k, '/'))
k = s + 1;
}
#else
{
if (attr)
}
#endif
#if _UWIN
{
k = "/64";
if (attr)
}
#endif
/*
* universe
*/
if (attr)
{
if (attr)
}
/*
* environment
*
* ${PROBE_ATTRIBUTES} || ${VERSION_ENVIRONMENT} : list of alternate env vars
* ${VERSION_ENVIRONMENT} : list of alternate env vars
* ${VERSION_<lang>}
* ${VERSION_<base(path)>}
* ${<toupper(base(path))>VER}
* ${OBJTYPE}
*/
if (attr)
*attr++ = '\'';
c = 0;
usr[c++] = "OBJTYPE";
if (!(k = getenv("PROBE_ATTRIBUTES")))
k = getenv("VERSION_ENVIRONMENT");
if (k)
{
while (*k && (*k == ':' || *k == ' '))
k++;
if (!*k)
break;
usr[c++] = k;
while (*k && *k != ':' && *k != ' ')
k++;
}
usr[c] = 0;
s = buf;
if (isdigit(*k))
{
if (*k == '3' && *(k + 1) == 'b')
{
/*
* cuteness never pays
*/
k += 2;
*s++ = 'B';
*s++ = 'B';
*s++ = 'B';
}
else
*s++ = 'U';
}
{
if (!isalnum(c))
c = '_';
else if (islower(c))
c = toupper(c);
*s++ = c;
}
*s = 0;
for (p = environ; *p; p++)
{
s = "VERSION_";
for (k = *p; *k && *k == *s; k++, s++);
if (*k && !*s)
{
for (c = 0; c < elementsof(ver); c++)
{
for (t = k; *t && *t != '=' && *t++ == *s; s++);
{
env[c] = *p;
goto found;
}
}
}
if (!env[2])
{
s = buf;
for (k = *p; *k && *s++ == *k; k++);
{
env[2] = *p;
goto found;
}
}
{
for (k = *p; *k && *k == *s; k++, s++);
if (*k == '=' && (!*s || *s == ':' || *s == ' '))
{
goto found;
}
}
found: ;
}
for (c = 0; c < elementsof(env); c++)
if (k = env[c])
{
if (attr)
{
*attr++ = ' ';
while ((*attr++ = *k++) != '=');
*attr++ = '\'';
*attr++ = '\'';
}
else
while (*k && *k++ != '=');
}
if (attr)
{
for (c = 0; c < elementsof(env); c++)
if (k = env[c])
{
*attr++ = ' ';
while ((*attr = *k++) != '=')
attr++;
}
*attr++ = '\'';
*attr = 0;
}
/*
* now the normal stuff
*/
if (flags)
*flags = ' ';
k = key + 14;
*k = 0;
if (!flags)
t = path;
else if ((t = s - 4) < flags)
t = flags + 1;
for (;;)
{
if (--s < t)
{
if (t == path)
break;
s = flags - 2;
t = path;
}
if (*s != '/' && *s != ' ')
{
*--k = *s;
if (k <= key + 8)
break;
}
}
while (k > key + 8)
*--k = '.';
}
}