/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* UNIX shell
*/
#include "hash.h"
#include "defs.h"
#include <errno.h>
static unsigned char cost;
static int dotpath;
static int multrel;
static int argpath();
static void pr_path(unsigned char *, int);
short
unsigned char *com;
int flg;
{
ENTRY *h;
int count = 0;
int i;
int pathset = 0;
int oldpath = 0;
struct namnod *n;
return(COMMAND);
if (h)
{
{
if (flg)
h->hits++;
return(h->data);
}
return(PATH_COMMAND);
{
else
h->data = 0;
goto pathsrch;
}
{
if (flg)
h->hits++;
return(h->data);
}
h->data = 0;
h->cost = 0;
}
{
count = 1;
}
else
{
return(PATH_COMMAND);
}
if (count > 0)
{
if (h == 0)
{
}
if (h->data == 0)
{
else
{
}
}
return(h->data);
}
else
{
return(-count);
}
}
static void
zapentry(h)
ENTRY *h;
{
}
void
zaphash()
{
}
void
zapcd()
{
while (ptr)
{
}
}
static void
hashout(h)
ENTRY *h;
{
sigchk();
return;
return;
if (h->data & REL_COMMAND)
prc_buff('*');
}
void
hashpr()
{
}
void
set_dotpath(void)
{
unsigned char *path;
dotpath = 10000;
{
if (*path == '/')
cnt++;
else
{
if (dotpath == 10000)
else
{
multrel = 1;
return;
}
}
}
multrel = 0;
}
void
{
ENTRY *h;
if (h)
else
{
}
}
void
{
ENTRY *h;
int i;
else
}
}
short
unsigned char *name;
{
ENTRY *h;
return(COMMAND);
if (h)
{
return(h->data);
{ /* unlink h from relative command list */
}
zapentry(h);
}
}
/*
* Return 0 if found, 1 if not.
*/
int
{
ENTRY *h;
int cnt;
short hashval;
if (h)
{
{
case BUILTIN:
return (0);
case FUNCTION:
{
prs_buff("(){\n");
if (f != NULL)
prs_buff("\n}\n");
return (0);
}
case REL_COMMAND:
{
short hash;
{
{
" found\n"));
return (1);
}
else
}
}
case COMMAND:
prs_buff(")\n");
return (0);
}
}
{
return (0);
}
{
return (0);
}
else
{
return (1);
}
}
int
{
unsigned char *path;
unsigned char *p;
cost = 0;
if (oldpath)
{
while (--count)
{
p = curstak();
cost = 1;
return(dotpath);
else
return(oldpath);
}
else
}
while (path)
{
cost++;
p = curstak();
break;
else
count++;
}
}
/*
* Determine if file given by name is accessible with permissions
* given by mode.
* Regflag argument non-zero means not to consider
* a non-regular file as executable.
*/
int
{
static int flag;
if(flag == 0) {
flag = 1;
}
return(2);
if(euid == 0) {
return(0);
/* root can execute file as long as it has execute
permission for someone */
return(0);
return(3);
}
return(0);
}
}
}
static void
{
unsigned char *path;
}
static int
{
unsigned char *s;
unsigned char *start;
while (arg)
{
start = s;
if (letter(*s))
{
while (alphanum(*s))
s++;
if (*s == '=')
{
*s = 0;
{
*s = '=';
return(1);
}
else
*s = '=';
}
}
}
return(0);
}