/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1985-2012 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 Research
*
* return in path the full path name of the probe(1)
* information for lang and tool using proc
* if attr != 0 then path attribute assignments placed here
*
* if path==0 then the space is malloc'd
*
* op:
*
* -3 return non-writable path name with no generation
* -2 return path name with no generation
* -1 return no $HOME path name with no generation
* 0 verbose probe
* 1 silent probe
*
* 0 returned if the info does not exist and cannot be generated
*/
#include <ast.h>
#include <error.h>
#include <ls.h>
#include <proc.h>
char*
{
}
#include <ast_api.h>
#ifndef PROBE
#endif
/*
* return non-0 if path is in a readonly or non-setuid fs
*/
static int
{
{
#if defined(ST_RDONLY)
return 1;
#endif
#if defined(ST_NOSUID)
if ((vfs.f_flag & ST_NOSUID) && (stat(path, &st) || st.st_uid != getuid() && st.st_uid != geteuid()))
return 1;
#endif
}
return 0;
}
#else
#define rofs(p) 0
#endif
char*
pathprobe_20100601(const char* lang, const char* tool, const char* aproc, int op, char* path, size_t pathsize, char* attr, size_t attrsize)
{
register char* p;
register char* k;
register char* x;
register char** ap;
int n;
int v;
int force;
ssize_t r;
char* e;
char* np;
char* nx;
char* probe;
const char* dirs;
const char* dir;
unsigned long ptime;
if (*proc != '/')
{
{
}
else if (p)
{
}
}
if (!path)
{
}
if (op >= -2)
{
}
return 0;
for (;;)
{
if (n < (PATH_MAX - 5))
{
path[n] = 0;
}
break;
/*
*
* do a manual pathaccess() to find a dir with both
*/
for (;;)
{
return 0;
{
break;
}
}
}
p = np;
x = nx;
{
if (!(p = getenv("HOME")))
return 0;
}
strncopy(p, k, x - p);
force = 0;
{
{
/*
* verify (<sep><name><sep><option><sep><value>)* header
*/
{
{
while (*x && *x != ' ')
x++;
while (*x == ' ')
x++;
if (n = *x++)
for (;;)
{
for (k = x; *x && *x != n; x++);
if (!*x)
break;
*x++ = 0;
for (p = x; *x && *x != n; x++);
if (!*x)
break;
*x++ = 0;
for (e = x; *x && *x != n; x++);
if (!*x)
break;
*x++ = 0;
if (streq(k, "VERSION"))
{
*ap++ = p;
*ap = 0;
ops[1] = 0;
{
if ((v = x - e) >= sizeof(ver))
v = sizeof(ver) - 1;
k = p = ver;
for (;;)
{
if (k >= p)
{
if (v <= 0)
break;
{
continue;
break;
}
if (r <= 0)
break;
v -= r;
p = k + r;
}
if (*k == '\n' || *k == '\r')
break;
if (*k == n)
*k = ' ';
k++;
}
*k = 0;
{
force = 1;
}
}
break;
}
}
}
}
if (!force)
op = -1;
}
{
if (op == 0)
error(0, "%s probe information for %s language processor %s must be manually regenerated", tool, lang, proc);
op = -1;
force = 0;
}
}
if (op >= 0)
{
if (force)
*ap++ = "-f";
if (op > 0)
*ap++ = "-s";
*ap = 0;
return 0;
return 0;
}
}