exec.c File Reference

#include "shell.h"
#include "main.h"
#include "nodes.h"
#include "parser.h"
#include "redir.h"
#include "eval.h"
#include "exec.h"
#include "builtins.h"
#include "var.h"
#include "options.h"
#include "input.h"
#include "output.h"
#include "syntax.h"
#include "memalloc.h"
#include "error.h"
#include "init.h"
#include "mystring.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <limits.h>

Include dependency graph for exec.c:

Go to the source code of this file.

Data Structures

struct  tblentry

Defines

#define CMDTABLESIZE   31
#define ARB   1

Functions

STATIC void tryexec ()
STATIC void execinterp ()
STATIC void printentry ()
STATIC void clearcmdentry ()
STATIC struct tblentrycmdlookup ()
STATIC void delete_cmd_entry ()
void shellexec (char **argv, char **envp, char *path, index)
STATIC void tryexec (char *cmd, char **argv, char **envp)
char * padvance (char **path, char *name)
 hashcmd (argc, char **argv)
STATIC void printentry (struct tblentry *cmdp)
void find_command (char *name, struct cmdentry *entry, printerr)
int find_builtin (char *name)
void hashcd ()
void changepath (char *newval)
STATIC void clearcmdentry (firstchange)
void deletefuncs ()
STATIC struct tblentrycmdlookup (char *name, add)
void addcmdentry (char *name, struct cmdentry *entry)
void defun (char *name, union node *func)
void unsetfunc (char *name)

Variables

static char sccsid [] = "@(#)exec.c 5.2 (Berkeley) 3/13/91"
STATIC struct tblentrycmdtable [CMDTABLESIZE]
STATIC int builtinloc = -1
char * pathopt
tblentry ** lastcmdentry


Define Documentation

#define ARB   1
 

Definition at line 75 of file exec.c.

#define CMDTABLESIZE   31
 

Definition at line 74 of file exec.c.

Referenced by clearcmdentry(), cmdlookup(), deletefuncs(), hashcd(), and hashcmd().


Function Documentation

void addcmdentry char *  name,
struct cmdentry entry
 

Definition at line 774 of file exec.c.

References CMDFUNCTION, cmdlookup(), cmdp, entry, INTOFF, and INTON.

Referenced by defun().

void changepath char *  newval  ) 
 

Definition at line 583 of file exec.c.

References index(), and pathval.

STATIC void clearcmdentry firstchange   ) 
 

Definition at line 628 of file exec.c.

References builtinloc, ckfree, CMDBUILTIN, CMDNORMAL, cmdp, cmdtable, CMDTABLESIZE, INTOFF, and NULL.

STATIC void clearcmdentry  ) 
 

STATIC struct tblentry* cmdlookup char *  name,
add 
 

Definition at line 698 of file exec.c.

References cmdp, cmdtable, CMDTABLESIZE, and equal.

STATIC struct tblentry* cmdlookup  ) 
 

Referenced by addcmdentry(), find_command(), and unsetfunc().

void defun char *  name,
union node func
 

Definition at line 796 of file exec.c.

References addcmdentry(), CMDFUNCTION, entry, func, INTOFF, and INTON.

Referenced by evaltree(), and lccmd().

STATIC void delete_cmd_entry  ) 
 

Definition at line 737 of file exec.c.

References ckfree, cmdp, INTOFF, INTON, and lastcmdentry.

Referenced by unsetfunc().

void deletefuncs  ) 
 

Definition at line 663 of file exec.c.

References ckfree, CMDFUNCTION, cmdp, cmdtable, CMDTABLESIZE, INTOFF, and NULL.

STATIC void execinterp  ) 
 

Referenced by tryexec().

int find_builtin char *  name  ) 
 

Definition at line 541 of file exec.c.

References bp, and equal.

Referenced by evalcommand(), and find_command().

void find_command char *  name,
struct cmdentry entry,
printerr 
 

Definition at line 394 of file exec.c.

References builtinloc, CMDBUILTIN, CMDFUNCTION, cmdlookup(), CMDNORMAL, cmdp, e, EACCES, EINTR, ENOENT, ENOTDIR, entry, errno, error, find_builtin(), getegid, geteuid, getgroups, index(), INTOFF, INTON, loop, ngroups, NULL, padvance(), path, pathopt, pathval, prefix, readcmdfile(), S_IFMT, S_IFREG, stat::st_gid, stat::st_mode, stat::st_uid, stalloc(), stat, strchr, strlen(), stunalloc(), and TRACE.

Referenced by evalcommand(), and prehash().

void hashcd  ) 
 

Definition at line 561 of file exec.c.

References builtinloc, CMDBUILTIN, CMDNORMAL, cmdp, cmdtable, and CMDTABLESIZE.

hashcmd argc  ,
char **  argv
 

Definition at line 313 of file exec.c.

References argc, cmdp, cmdtable, CMDTABLESIZE, entry, printentry(), and verbose.

char* padvance char **  path,
char *  name
 

Definition at line 274 of file exec.c.

References bcopy, growstackblock(), NULL, stackblock, stackblocksize, stalloc(), start, strcpy(), and strlen().

Referenced by cdcmd(), chkmail(), find_command(), printentry(), and shellexec().

STATIC void printentry struct tblentry cmdp  ) 
 

Definition at line 357 of file exec.c.

References CMDBUILTIN, CMDFUNCTION, CMDNORMAL, error, index(), out1c, out1fmt(), out1str(), padvance(), path, pathval, and stunalloc().

STATIC void printentry  ) 
 

Referenced by hashcmd().

void shellexec char **  argv,
char **  envp,
char *  path,
index 
 

Definition at line 116 of file exec.c.

References tblentry::cmdname, e, E_EXEC, ENOENT, ENOTDIR, errmsg, errno, error2(), index(), NULL, padvance(), pathopt, strchr, stunalloc(), and tryexec().

Referenced by execcmd().

STATIC void tryexec char *  cmd,
char **  argv,
char **  envp
 

Definition at line 142 of file exec.c.

References arg0, commandname, e, EINTR, ENOEXEC, errno, execinterp(), execve, exraise(), EXSHELLPROC, initshellproc(), p, parsenextc, parsenleft, pgetc(), pungetc(), savestr, setinputfile(), and setparam().

STATIC void tryexec  ) 
 

Referenced by shellexec().

void unsetfunc char *  name  ) 
 

Definition at line 815 of file exec.c.

References CMDFUNCTION, cmdlookup(), cmdp, delete_cmd_entry(), and NULL.

Referenced by unsetcmd().


Variable Documentation

STATIC int builtinloc = -1
 

Definition at line 89 of file exec.c.

Referenced by clearcmdentry(), find_command(), and hashcd().

STATIC struct tblentry* cmdtable[CMDTABLESIZE]
 

Definition at line 88 of file exec.c.

Referenced by clearcmdentry(), cmdlookup(), deletefuncs(), hashcd(), and hashcmd().

struct tblentry** lastcmdentry
 

Definition at line 694 of file exec.c.

Referenced by delete_cmd_entry().

char* pathopt
 

Definition at line 271 of file exec.c.

Referenced by chkmail(), find_command(), and shellexec().

char sccsid[] = "@(#)exec.c 5.2 (Berkeley) 3/13/91" [static]
 

Definition at line 38 of file exec.c.


Generated on Fri Apr 14 22:58:33 2006 for minix by  doxygen 1.4.6