- Timestamp:
- Apr 21, 2007, 8:33:35 AM (18 years ago)
- Location:
- trunk/src/ash-messup
- Files:
-
- 4 added
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/ash-messup/alias.h
r626 r879 44 44 }; 45 45 46 struct alias *lookupalias( char *, int);47 char *get_alias_text( char *);48 int aliascmd( int, char **);49 int unaliascmd( int, char **);50 void rmaliases( void);46 struct alias *lookupalias(struct shinstance *, char *, int); 47 char *get_alias_text(struct shinstance *, char *); 48 int aliascmd(struct shinstance *, int, char **); 49 int unaliascmd(struct shinstance *, int, char **); 50 void rmaliases(struct shinstance *); -
trunk/src/ash-messup/cd.h
r626 r879 31 31 */ 32 32 33 void getpwd( int);34 int cdcmd( int, char **);35 int pwdcmd( int, char **);33 void getpwd(struct shinstance *, int); 34 int cdcmd(struct shinstance *, int, char **); 35 int pwdcmd(struct shinstance *, int, char **); 36 36 #ifdef PC_DRIVE_LETTERS 37 37 #define IS_ROOT(path) ( *(path) == '/' \ -
trunk/src/ash-messup/error.h
r632 r879 62 62 }; 63 63 64 /* 64 65 extern struct jmploc *handler; 65 66 extern int exception; 66 extern int exerrno; /* error for EXEXEC */67 extern int exerrno;*/ /* error for EXEXEC */ 67 68 68 69 /* exceptions */ … … 80 81 */ 81 82 82 extern volatile int suppressint;83 extern volatile int intpending; 83 /*extern volatile int suppressint; 84 extern volatile int intpending;*/ 84 85 85 #define INTOFF suppressint++86 #define INTON { if (-- suppressint == 0 && intpending) onint(); }87 #define FORCEINTON {suppressint = 0; if ( intpending) onint();}88 #define CLEAR_PENDING_INT intpending = 089 #define int_pending() intpending86 #define INTOFF psh->suppressint++ 87 #define INTON { if (--psh->suppressint == 0 && psh->intpending) onint(psh); } 88 #define FORCEINTON {suppressint = 0; if (psh->intpending) onint(psh);} 89 #define CLEAR_PENDING_INT psh->intpending = 0 90 #define int_pending() psh->intpending 90 91 91 void exraise( int) __attribute__((__noreturn__));92 void onint( void);93 void error( const char *, ...) __attribute__((__noreturn__));94 void exerror( int, const char *, ...) __attribute__((__noreturn__));95 const char *errmsg( int, int);92 void exraise(struct shinstance *, int) __attribute__((__noreturn__)); 93 void onint(struct shinstance *); 94 void error(struct shinstance *, const char *, ...) __attribute__((__noreturn__)); 95 void exerror(struct shinstance *, int, const char *, ...) __attribute__((__noreturn__)); 96 const char *errmsg(struct shinstance *, int, int); 96 97 97 void sh_err( int, const char *, ...) __attribute__((__noreturn__));98 void sh_verr( int, const char *, va_list) __attribute__((__noreturn__));99 void sh_errx( int, const char *, ...) __attribute__((__noreturn__));100 void sh_verrx( int, const char *, va_list) __attribute__((__noreturn__));101 void sh_warn( const char *, ...);102 void sh_vwarn( const char *, va_list);103 void sh_warnx( const char *, ...);104 void sh_vwarnx( const char *, va_list);98 void sh_err(struct shinstance *, int, const char *, ...) __attribute__((__noreturn__)); 99 void sh_verr(struct shinstance *, int, const char *, va_list) __attribute__((__noreturn__)); 100 void sh_errx(struct shinstance *, int, const char *, ...) __attribute__((__noreturn__)); 101 void sh_verrx(struct shinstance *, int, const char *, va_list) __attribute__((__noreturn__)); 102 void sh_warn(struct shinstance *, const char *, ...); 103 void sh_vwarn(struct shinstance *, const char *, va_list); 104 void sh_warnx(struct shinstance *, const char *, ...); 105 void sh_vwarnx(struct shinstance *, const char *, va_list); 105 106 106 void sh_exit( int) __attribute__((__noreturn__));107 void sh_exit(struct shinstance *, int) __attribute__((__noreturn__)); 107 108 108 109 -
trunk/src/ash-messup/eval.h
r626 r879 35 35 */ 36 36 37 extern char *commandname;/* currently executing command */38 extern int exitstatus;/* exit status of last command */39 extern int back_exitstatus;/* exit status of backquoted command */40 extern struct strlist *cmdenviron;/* environment for builtin command */37 /*extern char *commandname;*/ /* currently executing command */ 38 /*extern int exitstatus;*/ /* exit status of last command */ 39 /*extern int back_exitstatus;*/ /* exit status of backquoted command */ 40 /*extern struct strlist *cmdenviron;*/ /* environment for builtin command */ 41 41 42 42 … … 48 48 }; 49 49 50 void evalstring( char *, int);50 void evalstring(struct shinstance *, char *, int); 51 51 union node; /* BLETCH for ansi C */ 52 void evaltree( union node *, int);53 void evalbackcmd( union node *, struct backcmd *);52 void evaltree(struct shinstance *, union node *, int); 53 void evalbackcmd(struct shinstance *, union node *, struct backcmd *); 54 54 55 55 /* in_function returns nonzero if we are currently evaluating a function */ 56 #define in_function() funcnest57 extern int funcnest;58 extern int evalskip; 56 #define in_function() psh->funcnest 57 /*extern int funcnest; 58 extern int evalskip;*/ 59 59 60 60 /* reasons for skipping commands (see comment on breakcmd routine) */ -
trunk/src/ash-messup/exec.h
r626 r879 60 60 #define DO_ALTBLTIN 0x20 /* %builtin in alt. path */ 61 61 62 extern const char *pathopt;/* set by padvance */62 /*extern const char *pathopt;*/ /* set by padvance */ 63 63 64 void shellexec( char **, char **, const char *, int, int)64 void shellexec(struct shinstance *, char **, char **, const char *, int, int) 65 65 __attribute__((__noreturn__)); 66 char *padvance( const char **, const char *);67 int hashcmd( int, char **);68 void find_command( char *, struct cmdentry *, int, const char *);69 int (*find_builtin( char *))(int, char **);70 int (*find_splbltin( char *))(int, char **);71 void hashcd( void);72 void changepath( const char *);73 void deletefuncs( void);74 void getcmdentry( char *, struct cmdentry *);75 void addcmdentry( char *, struct cmdentry *);76 void defun( char *, union node *);77 int unsetfunc( char *);78 int typecmd( int, char **);79 void hash_special_builtins( void);66 char *padvance(struct shinstance *, const char **, const char *); 67 int hashcmd(struct shinstance *, int, char **); 68 void find_command(struct shinstance *, char *, struct cmdentry *, int, const char *); 69 int (*find_builtin(struct shinstance *, char *))(struct shinstance *, int, char **); 70 int (*find_splbltin(struct shinstance *, char *))(struct shinstance *, int, char **); 71 void hashcd(struct shinstance *); 72 void changepath(struct shinstance *, const char *); 73 void deletefuncs(struct shinstance *); 74 void getcmdentry(struct shinstance *, char *, struct cmdentry *); 75 void addcmdentry(struct shinstance *, char *, struct cmdentry *); 76 void defun(struct shinstance *, char *, union node *); 77 int unsetfunc(struct shinstance *, char *); 78 int typecmd(struct shinstance *, int, char **); 79 void hash_special_builtins(struct shinstance *); -
trunk/src/ash-messup/expand.h
r626 r879 58 58 59 59 union node; 60 void expandhere( union node *, int);61 void expandarg( union node *, struct arglist *, int);62 void expari( int);63 int patmatch( char *, char *, int);64 void rmescapes( char *);65 int casematch( union node *, char *);66 int wordexpcmd( int, char **);60 void expandhere(struct shinstance *, union node *, int); 61 void expandarg(struct shinstance *, union node *, struct arglist *, int); 62 void expari(struct shinstance *, int); 63 int patmatch(struct shinstance *, char *, char *, int); 64 void rmescapes(struct shinstance *, char *); 65 int casematch(struct shinstance *, union node *, char *); 66 int wordexpcmd(struct shinstance *, int, char **); 67 67 68 68 /* From arith.y */ -
trunk/src/ash-messup/init.h
r626 r879 35 35 */ 36 36 37 void init( void);38 void reset( void);39 void initshellproc( void);37 void init(struct shinstance *); 38 void reset(struct shinstance *); 39 void initshellproc(struct shinstance *); -
trunk/src/ash-messup/input.h
r626 r879 47 47 extern int init_editline; /* 0 == not setup, 1 == OK, -1 == failed */ 48 48 49 char *pfgets( char *, int);50 int pgetc( void);51 int preadbuffer( void);52 void pungetc( void);53 void pushstring( char *, int, void *);54 void popstring( void);55 void setinputfile( const char *, int);56 void setinputfd( int, int);57 void setinputstring( char *, int);58 void popfile( void);59 void popallfiles( void);60 void closescript( int);49 char *pfgets(struct shinstance *, char *, int); 50 int pgetc(struct shinstance *); 51 int preadbuffer(struct shinstance *); 52 void pungetc(struct shinstance *); 53 void pushstring(struct shinstance *, char *, int, void *); 54 void popstring(struct shinstance *); 55 void setinputfile(struct shinstance *, const char *, int); 56 void setinputfd(struct shinstance *, int, int); 57 void setinputstring(struct shinstance *, char *, int); 58 void popfile(struct shinstance *); 59 void popallfiles(struct shinstance *); 60 void closescript(struct shinstance *, int); 61 61 62 #define pgetc_macro() (--p arsenleft >= 0? *parsenextc++ : preadbuffer())62 #define pgetc_macro() (--psh->parsenleft >= 0? *psh->parsenextc++ : preadbuffer(psh)) -
trunk/src/ash-messup/jobs.h
r626 r879 83 83 }; 84 84 85 extern pid_t backgndpid;/* pid of last background process */86 extern int job_warning;/* user was warned about stopped jobs */85 /*extern pid_t backgndpid;*/ /* pid of last background process */ 86 /*extern int job_warning;*/ /* user was warned about stopped jobs */ 87 87 88 void setjobctl( int);89 int fgcmd( int, char **);90 int bgcmd( int, char **);91 int jobscmd( int, char **);92 void showjobs(struct output *, int);93 int waitcmd( int, char **);94 int jobidcmd( int, char **);95 struct job *makejob( union node *, int);96 int forkshell(struct job *, union node *, int);97 void forkchild(struct job *, union node *, int, int);98 int forkparent(struct job *, union node *, int, pid_t);99 int waitforjob(struct job *);100 int stoppedjobs( void);101 void commandtext(struct procstat *, union node *);102 int getjobpgrp( const char *);88 void setjobctl(struct shinstance *, int); 89 int fgcmd(struct shinstance *, int, char **); 90 int bgcmd(struct shinstance *, int, char **); 91 int jobscmd(struct shinstance *, int, char **); 92 void showjobs(struct shinstance *, struct output *, int); 93 int waitcmd(struct shinstance *, int, char **); 94 int jobidcmd(struct shinstance *, int, char **); 95 struct job *makejob(struct shinstance *, union node *, int); 96 int forkshell(struct shinstance *, struct job *, union node *, int); 97 void forkchild(struct shinstance *, struct job *, union node *, int, int); 98 int forkparent(struct shinstance *, struct job *, union node *, int, pid_t); 99 int waitforjob(struct shinstance *, struct job *); 100 int stoppedjobs(struct shinstance *); 101 void commandtext(struct shinstance *, struct procstat *, union node *); 102 int getjobpgrp(struct shinstance *, const char *); 103 103 104 104 #if ! JOBS 105 #define setjobctl( on) /* do nothing */105 #define setjobctl(psh, on) /* do nothing */ 106 106 #endif -
trunk/src/ash-messup/mail.h
r626 r879 35 35 */ 36 36 37 void chkmail( int);37 void chkmail(struct shinstance *, int); -
trunk/src/ash-messup/main.c
r809 r879 85 85 STATIC union node *curcmd; 86 86 STATIC union node *prevcmd; 87 #if PROFILE88 short profile_buf[16384];89 extern int etext();90 #endif91 87 92 88 STATIC void read_profile(const char *); … … 105 101 main(int argc, char **argv) 106 102 { 103 shinstance *psh; 104 105 setlocale(LC_ALL, ""); 106 107 /* 108 * Create the root shell instance. 109 */ 110 psh = create_root_shell(NULL, argc, argv); 111 if (!psh) 112 return 2; 113 return shell_main(psh, argc); 114 } 115 116 int 117 shell_main(shinstance *psh, int argc, char **argv) 118 { 107 119 struct jmploc jmploc; 108 120 struct stackmark smark; … … 110 122 char *shinit; 111 123 112 setlocale(LC_ALL, "");113 114 #if PROFILE115 monitor(4, etext, profile_buf, sizeof profile_buf, 50);116 #endif117 124 state = 0; 118 125 if (setjmp(jmploc.loc)) { … … 166 173 goto state4; 167 174 } 168 handler = &jmploc;175 psh->handler = &jmploc; 169 176 #ifdef DEBUG 170 177 #if DEBUG == 2 … … 174 181 trputs("Shell args: "); trargs(argv); 175 182 #endif 176 rootpid = getpid();177 rootshell = 1;183 psh->rootpid = getpid(); 184 psh->rootshell = 1; 178 185 #ifdef _MSC_VER 179 186 { … … 187 194 if (argv[0] && argv[0][0] == '-') { 188 195 state = 1; 189 read_profile( "/etc/profile");196 read_profile(psh, "/etc/profile"); 190 197 state1: 191 198 state = 2; 192 read_profile( ".profile");199 read_profile(psh, ".profile"); 193 200 } 194 201 state2: 195 202 state = 3; 196 203 if (getuid() == geteuid() && getgid() == getegid()) { 197 if ((shinit = lookupvar( "ENV")) != NULL && *shinit != '\0') {204 if ((shinit = lookupvar(psh, "ENV")) != NULL && *shinit != '\0') { 198 205 state = 3; 199 read_profile( shinit);206 read_profile(psh, shinit); 200 207 } 201 208 } … … 214 221 215 222 for (i = 0; i < SIGSSIZE; i++) 216 setsignal( sigs[i], 0);217 } 218 219 if ( minusc)220 evalstring( minusc, 0);221 222 if ( sflag || minusc == NULL) {223 setsignal(psh, sigs[i], 0); 224 } 225 226 if (psh->minusc) 227 evalstring(psh, psh->minusc, 0); 228 229 if (psh->sflag || minusc == NULL) { 223 230 state4: /* XXX ??? - why isn't this before the "if" statement */ 224 cmdloop(1); 225 } 226 #if PROFILE 227 monitor(0); 228 #endif 229 exitshell(exitstatus); 231 cmdloop(psh, 1); 232 } 233 exitshell(psh, psh->exitstatus); 230 234 /* NOTREACHED */ 231 235 } -
trunk/src/ash-messup/main.h
r626 r879 35 35 */ 36 36 37 extern int rootpid;/* pid of main shell */38 extern int rootshell;/* true if we aren't a child of the main shell */37 /*extern int rootpid;*/ /* pid of main shell */ 38 /*extern int rootshell;*/ /* true if we aren't a child of the main shell */ 39 39 40 void readcmdfile( char *);41 void cmdloop( int);42 int dotcmd( int, char **);43 int exitcmd( int, char **);40 void readcmdfile(struct shinstance *, char *); 41 void cmdloop(struct shinstance *, int); 42 int dotcmd(struct shinstance *, int, char **); 43 int exitcmd(struct shinstance *, int, char **); -
trunk/src/ash-messup/memalloc.h
r626 r879 43 43 44 44 45 extern char *stacknxt;45 /*extern char *stacknxt; 46 46 extern int stacknleft; 47 47 extern int sstrnleft; 48 extern int herefd; 48 extern int herefd;*/ 49 49 50 50 pointer ckmalloc(int); 51 51 pointer ckrealloc(pointer, int); 52 52 char *savestr(const char *); 53 pointer stalloc( int);54 void stunalloc( pointer);55 void setstackmark(struct s tackmark *);56 void popstackmark(struct s tackmark *);57 void growstackblock( void);58 void grabstackblock( int);59 char *growstackstr( void);60 char *makestrspace( void);61 void ungrabstackstr( char *, char *);53 pointer stalloc(struct shinstance *, int); 54 void stunalloc(struct shinstance *, pointer); 55 void setstackmark(struct shinstance *, struct stackmark *); 56 void popstackmark(struct shinstance *, struct stackmark *); 57 void growstackblock(struct shinstance *); 58 void grabstackblock(struct shinstance *, int); 59 char *growstackstr(struct shinstance *); 60 char *makestrspace(struct shinstance *); 61 void ungrabstackstr(struct shinstance *, char *, char *); 62 62 63 63 64 64 65 #define stackblock() stacknxt66 #define stackblocksize() stacknleft67 #define STARTSTACKSTR(p) p = stackblock(), sstrnleft = stackblocksize()68 #define STPUTC(c, p) (-- sstrnleft >= 0? (*p++ = (c)) : (p = growstackstr(), *p++ = (c)))69 #define CHECKSTRSPACE(n, p) { if ( sstrnleft < n) p = makestrspace(); }70 #define USTPUTC(c, p) (-- sstrnleft, *p++ = (c))71 #define STACKSTRNUL(p) ( sstrnleft == 0? (p = growstackstr(), *p = '\0') : (*p = '\0'))72 #define STUNPUTC(p) (++ sstrnleft, --p)65 #define stackblock() psh->stacknxt 66 #define stackblocksize() psh->stacknleft 67 #define STARTSTACKSTR(p) p = stackblock(), psh->sstrnleft = stackblocksize() 68 #define STPUTC(c, p) (--psh->sstrnleft >= 0? (*p++ = (c)) : (p = growstackstr(psh), *p++ = (c))) 69 #define CHECKSTRSPACE(n, p) { if (psh->sstrnleft < n) p = makestrspace(psh); } 70 #define USTPUTC(c, p) (--psh->sstrnleft, *p++ = (c)) 71 #define STACKSTRNUL(p) (psh->sstrnleft == 0? (p = growstackstr(psh), *p = '\0') : (*p = '\0')) 72 #define STUNPUTC(p) (++psh->sstrnleft, --p) 73 73 #define STTOPC(p) p[-1] 74 #define STADJUST(amount, p) (p += (amount), sstrnleft -= (amount))75 #define grabstackstr(p) stalloc(stackblocksize() - sstrnleft)74 #define STADJUST(amount, p) (p += (amount), psh->sstrnleft -= (amount)) 75 #define grabstackstr(p) stalloc(stackblocksize() - psh->sstrnleft) 76 76 77 77 #define ckfree(p) free((pointer)(p)) -
trunk/src/ash-messup/miscbltin.h
r626 r879 27 27 */ 28 28 29 int readcmd( int, char **);30 int umaskcmd( int, char **);31 int ulimitcmd( int, char **);29 int readcmd(struct shinstance *, int, char **); 30 int umaskcmd(struct shinstance *, int, char **); 31 int ulimitcmd(struct shinstance *, int, char **); -
trunk/src/ash-messup/myhistedit.h
r626 r879 35 35 #include <histedit.h> 36 36 37 extern History *hist;38 extern EditLine *el; 37 /*extern History *hist; 38 extern EditLine *el;*/ 39 39 #endif 40 extern int displayhist; 40 /*extern int displayhist;*/ 41 41 42 void histedit( void);43 void sethistsize( const char *);44 void setterm( const char *);45 int histcmd( int, char **);46 int inputrc( int, char **);47 int not_fcnumber( char *);48 int str_to_event( const char *, int);42 void histedit(struct shinstance *); 43 void sethistsize(struct shinstance *, const char *); 44 void setterm(struct shinstance *, const char *); 45 int histcmd(struct shinstance *, int, char **); 46 int inputrc(struct shinstance *, int, char **); 47 int not_fcnumber(struct shinstance *, char *); 48 int str_to_event(struct shinstance *, const char *, int); 49 49 -
trunk/src/ash-messup/options.h
r626 r879 54 54 /* Those marked [U] are required by posix, but have no effect! */ 55 55 56 #ifdef DEBUG 57 # define NOPTS 21 58 #else 59 # define NOPTS 20 60 #endif 61 56 62 #ifdef DEFINE_OPTIONS 57 63 #define DEF_OPTS(name, letter, opt_set) {name, letter, opt_set, 0}, 58 struct optent optlist[] = {64 const struct optent ro_optlist[NOPTS] = { 59 65 #else 60 66 #define DEF_OPTS(name, letter, opt_set) … … 63 69 64 70 DEF_OPT( "errexit", 'e' ) /* exit on error */ 65 #define eflag optlist[0].val71 #define eflag psh->optlist[0].val 66 72 DEF_OPT( "noglob", 'f' ) /* no pathname expansion */ 67 #define fflag optlist[1].val73 #define fflag psh->optlist[1].val 68 74 DEF_OPT( "ignoreeof", 'I' ) /* do not exit on EOF */ 69 #define Iflag optlist[2].val75 #define Iflag psh->optlist[2].val 70 76 DEF_OPT( "interactive",'i' ) /* interactive shell */ 71 #define iflag optlist[3].val77 #define iflag psh->optlist[3].val 72 78 DEF_OPT( "monitor", 'm' ) /* job control */ 73 #define mflag optlist[4].val79 #define mflag psh->optlist[4].val 74 80 DEF_OPT( "noexec", 'n' ) /* [U] do not exec commands */ 75 #define nflag optlist[5].val81 #define nflag psh->optlist[5].val 76 82 DEF_OPT( "stdin", 's' ) /* read from stdin */ 77 #define sflag optlist[6].val83 #define sflag psh->optlist[6].val 78 84 DEF_OPT( "xtrace", 'x' ) /* trace after expansion */ 79 #define xflag optlist[7].val85 #define xflag psh->optlist[7].val 80 86 DEF_OPT( "verbose", 'v' ) /* trace read input */ 81 #define vflag optlist[8].val87 #define vflag psh->optlist[8].val 82 88 DEF_OPTS( "vi", 'V', 'V' ) /* vi style editing */ 83 #define Vflag optlist[9].val89 #define Vflag psh->optlist[9].val 84 90 DEF_OPTS( "emacs", 'E', 'V' ) /* emacs style editing */ 85 #define Eflag optlist[10].val91 #define Eflag psh->optlist[10].val 86 92 DEF_OPT( "noclobber", 'C' ) /* do not overwrite files with > */ 87 #define Cflag optlist[11].val93 #define Cflag psh->optlist[11].val 88 94 DEF_OPT( "allexport", 'a' ) /* export all variables */ 89 #define aflag optlist[12].val95 #define aflag psh->optlist[12].val 90 96 DEF_OPT( "notify", 'b' ) /* [U] report completion of background jobs */ 91 #define bflag optlist[13].val97 #define bflag psh->optlist[13].val 92 98 DEF_OPT( "nounset", 'u' ) /* error expansion of unset variables */ 93 #define uflag optlist[14].val99 #define uflag psh->optlist[14].val 94 100 DEF_OPT( "quietprofile", 'q' ) 95 #define qflag optlist[15].val101 #define qflag psh->optlist[15].val 96 102 DEF_OPT( "nolog", 0 ) /* [U] no functon defs in command history */ 97 #define nolog optlist[16].val103 #define nolog psh->optlist[16].val 98 104 DEF_OPT( "cdprint", 0 ) /* always print result of cd */ 99 #define cdprint optlist[17].val105 #define cdprint psh->optlist[17].val 100 106 DEF_OPT( "tabcomplete", 0 ) /* <tab> causes filename expansion */ 101 #define tabcomplete optlist[18].val107 #define tabcomplete psh->optlist[18].val 102 108 #ifdef DEBUG 103 109 DEF_OPT( "debug", 0 ) /* enable debug prints */ 104 #define debug optlist[19].val110 #define debug psh->optlist[19].val 105 111 #endif 106 112 … … 108 114 { 0, 0, 0, 0 }, 109 115 }; 110 #define NOPTS (sizeof optlist / sizeof optlist[0] - 1)111 int sizeof_optlist = sizeof optlist;112 116 #else 113 extern struct optent optlist[]; 114 extern int sizeof_optlist; 117 extern const struct optent ro_optlist[]; 115 118 #endif 119 #define sizeof_optlist (NOPTS * sizeof(struct optent)) 116 120 117 121 118 extern char *minusc;/* argument to -c option */119 extern char *arg0;/* $0 */120 extern struct shparam shellparam;/* $@ */121 extern char **argptr;/* argument list for builtin commands */122 extern char *optionarg;/* set by nextopt */123 extern char *optptr;/* used by nextopt */122 /*extern char *minusc;*/ /* argument to -c option */ 123 /*extern char *arg0;*/ /* $0 */ 124 /*extern struct shparam shellparam;*/ /* $@ */ 125 /*extern char **argptr;*/ /* argument list for builtin commands */ 126 /*extern char *optionarg;*/ /* set by nextopt */ 127 /*extern char *optptr;*/ /* used by nextopt */ 124 128 125 void procargs( int, char **);126 void optschanged( void);127 void setparam( char **);128 void freeparam( volatile struct shparam *);129 int shiftcmd( int, char **);130 int setcmd( int, char **);131 int getoptscmd( int, char **);132 int nextopt( const char *);133 void getoptsreset( const char *);129 void procargs(struct shinstance *, int, char **); 130 void optschanged(struct shinstance *); 131 void setparam(struct shinstance *, char **); 132 void freeparam(struct shinstance *, volatile struct shparam *); 133 int shiftcmd(struct shinstance *, int, char **); 134 int setcmd(struct shinstance *, int, char **); 135 int getoptscmd(struct shinstance *, int, char **); 136 int nextopt(struct shinstance *, const char *); 137 void getoptsreset(struct shinstance *, const char *); -
trunk/src/ash-messup/output.h
r626 r879 46 46 short fd; 47 47 short flags; 48 struct shinstance *psh; 48 49 }; 49 50 50 extern struct output output;51 /*extern struct output output; 51 52 extern struct output errout; 52 53 extern struct output memout; 53 54 extern struct output *out1; 54 extern struct output *out2; 55 extern struct output *out2;*/ 55 56 56 void open_mem( char *, int, struct output *);57 void out1str( const char *);58 void out2str( const char *);57 void open_mem(struct shinstance *, char *, int, struct output *); 58 void out1str(struct shinstance *, const char *); 59 void out2str(struct shinstance *, const char *); 59 60 void outstr(const char *, struct output *); 60 61 void emptyoutbuf(struct output *); 61 void output_flushall( void);62 void output_flushall(struct shinstance *); 62 63 void flushout(struct output *); 63 void freestdout( void);64 void freestdout(struct shinstance *); 64 65 void outfmt(struct output *, const char *, ...) 66 __attribute__((__format__(__printf__,3,4))); 67 void out1fmt(struct shinstance *, const char *, ...) 65 68 __attribute__((__format__(__printf__,2,3))); 66 void out1fmt(const char *, ...) 67 __attribute__((__format__(__printf__,1,2))); 68 void dprintf(const char *, ...) 69 __attribute__((__format__(__printf__,1,2))); 70 void fmtstr(char *, size_t, const char *, ...) 71 __attribute__((__format__(__printf__,3,4))); 69 void dprintf(struct shinstance *, const char *, ...) 70 __attribute__((__format__(__printf__,2,3))); 71 void fmtstr(struct shinstance *, char *, size_t, const char *, ...) 72 __attribute__((__format__(__printf__,4,5))); 72 73 void doformat(struct output *, const char *, va_list); 73 74 int xwrite(int, char *, int); 74 75 int xioctl(int, unsigned long, char *); 75 76 76 #define outc(c, file) (--(file)->nleft < 0? (emptyoutbuf( file), *(file)->nextc++ = (c)) : (*(file)->nextc++ = (c)))77 #define out1c(c) outc(c, out1);78 #define out2c(c) outc(c, out2);77 #define outc(c, file) (--(file)->nleft < 0? (emptyoutbuf(psh, file), *(file)->nextc++ = (c)) : (*(file)->nextc++ = (c))) 78 #define out1c(c) outc(c, psh->out1); 79 #define out2c(c) outc(c, psh->out2); 79 80 80 81 #define OUTPUT_INCL -
trunk/src/ash-messup/parser.h
r626 r879 72 72 * happens to be handy. 73 73 */ 74 extern int tokpushback; 75 #define NEOF ((union node *)& tokpushback)76 extern int whichprompt;/* 1 == PS1, 2 == PS2 */74 /*extern int tokpushback;*/ 75 #define NEOF ((union node *)&psh->tokpushback) 76 /*extern int whichprompt;*/ /* 1 == PS1, 2 == PS2 */ 77 77 78 78 79 union node *parsecmd( int);80 void fixredir( union node *, const char *, int);81 int goodname( char *);82 const char *getprompt( void *);79 union node *parsecmd(struct shinstance *, int); 80 void fixredir(struct shinstance *, union node *, const char *, int); 81 int goodname(struct shinstance *, char *); 82 const char *getprompt(struct shinstance *, void *); -
trunk/src/ash-messup/redir.h
r626 r879 41 41 42 42 union node; 43 void redirect( union node *, int);44 void popredir( void);45 int fd0_redirected_p( void);46 void clearredir( int);47 int copyfd( int, int);43 void redirect(struct shinstance *, union node *, int); 44 void popredir(struct shinstance *); 45 int fd0_redirected_p(struct shinstance *); 46 void clearredir(struct shinstance *, int); 47 int copyfd(struct shinstance *, int, int); 48 48 -
trunk/src/ash-messup/show.h
r626 r879 35 35 36 36 union node; 37 void showtree( union node *);38 void trace( const char *, ...);39 void tracev( const char *, va_list);40 void trargs( char **);37 void showtree(struct shinstance *, union node *); 38 void trace(struct shinstance *, const char *, ...); 39 void tracev(struct shinstance *, const char *, va_list); 40 void trargs(struct shinstance *, char **); 41 41 #ifdef DEBUG 42 42 void trputc(int); -
trunk/src/ash-messup/trap.h
r626 r879 35 35 */ 36 36 37 extern int pendingsigs; 37 /*extern int pendingsigs;*/ 38 38 39 int trapcmd( int, char **);40 void clear_traps( int);41 long setsignal( int, int);42 void ignoresig( int, int);43 void onsig( int);44 void dotrap( void);45 void setinteractive( int);46 void exitshell( int) __attribute__((__noreturn__));39 int trapcmd(struct shinstance *, int, char **); 40 void clear_traps(struct shinstance *, int); 41 long setsignal(struct shinstance *, int, int); 42 void ignoresig(struct shinstance *, int, int); 43 void onsig(struct shinstance *, int); 44 void dotrap(struct shinstance *, void); 45 void setinteractive(struct shinstance *, int); 46 void exitshell(struct shinstance *, int) __attribute__((__noreturn__)); -
trunk/src/ash-messup/var.h
r637 r879 71 71 }; 72 72 73 73 /* 74 74 struct localvar *localvars; 75 75 … … 92 92 extern struct var vhistsize; 93 93 #endif 94 */ 94 95 95 96 /* … … 99 100 */ 100 101 101 #define ifsval() ( vifs.text + 4)102 #define ifsset() (( vifs.flags & VUNSET) == 0)103 #define mailval() ( vmail.text + 5)104 #define mpathval() ( vmpath.text + 9)102 #define ifsval() (psh->vifs.text + 4) 103 #define ifsset() ((psh->vifs.flags & VUNSET) == 0) 104 #define mailval() (psh->vmail.text + 5) 105 #define mpathval() (psh->vmpath.text + 9) 105 106 #ifdef _MSC_VER 106 #define pathval() ( vpath.text[5] ? &vpath.text[5] : &vpath2.text[5])107 #define pathval() (psh->vpath.text[5] ? &psh->vpath.text[5] : &psh->vpath2.text[5]) 107 108 #else 108 #define pathval() ( vpath.text + 5)109 #define pathval() (psh->vpath.text + 5) 109 110 #endif 110 #define ps1val() ( vps1.text + 4)111 #define ps2val() ( vps2.text + 4)112 #define ps4val() ( vps4.text + 4)113 #define optindval() ( voptind.text + 7)111 #define ps1val() (psh->vps1.text + 4) 112 #define ps2val() (psh->vps2.text + 4) 113 #define ps4val() (psh->vps4.text + 4) 114 #define optindval() (psh->voptind.text + 7) 114 115 #ifndef SMALL 115 #define histsizeval() ( vhistsize.text + 9)116 #define termval() ( vterm.text + 5)116 #define histsizeval() (psh->vhistsize.text + 9) 117 #define termval() (psh->vterm.text + 5) 117 118 #endif 118 119 119 120 #if ATTY 120 #define attyset() (( vatty.flags & VUNSET) == 0)121 #define attyset() ((psh->vatty.flags & VUNSET) == 0) 121 122 #endif 122 #define mpathset() (( vmpath.flags & VUNSET) == 0)123 #define mpathset() ((psh->vmpath.flags & VUNSET) == 0) 123 124 124 void initvar( void);125 void setvar( const char *, const char *, int);126 void setvareq( char *, int);125 void initvar(struct shinstance *); 126 void setvar(struct shinstance *, const char *, const char *, int); 127 void setvareq(struct shinstance *, char *, int); 127 128 struct strlist; 128 void listsetvar(struct s trlist *, int);129 char *lookupvar( const char *);130 char *bltinlookup( const char *, int);131 char **environment( void);132 void shprocvar( void);133 int showvars( const char *, int, int);134 int exportcmd( int, char **);135 int localcmd( int, char **);136 void mklocal( const char *, int);137 void listmklocal(struct s trlist *, int);138 void poplocalvars( void);139 int setvarcmd( int, char **);140 int unsetcmd( int, char **);141 int unsetvar( const char *, int);142 int setvarsafe( const char *, const char *, int);143 void print_quoted( const char *);129 void listsetvar(struct shinstance *, struct strlist *, int); 130 char *lookupvar(struct shinstance *, const char *); 131 char *bltinlookup(struct shinstance *, const char *, int); 132 char **environment(struct shinstance *); 133 void shprocvar(struct shinstance *); 134 int showvars(struct shinstance *, const char *, int, int); 135 int exportcmd(struct shinstance *, int, char **); 136 int localcmd(struct shinstance *, int, char **); 137 void mklocal(struct shinstance *, const char *, int); 138 void listmklocal(struct shinstance *, struct strlist *, int); 139 void poplocalvars(struct shinstance *); 140 int setvarcmd(struct shinstance *, int, char **); 141 int unsetcmd(struct shinstance *, int, char **); 142 int unsetvar(struct shinstance *, const char *, int); 143 int setvarsafe(struct shinstance *, const char *, const char *, int); 144 void print_quoted(struct shinstance *, const char *);
Note:
See TracChangeset
for help on using the changeset viewer.