/***********************************************************************
* *
* 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
/*
* G. S. Fowler
* D. G. Korn
* AT&T Bell Laboratories
*
* shell library support
*/
#include <ast.h>
/*
* return pointer to the full path name of the shell
*
* SHELL is read from the environment and must start with /
*
* if set-uid or set-gid then the executable and its containing
*
* root/administrator has its own test
*
* astconf("SH",NiL,NiL) is returned by default
*
* not done for `csh script arg ...'
*/
char*
pathshell(void)
{
register char* sh;
int ru;
int eu;
int rg;
int eg;
static char* val;
if ((sh = getenv("SHELL")) && *sh == '/' && strmatch(sh, "*/(sh|*[!cC]sh)*([[:digit:]])?(-+([.[:alnum:]]))?(.exe)"))
{
{
goto defshell;
goto defshell;
}
else
{
{
char* s;
s = sh;
for (;;)
{
goto defshell;
goto defshell;
goto defshell;
if (s != sh)
break;
goto defshell;
break;
*s = 0;
s = dir;
}
}
}
return sh;
}
{
}
return sh;
}