1N/A/*********************************************************************** 1N/A* This software is part of the ast package * 1N/A* Copyright (c) 1982-2011 AT&T Intellectual Property * 1N/A* and is licensed under the * 1N/A* Common Public License, Version 1.0 * 1N/A* by AT&T Intellectual Property * 1N/A* A copy of the License is available at * 1N/A* (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) * 1N/A* Information and Software Systems Research * 1N/A* David Korn <dgk@research.att.com> * 1N/A***********************************************************************/ 1N/A * Shell initialization 1N/A#
endif /* SHOPT_FS_3D */ 1N/A#
endif /* SHOPT_COSHELL */ 1N/A#
endif /* _hdr_locale */ 1N/A * Invalidate all path name bindings 1N/A * out of memory routine for stak routines 1N/A/* Trap for VISUAL and EDITOR variables */ 1N/A /* turn on vi or emacs option if editor name is either*/ 1N/A/* Trap for HISTFILE and HISTSIZE variables */ 1N/A/* Trap for OPTINDEX */ 1N/A/* Trap for restricted variables FPATH, PATH, SHELL, ENV */ 1N/A * This function needs to be modified to handle international 1N/A * error message translations 1N/A /* Trap for LC_ALL, LC_CTYPE, LC_MESSAGES, LC_COLLATE and LANG */ 1N/A#
endif /* _hdr_locale */ 1N/A/* Trap for IFS assignment and invalidates state table */ 1N/A * This is the lookup function for IFS 1N/A * It keeps the sh.ifstable up to date 1N/A while(c= *(
unsigned char*)
cp++)
1N/A#
endif /* SHOPT_MULTIBYTE */ 1N/A#
endif /* SHOPT_MULTIBYTE */ 1N/A * these functions are used to get and set the SECONDS variable 1N/A * These three functions are used to get and set the RANDOM variable 1N/A * get random number in range of 0 - 2**15 1N/A * never pick same number twice in a row 1N/A * These three routines are for LINENO 1N/A * store the most recent value for use in .sh.match 1N/A if (c >=
'0' && c <=
'9')
1N/A * set or unset the mappings given a colon separated list of directories 1N/A /* catch vpath assignments */ 1N/A#
endif /* SHOPT_FS_3D */ 1N/A#
endif /* SHOPT_COSHELL */ 1N/A#
endif /* SHOPT_NAMESPACE */ 1N/A#
endif /* _hdr_locale */ 1N/A * This function will get called whenever a configuration parameter changes 1N/A /* set directory in new universe */ 1N/A /* clear out old tracked alias */ 1N/A static void a2e(
char *d,
const char *s)
1N/A register const unsigned char *t;
1N/A * return SH_TYPE_* bitmask for path 1N/A * 0 for "not a shell" 1N/A register const char* s;
1N/A if (*s ==
'b' && *(s+
1) ==
'a')
1N/A if (*s ==
'p' && *(s+
1) ==
'f')
1N/A if (*s++ ==
's' && (*s ==
'h' || *s ==
'u'))
1N/A if (*s ==
'.' && *(s+
1) ==
'e' && *(s+
2) ==
'x' && *(s+
3) ==
'e')
1N/A * initialize the shell 1N/A#
endif /* SHOPT_FS_3D */ 1N/A /* NOTE: only shp is used by __regress__ at this point */ 1N/A while ((a = *++
av) && a[0] ==
'-' && (a[
1] ==
'I' || a[
1] ==
'-' && a[
2] ==
'r'))
1N/A else if (a[
9] ==
'=')
1N/A for(n=0;n <
10; n++)
1N/A /* don't use lower bits when rand() generates large numbers */ 1N/A /* initialize signal handling */ 1N/A /* set up memory for name-value pairs */ 1N/A /* read the environment */ 1N/A * try to find the pathname for this interpreter 1N/A * try using environment variable _ or argv[0] 1N/A#
endif /* SHOPT_FS_3D */ 1N/A#
endif /* SHOPT_TIMEOUT */ 1N/A /* initialize jobs table */ 1N/A /* check for restricted shell */ 1N/A /* check for profile shell */ 1N/A /* check for invocation as bash */ 1N/A /* look for options */ 1N/A /* shp->st.dolc is $# */ 1N/A /* set[ug]id scripts require the -p flag */ 1N/A /* require sh -p to run setuid and/or setgid */ 1N/A#
endif /* SHOPT_P_SUID */ 1N/A /* careful of #! setuid scripts with name beginning with - */ 1N/A#
endif /*SHELLMAGIC*/ 1N/A /* shname for $0 in profiles and . scripts */ 1N/A * return here for shell script execution 1N/A * but not for parenthesis subshells 1N/A * reinitialize before executing a script 1N/A#
endif /* SHOPT_NAMESPACE */ 1N/A /* set up new args */ 1N/A * set when creating a local variable of this name 1N/A while((i=*
cp++) && i !=
'=' && i !=
'+' && i!=
'[');
1N/A#
endif /* SHOPT_STATS */ 1N/A * Initialize the shell name and alias table 1N/A#
endif /* SHOPT_COSHELL */ 1N/A#
endif /* _hdr_locale */ 1N/A#
endif /* _hdr_locale */ 1N/A /* set up the seconds clock */ 1N/A * initialize name-value pairs 1N/A register unsigned n = 0;
1N/A * read in the process environment and set up name-value pairs 1N/A * skip over items that are not name-value pairs 1N/A else if(*
cp==
'A' &&
cp[
1]==
'_' &&
cp[
2]==
'_' &&
cp[
3]==
'z' &&
cp[
4]==0)
1N/A /* check for floating*/ 1N/A * terminate shell and free up the space 1N/A/* function versions of these */ 1N/A * This code is for character mapped variables with wctrans()