expand.c File Reference

#include "shell.h"
#include "main.h"
#include "nodes.h"
#include "eval.h"
#include "expand.h"
#include "syntax.h"
#include "parser.h"
#include "jobs.h"
#include "options.h"
#include "var.h"
#include "input.h"
#include "output.h"
#include "memalloc.h"
#include "error.h"
#include "mystring.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <dirent.h>

Include dependency graph for expand.c:

Go to the source code of this file.

Data Structures

struct  ifsregion

Defines

#define MAXLOGNAME   32
#define MAXPWLINE   128

Functions

STATIC void argstr ()
STATIC void expbackq ()
STATIC char * evalvar ()
STATIC int varisset ()
STATIC void varvalue ()
STATIC void recordregion ()
STATIC void ifsbreakup ()
STATIC void expandmeta ()
STATIC void expmeta ()
STATIC void addfname ()
STATIC struct strlistexpsort ()
STATIC struct strlistmsort ()
STATIC int pmatch ()
STATIC char * expudir ()
void expandhere (union node *arg, int fd)
void expandarg (union node *arg, struct arglist *arglist, full)
STATIC void argstr (char *p, full)
STATIC void expbackq (union node *cmd, quoted, full)
STATIC char * evalvar (char *p, full)
STATIC int varisset (char name)
STATIC void varvalue (char name, quoted, allow_split)
STATIC void recordregion (start, end, nulonly)
STATIC void ifsbreakup (char *string, struct arglist *arglist)
STATIC void expandmeta (struct strlist *str)
char * pfgets ()
STATIC char * expudir (char *path)
STATIC void expmeta (char *enddir, char *name)
STATIC void addfname (char *name)
STATIC struct strlistexpsort (struct strlist *str)
STATIC struct strlistmsort (struct strlist *list, len)
int patmatch (char *pattern, char *string)
STATIC int pmatch (char *pattern, char *string)
void rmescapes (char *str)
int casematch (union node *pattern, char *val)

Variables

static char sccsid [] = "@(#)expand.c 5.1 (Berkeley) 3/7/91"
char * expdest
nodelist * argbackq
ifsregion ifsfirst
ifsregionifslastp
arglist exparg
int didudir
char * expdir


Define Documentation

#define MAXLOGNAME   32
 

Definition at line 711 of file expand.c.

Referenced by expudir().

#define MAXPWLINE   128
 

Definition at line 712 of file expand.c.

Referenced by expudir().


Function Documentation

STATIC void addfname char *  name  ) 
 

Definition at line 921 of file expand.c.

References exparg, arglist::lastp, strlist::next, scopy, sp, stalloc(), and strlen().

STATIC void addfname  ) 
 

STATIC void argstr char *  p,
full 
 

Definition at line 212 of file expand.c.

References argbackq, c, CTLBACKQ, CTLENDVAR, CTLESC, CTLQUOTE, CTLVAR, evalvar(), expbackq(), expdest, and STPUTC.

STATIC void argstr  ) 
 

Referenced by casematch(), evalvar(), and expandarg().

int casematch union node pattern,
char *  val
 

Definition at line 1139 of file expand.c.

References argbackq, argstr(), expdest, grabstackstr, ifslastp, NULL, patmatch(), popstackmark(), result, setstackmark(), STARTSTACKSTR, and STPUTC.

Referenced by evalcase().

STATIC char* evalvar char *  p,
full 
 

Definition at line 325 of file expand.c.

References argbackq, argstr(), c, CTLBACKQ, CTLENDVAR, CTLESC, CTLQUOTE, error, errout, expdest, flags, herefd, lookupvar(), shparam::nparam, NULL, nullstr, outfmt(), recordregion(), set(), setvar(), shellparam, special(), stackblock, STACKSTRNUL, STADJUST, STPUTC, strchr, syntax, val, varisset(), varvalue(), VSASSIGN, VSMINUS, VSNORMAL, VSNUL, VSPLUS, VSQUOTE, and VSTYPE.

STATIC char* evalvar  ) 
 

Referenced by argstr().

void expandarg union node arg,
struct arglist arglist,
full 
 

Definition at line 157 of file expand.c.

References argbackq, argstr(), ckfree, didudir, expandmeta(), exparg, expdest, grabstackstr, ifsbreakup(), ifsfirst, ifslastp, INTOFF, INTON, arglist::lastp, arglist::list, ifsregion::next, NULL, p, sp, stalloc(), STARTSTACKSTR, and STPUTC.

Referenced by evalcase(), evalcommand(), evalfor(), expandhere(), and expredir().

void expandhere union node arg,
int  fd
 

Definition at line 139 of file expand.c.

References expandarg(), expdest, herefd, NULL, stackblock, and xwrite().

Referenced by openhere().

STATIC void expandmeta struct strlist str  ) 
 

Definition at line 646 of file expand.c.

References c, ckmalloc(), exparg, expudir(), fflag, i, INTOFF, arglist::lastp, NULL, sp, and strlen().

STATIC void expandmeta  ) 
 

Referenced by expandarg().

STATIC void expbackq union node cmd,
quoted  ,
full 
 

Definition at line 249 of file expand.c.

References argbackq, EINTR, errno, evalbackcmd(), expdest, grabstackstr, herefd, i, if(), ifsfirst, ifslastp, in, INTOFF, p, read, stackblock, syntax, TRACE, and ungrabstackstr().

STATIC void expbackq  ) 
 

Referenced by argstr().

STATIC void expmeta char *  enddir,
char *  name
 

Definition at line 805 of file expand.c.

References CTLESC, and start.

STATIC void expmeta  ) 
 

STATIC struct strlist* expsort struct strlist str  ) 
 

Definition at line 943 of file expand.c.

References msort(), and sp.

STATIC struct strlist* expsort  ) 
 

STATIC char* expudir char *  path  ) 
 

Definition at line 718 of file expand.c.

References didudir, endpwent(), getpwnam(), i, lookupvar(), MAXLOGNAME, MAXPWLINE, NULL, pfgets(), popfile(), prefix, passwd::pw_dir, r, scopy, setinputfile(), stalloc(), strlen(), and TRACE.

STATIC char* expudir  ) 
 

Referenced by expandmeta().

STATIC void ifsbreakup char *  string,
struct arglist arglist
 

Definition at line 575 of file expand.c.

References ifsregion::begoff, CTLESC, ifsregion::endoff, if(), ifs, ifsfirst, ifslastp, ifsval, arglist::lastp, strlist::next, NULL, nullstr, ifsregion::nulonly, sp, stalloc(), start, and strchr.

STATIC void ifsbreakup  ) 
 

Referenced by expandarg().

STATIC struct strlist* msort struct strlist list,
len 
 

Definition at line 957 of file expand.c.

References n, and p.

STATIC struct strlist* msort  ) 
 

Referenced by expsort().

int patmatch char *  pattern,
char *  string
 

Definition at line 1004 of file expand.c.

References pmatch().

Referenced by casematch().

char* pfgets  ) 
 

Referenced by expudir().

STATIC int pmatch char *  pattern,
char *  string
 

Definition at line 1016 of file expand.c.

References c, and CTLESC.

STATIC int pmatch  ) 
 

Referenced by matcher(), patmatch(), and regexec().

STATIC void recordregion start  ,
end  ,
nulonly 
 

Definition at line 550 of file expand.c.

References ifsregion::begoff, ckmalloc(), ifsregion::endoff, ifsfirst, ifslastp, ifsregion::next, NULL, ifsregion::nulonly, and start.

STATIC void recordregion  ) 
 

Referenced by evalvar().

void rmescapes char *  str  ) 
 

Definition at line 1113 of file expand.c.

References CTLESC.

Referenced by parsefname().

STATIC int varisset char  name  ) 
 

Definition at line 431 of file expand.c.

References backgndpid, NULL, shparam::p, and shellparam.

STATIC int varisset  ) 
 

Referenced by evalvar().

STATIC void varvalue char  name,
quoted  ,
allow_split 
 

Definition at line 459 of file expand.c.

References backgndpid, expdest, i, shparam::nparam, num(), oexitstatus, optchar, optval, p, rootpid, sep, shellparam, STPUTC, and syntax.

STATIC void varvalue  ) 
 

Referenced by evalvar().


Variable Documentation

struct nodelist* argbackq
 

Definition at line 83 of file expand.c.

Referenced by argstr(), casematch(), evalvar(), expandarg(), and expbackq().

int didudir
 

Definition at line 92 of file expand.c.

Referenced by docd(), expandarg(), and expudir().

struct arglist exparg
 

Definition at line 86 of file expand.c.

Referenced by addfname(), expandarg(), and expandmeta().

char* expdest
 

Definition at line 82 of file expand.c.

Referenced by argstr(), casematch(), evalvar(), expandarg(), expandhere(), expbackq(), and varvalue().

char* expdir
 

Definition at line 642 of file expand.c.

struct ifsregion ifsfirst
 

Definition at line 84 of file expand.c.

Referenced by expandarg(), expbackq(), ifsbreakup(), and recordregion().

struct ifsregion* ifslastp
 

Definition at line 85 of file expand.c.

Referenced by casematch(), expandarg(), expbackq(), ifsbreakup(), and recordregion().

char sccsid[] = "@(#)expand.c 5.1 (Berkeley) 3/7/91" [static]
 

Definition at line 38 of file expand.c.


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