eval.c (217035) | eval.c (218306) |
---|---|
1/*- 2 * Copyright (c) 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Kenneth Almquist. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 22 unchanged lines hidden (view full) --- 31 */ 32 33#ifndef lint 34#if 0 35static char sccsid[] = "@(#)eval.c 8.9 (Berkeley) 6/8/95"; 36#endif 37#endif /* not lint */ 38#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Kenneth Almquist. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 22 unchanged lines hidden (view full) --- 31 */ 32 33#ifndef lint 34#if 0 35static char sccsid[] = "@(#)eval.c 8.9 (Berkeley) 6/8/95"; 36#endif 37#endif /* not lint */ 38#include <sys/cdefs.h> |
39__FBSDID("$FreeBSD: head/bin/sh/eval.c 217035 2011-01-05 23:17:29Z jilles $"); | 39__FBSDID("$FreeBSD: head/bin/sh/eval.c 218306 2011-02-04 22:47:55Z jilles $"); |
40 41#include <paths.h> 42#include <signal.h> 43#include <stdlib.h> 44#include <unistd.h> 45#include <sys/resource.h> 46#include <sys/wait.h> /* For WIFSIGNALED(status) */ 47#include <errno.h> --- 58 unchanged lines hidden (view full) --- 106#ifdef mkinit 107INCLUDE "eval.h" 108 109RESET { 110 evalskip = 0; 111 loopnest = 0; 112 funcnest = 0; 113} | 40 41#include <paths.h> 42#include <signal.h> 43#include <stdlib.h> 44#include <unistd.h> 45#include <sys/resource.h> 46#include <sys/wait.h> /* For WIFSIGNALED(status) */ 47#include <errno.h> --- 58 unchanged lines hidden (view full) --- 106#ifdef mkinit 107INCLUDE "eval.h" 108 109RESET { 110 evalskip = 0; 111 loopnest = 0; 112 funcnest = 0; 113} |
114 115SHELLPROC { 116 exitstatus = 0; 117} | |
118#endif 119 120 121 122/* 123 * The eval command. 124 */ 125 --- 601 unchanged lines hidden (view full) --- 727 varflag = 0; 728 } 729 *arglist.lastp = NULL; 730 *varlist.lastp = NULL; 731 expredir(cmd->ncmd.redirect); 732 argc = 0; 733 for (sp = arglist.list ; sp ; sp = sp->next) 734 argc++; | 114#endif 115 116 117 118/* 119 * The eval command. 120 */ 121 --- 601 unchanged lines hidden (view full) --- 723 varflag = 0; 724 } 725 *arglist.lastp = NULL; 726 *varlist.lastp = NULL; 727 expredir(cmd->ncmd.redirect); 728 argc = 0; 729 for (sp = arglist.list ; sp ; sp = sp->next) 730 argc++; |
735 argv = stalloc(sizeof (char *) * (argc + 1)); | 731 /* Add one slot at the beginning for tryexec(). */ 732 argv = stalloc(sizeof (char *) * (argc + 2)); 733 argv++; |
736 737 for (sp = arglist.list ; sp ; sp = sp->next) { 738 TRACE(("evalcommand arg: %s\n", sp->text)); 739 *argv++ = sp->text; 740 } 741 *argv = NULL; 742 lastarg = NULL; 743 if (iflag && funcnest == 0 && argc > 0) --- 178 unchanged lines hidden (view full) --- 922 shellparam.p = argv + 1; 923 shellparam.optnext = NULL; 924 INTOFF; 925 savelocalvars = localvars; 926 localvars = NULL; 927 reffunc(cmdentry.u.func); 928 savehandler = handler; 929 if (setjmp(jmploc.loc)) { | 734 735 for (sp = arglist.list ; sp ; sp = sp->next) { 736 TRACE(("evalcommand arg: %s\n", sp->text)); 737 *argv++ = sp->text; 738 } 739 *argv = NULL; 740 lastarg = NULL; 741 if (iflag && funcnest == 0 && argc > 0) --- 178 unchanged lines hidden (view full) --- 920 shellparam.p = argv + 1; 921 shellparam.optnext = NULL; 922 INTOFF; 923 savelocalvars = localvars; 924 localvars = NULL; 925 reffunc(cmdentry.u.func); 926 savehandler = handler; 927 if (setjmp(jmploc.loc)) { |
930 if (exception == EXSHELLPROC) 931 freeparam(&saveparam); 932 else { 933 freeparam(&shellparam); 934 shellparam = saveparam; 935 if (exception == EXERROR || exception == EXEXEC) 936 popredir(); 937 } | 928 freeparam(&shellparam); 929 shellparam = saveparam; 930 if (exception == EXERROR || exception == EXEXEC) 931 popredir(); |
938 unreffunc(cmdentry.u.func); 939 poplocalvars(); 940 localvars = savelocalvars; 941 funcnest--; 942 handler = savehandler; 943 longjmp(handler->loc, 1); 944 } 945 handler = &jmploc; --- 65 unchanged lines hidden (view full) --- 1011cmddone: 1012 if (argc > 0) 1013 bltinunsetlocale(); 1014 cmdenviron = NULL; 1015 out1 = &output; 1016 out2 = &errout; 1017 freestdout(); 1018 handler = savehandler; | 932 unreffunc(cmdentry.u.func); 933 poplocalvars(); 934 localvars = savelocalvars; 935 funcnest--; 936 handler = savehandler; 937 longjmp(handler->loc, 1); 938 } 939 handler = &jmploc; --- 65 unchanged lines hidden (view full) --- 1005cmddone: 1006 if (argc > 0) 1007 bltinunsetlocale(); 1008 cmdenviron = NULL; 1009 out1 = &output; 1010 out2 = &errout; 1011 freestdout(); 1012 handler = savehandler; |
1019 if (e != EXSHELLPROC) { 1020 commandname = savecmdname; 1021 if (jp) 1022 exitshell(exitstatus); 1023 } | 1013 commandname = savecmdname; 1014 if (jp) 1015 exitshell(exitstatus); |
1024 if (flags == EV_BACKCMD) { 1025 backcmd->buf = memout.buf; 1026 backcmd->nleft = memout.nextc - memout.buf; 1027 memout.buf = NULL; 1028 } 1029 if (cmdentry.u.index != EXECCMD && 1030 (e == -1 || e == EXERROR || e == EXEXEC)) 1031 popredir(); --- 247 unchanged lines hidden --- | 1016 if (flags == EV_BACKCMD) { 1017 backcmd->buf = memout.buf; 1018 backcmd->nleft = memout.nextc - memout.buf; 1019 memout.buf = NULL; 1020 } 1021 if (cmdentry.u.index != EXECCMD && 1022 (e == -1 || e == EXERROR || e == EXEXEC)) 1023 popredir(); --- 247 unchanged lines hidden --- |