1 char rcsid[] = "$Header: perly.c,v 3.0.1.7 90/08/13 22:22:22 lwall Locked $\nPatch level: ###\n";
3 * Copyright (c) 1989, Larry Wall
5 * You may distribute under the terms of the GNU General Public License
6 * as specified in the README file that comes with the perl 3.0 kit.
9 * Revision 3.0.1.7 90/08/13 22:22:22 lwall
10 * patch28: defined(@array) and defined(%array) didn't work right
12 * Revision 3.0.1.6 90/08/09 04:55:50 lwall
13 * patch19: added -x switch to extract script from input trash
14 * patch19: Added -c switch to do compilation only
15 * patch19: added numeric interpretation of $]
16 * patch19: added require operator
17 * patch19: $0, %ENV, @ARGV were wrong in dumped script
18 * patch19: . is now explicitly in @INC (and last)
20 * Revision 3.0.1.5 90/03/27 16:20:57 lwall
21 * patch16: MSDOS support
22 * patch16: do FILE inside eval blows up
24 * Revision 3.0.1.4 90/02/28 18:06:41 lwall
25 * patch9: perl can now start up other interpreters scripts
26 * patch9: nested evals clobbered their longjmp environment
27 * patch9: eval could mistakenly return undef in array context
29 * Revision 3.0.1.3 89/12/21 20:15:41 lwall
30 * patch7: ANSI strerror() is now supported
31 * patch7: errno may now be a macro with an lvalue
32 * patch7: allowed setuid scripts to have a space after #!
34 * Revision 3.0.1.2 89/11/17 15:34:42 lwall
35 * patch5: fixed possible confusion about current effective gid
37 * Revision 3.0.1.1 89/11/11 04:50:04 lwall
38 * patch2: moved yydebug to where its type didn't matter
40 * Revision 3.0 89/10/18 15:22:21 lwall
48 #include "patchlevel.h"
56 #ifdef SETUID_SCRIPTS_ARE_SECURE_NOW
62 static char* moreswitches();
64 extern char **environ;
74 char *index(), *strcpy(), *getenv();
75 bool dosearch = FALSE;
80 #ifdef SETUID_SCRIPTS_ARE_SECURE_NOW
83 fatal("suidperl is no longer needed since the kernel can now execute\n\
84 setuid perl scripts securely.\n");
91 euid = (int)geteuid();
93 egid = (int)getegid();
96 * There is no way we can refer to them from Perl so close them to save
97 * space. The other alternative would be to provide STDAUX and STDPRN
100 (void)fclose(stdaux);
101 (void)fclose(stdprn);
104 origfilename = savestr(argv[0]);
106 loop_ptr = -1; /* start label stack again */
109 (void)sprintf(index(rcsid,'#'), "%d\n", PATCHLEVEL);
110 linestr = Str_new(65,80);
111 str_nset(linestr,"",0);
112 str = str_make("",0); /* first used for -I flags */
113 curstash = defstash = hnew(0);
114 curstname = str_make("main",4);
115 stab_xhash(stabent("_main",TRUE)) = defstash;
116 incstab = hadd(aadd(stabent("INC",TRUE)));
117 incstab->str_pok |= SP_MULTI;
118 for (argc--,argv++; argc > 0; argc--,argv++) {
119 if (argv[0][0] != '-' || !argv[0][1])
123 validarg = " PHOOEY ";
141 if (s = moreswitches(s))
147 if (euid != uid || egid != gid)
148 fatal("No -e allowed in setuid scripts");
151 e_tmpname = savestr(TMPPATH);
152 (void)mktemp(e_tmpname);
153 e_fp = fopen(e_tmpname,"w");
155 fatal("Cannot open temporary file");
161 (void)putc('\n', e_fp);
165 if (euid != uid || egid != gid)
166 fatal("No -I allowed in setuid scripts");
172 (void)apush(stab_array(incstab),str_make(s,0));
175 (void)apush(stab_array(incstab),str_make(argv[1],0));
176 str_cat(str,argv[1]);
183 if (euid != uid || egid != gid)
184 fatal("No -P allowed in setuid scripts");
191 if (euid != uid || egid != gid)
192 fatal("No -s allowed in setuid scripts");
213 fatal("Unrecognized switch: -%s",s);
223 #define PRIVLIB "/usr/local/lib/perl"
225 (void)apush(stab_array(incstab),str_make(PRIVLIB,0));
226 (void)apush(stab_array(incstab),str_make(".",1));
229 str_set(&str_yes,Yes);
233 if (argv[0] == Nullch)
235 if (dosearch && !index(argv[0], '/') && (s = getenv("PATH"))) {
236 char *xfound = Nullch, *xfailed = Nullch;
239 bufend = s + strlen(s);
242 s = cpytill(tokenbuf,s,bufend,':',&len);
244 for (len = 0; *s && *s != ';'; tokenbuf[len++] = *s++);
245 tokenbuf[len] = '\0';
250 if (len && tokenbuf[len-1] != '/')
252 if (len && tokenbuf[len-1] != '\\')
254 (void)strcat(tokenbuf+len,"/");
255 (void)strcat(tokenbuf+len,argv[0]);
258 fprintf(stderr,"Looking for %s\n",tokenbuf);
260 if (stat(tokenbuf,&statbuf) < 0) /* not there? */
262 if ((statbuf.st_mode & S_IFMT) == S_IFREG
263 && cando(S_IREAD,TRUE,&statbuf) && cando(S_IEXEC,TRUE,&statbuf)) {
264 xfound = tokenbuf; /* bingo! */
268 xfailed = savestr(tokenbuf);
271 fatal("Can't execute %s", xfailed ? xfailed : argv[0] );
274 argv[0] = savestr(xfound);
277 pidstatary = anew(Nullstab); /* for remembering popen pids, status */
279 origfilename = savestr(argv[0]);
280 filename = origfilename;
281 if (strEQ(filename,"-"))
285 str_cat(str,PRIVLIB);
286 (void)sprintf(buf, "\
287 /bin/sed %s -e '/^[^#]/b' \
288 -e '/^#[ ]*include[ ]/b' \
289 -e '/^#[ ]*define[ ]/b' \
290 -e '/^#[ ]*if[ ]/b' \
291 -e '/^#[ ]*ifdef[ ]/b' \
292 -e '/^#[ ]*ifndef[ ]/b' \
294 -e '/^#[ ]*endif/b' \
297 (doextract ? "-e '1,/^#/d\n'" : ""),
298 argv[0], CPPSTDIN, str_get(str), CPPMINUS);
300 #ifdef IAMSUID /* actually, this is caught earlier */
301 if (euid != uid && !euid) /* if running suidperl */
303 (void)seteuid(uid); /* musn't stay setuid root */
306 (void)setreuid(-1, uid);
312 rsfp = mypopen(buf,"r");
317 rsfp = fopen(argv[0],"r");
318 if (rsfp == Nullfp) {
320 #ifndef IAMSUID /* in case script is not readable before setuid */
321 if (euid && stat(filename,&statbuf) >= 0 &&
322 statbuf.st_mode & (S_ISUID|S_ISGID)) {
323 (void)sprintf(buf, "%s/%s", BIN, "suidperl");
324 execv(buf, origargv); /* try again */
325 fatal("Can't do setuid\n");
329 fatal("Can't open perl script \"%s\": %s\n",
330 filename, strerror(errno));
332 str_free(str); /* free -I directories */
334 /* do we need to emulate setuid on scripts? */
336 /* This code is for those BSD systems that have setuid #! scripts disabled
337 * in the kernel because of a security problem. Merely defining DOSUID
338 * in perl will not fix that problem, but if you have disabled setuid
339 * scripts in the kernel, this will attempt to emulate setuid and setgid
340 * on scripts that have those now-otherwise-useless bits set. The setuid
341 * root version must be called suidperl. If regular perl discovers that
342 * it has opened a setuid script, it calls suidperl with the same argv
343 * that it had. If suidperl finds that the script it has just opened
344 * is NOT setuid root, it sets the effective uid back to the uid. We
345 * don't just make perl setuid root because that loses the effective
346 * uid we had before invoking perl, if it was different from the uid.
348 * DOSUID must be defined in both perl and suidperl, and IAMSUID must
349 * be defined in suidperl only. suidperl must be setuid root. The
350 * Configure script will set this up for you if you want it.
352 * There is also the possibility of have a script which is running
353 * set-id due to a C wrapper. We want to do the TAINT checks
354 * on these set-id scripts, but don't want to have the overhead of
355 * them in normal perl, and can't use suidperl because it will lose
356 * the effective uid info, so we have an additional non-setuid root
357 * version called taintperl that just does the TAINT checks.
361 if (fstat(fileno(rsfp),&statbuf) < 0) /* normal stat is insecure */
362 fatal("Can't stat script \"%s\"",filename);
363 if (statbuf.st_mode & (S_ISUID|S_ISGID)) {
368 /* On this access check to make sure the directories are readable,
369 * there is actually a small window that the user could use to make
370 * filename point to an accessible directory. So there is a faint
371 * chance that someone could execute a setuid script down in a
372 * non-accessible directory. I don't know what to do about that.
373 * But I don't think it's too important. The manual lies when
374 * it says access() is useful in setuid programs.
376 if (access(filename,1)) /* as a double check */
377 fatal("Permission denied");
379 /* If we can swap euid and uid, then we can determine access rights
380 * with a simple stat of the file, and then compare device and
381 * inode to make sure we did stat() on the same file we opened.
382 * Then we just have to make sure he or she can execute it.
385 struct stat tmpstatbuf;
387 if (setreuid(euid,uid) < 0 || getuid() != euid || geteuid() != uid)
388 fatal("Can't swap uid and euid"); /* really paranoid */
389 if (stat(filename,&tmpstatbuf) < 0) /* testing full pathname here */
390 fatal("Permission denied");
391 if (tmpstatbuf.st_dev != statbuf.st_dev ||
392 tmpstatbuf.st_ino != statbuf.st_ino) {
394 if (rsfp = mypopen("/bin/mail root","w")) { /* heh, heh */
396 "User %d tried to run dev %d ino %d in place of dev %d ino %d!\n\
397 (Filename of set-id script was %s, uid %d gid %d.)\n\nSincerely,\nperl\n",
398 uid,tmpstatbuf.st_dev, tmpstatbuf.st_ino,
399 statbuf.st_dev, statbuf.st_ino,
400 filename, statbuf.st_uid, statbuf.st_gid);
401 (void)mypclose(rsfp);
403 fatal("Permission denied\n");
405 if (setreuid(uid,euid) < 0 || getuid() != uid || geteuid() != euid)
406 fatal("Can't reswap uid and euid");
407 if (!cando(S_IEXEC,FALSE,&statbuf)) /* can real uid exec? */
408 fatal("Permission denied\n");
410 #endif /* SETREUID */
413 if ((statbuf.st_mode & S_IFMT) != S_IFREG)
414 fatal("Permission denied");
415 if ((statbuf.st_mode >> 6) & S_IWRITE)
416 fatal("Setuid/gid script is writable by world");
417 doswitches = FALSE; /* -s is insecure in suid */
419 if (fgets(tokenbuf,sizeof tokenbuf, rsfp) == Nullch ||
420 strnNE(tokenbuf,"#!",2) ) /* required even on Sys V */
424 while (!isspace(*s)) s++;
425 if (strnNE(s-4,"perl",4)) /* sanity check */
426 fatal("Not a perl script");
427 while (*s == ' ' || *s == '\t') s++;
429 * #! arg must be what we saw above. They can invoke it by
430 * mentioning suidperl explicitly, but they may not add any strange
431 * arguments beyond what #! says if they do invoke suidperl that way.
433 len = strlen(validarg);
434 if (strEQ(validarg," PHOOEY ") ||
435 strnNE(s,validarg,len) || !isspace(s[len]))
436 fatal("Args must match #! line");
439 if (euid != uid && (statbuf.st_mode & S_ISUID) &&
440 euid == statbuf.st_uid)
442 fatal("YOU HAVEN'T DISABLED SET-ID SCRIPTS IN THE KERNEL YET!\n\
443 FIX YOUR KERNEL, PUT A C WRAPPER AROUND THIS SCRIPT, OR USE -u AND UNDUMP!\n");
446 if (euid) { /* oops, we're not the setuid root perl */
449 (void)sprintf(buf, "%s/%s", BIN, "suidperl");
450 execv(buf, origargv); /* try again */
452 fatal("Can't do setuid\n");
455 if (statbuf.st_mode & S_ISGID && statbuf.st_gid != egid)
457 (void)setegid(statbuf.st_gid);
460 (void)setregid((GIDTYPE)-1,statbuf.st_gid);
462 setgid(statbuf.st_gid);
465 if (statbuf.st_mode & S_ISUID) {
466 if (statbuf.st_uid != euid)
468 (void)seteuid(statbuf.st_uid); /* all that for this */
471 (void)setreuid((UIDTYPE)-1,statbuf.st_uid);
473 setuid(statbuf.st_uid);
477 else if (uid) /* oops, mustn't run as root */
479 (void)seteuid((UIDTYPE)uid);
482 (void)setreuid((UIDTYPE)-1,(UIDTYPE)uid);
484 setuid((UIDTYPE)uid);
488 euid = (int)geteuid();
490 egid = (int)getegid();
491 if (!cando(S_IEXEC,TRUE,&statbuf))
492 fatal("Permission denied\n"); /* they can't do this */
496 fatal("-P not allowed for setuid/setgid script\n");
498 fatal("Script is not setuid/setgid in suidperl\n");
500 #ifndef TAINT /* we aren't taintperl or suidperl */
501 /* script has a wrapper--can't run suidperl or we lose euid */
502 else if (euid != uid || egid != gid) {
504 (void)sprintf(buf, "%s/%s", BIN, "taintperl");
505 execv(buf, origargv); /* try again */
506 fatal("Can't run setuid script with taint checks");
511 #ifndef TAINT /* we aren't taintperl or suidperl */
512 if (euid != uid || egid != gid) { /* (suidperl doesn't exist, in fact) */
513 #ifndef SETUID_SCRIPTS_ARE_SECURE_NOW
514 fstat(fileno(rsfp),&statbuf); /* may be either wrapped or real suid */
515 if ((euid != uid && euid == statbuf.st_uid && statbuf.st_mode & S_ISUID)
517 (egid != gid && egid == statbuf.st_gid && statbuf.st_mode & S_ISGID)
520 fatal("YOU HAVEN'T DISABLED SET-ID SCRIPTS IN THE KERNEL YET!\n\
521 FIX YOUR KERNEL, PUT A C WRAPPER AROUND THIS SCRIPT, OR USE -u AND UNDUMP!\n");
522 #endif /* SETUID_SCRIPTS_ARE_SECURE_NOW */
523 /* not set-id, must be wrapped */
525 (void)sprintf(buf, "%s/%s", BIN, "taintperl");
526 execv(buf, origargv); /* try again */
527 fatal("Can't run setuid script with taint checks");
532 #if !defined(IAMSUID) && !defined(TAINT)
534 /* skip forward in input to the real script? */
537 if ((s = str_gets(linestr, rsfp, 0)) == Nullch)
538 fatal("No Perl script found in input\n");
539 if (*s == '#' && s[1] == '!' && instr(s,"perl")) {
540 ungetc('\n',rsfp); /* to keep line count right */
542 if (s = instr(s,"perl -")) {
544 while (s = moreswitches(s)) ;
546 if (cddir && chdir(cddir) < 0)
547 fatal("Can't chdir to %s",cddir);
550 #endif /* !defined(IAMSUID) && !defined(TAINT) */
552 defstab = stabent("_",TRUE);
556 stab_xhash(stabent("_DB",TRUE)) = debstash;
558 lineary = stab_xarray(aadd((tmpstab = stabent("line",TRUE))));
559 tmpstab->str_pok |= SP_MULTI;
560 subname = str_make("main",4);
561 DBstab = stabent("DB",TRUE);
562 DBstab->str_pok |= SP_MULTI;
563 DBsub = hadd(tmpstab = stabent("sub",TRUE));
564 tmpstab->str_pok |= SP_MULTI;
565 DBsingle = stab_val((tmpstab = stabent("single",TRUE)));
566 tmpstab->str_pok |= SP_MULTI;
572 bufend = bufptr = str_get(linestr);
574 savestack = anew(Nullstab); /* for saving non-local values */
575 stack = anew(Nullstab); /* for saving non-local values */
576 stack->ary_flags = 0; /* not a real array */
577 afill(stack,63); afill(stack,-1); /* preextend stack */
578 afill(savestack,63); afill(savestack,-1);
580 /* now parse the script */
583 if (yyparse() || error_count) {
585 fatal("%s had compilation errors.\n", origfilename);
587 fatal("Execution of %s aborted due to compilation errors.\n",
592 New(50,loop_stack,128,struct loop);
595 New(51,debname,128,char);
596 New(52,debdelim,128,char);
604 (void)UNLINK(e_tmpname);
607 /* initialize everything that won't change if we undump */
609 if (sigstab = stabent("SIG",allstabs)) {
610 sigstab->str_pok |= SP_MULTI;
614 magicalize("!#?^~=-%0123456789.+&*()<>,\\/[|`':");
615 userinit(); /* in case linked C routines want magical variables */
617 amperstab = stabent("&",allstabs);
618 leftstab = stabent("`",allstabs);
619 rightstab = stabent("'",allstabs);
620 sawampersand = (amperstab || leftstab || rightstab);
621 if (tmpstab = stabent(":",allstabs))
622 str_set(STAB_STR(tmpstab),chopset);
624 /* these aren't necessarily magical */
625 if (tmpstab = stabent(";",allstabs))
626 str_set(STAB_STR(tmpstab),"\034");
627 if (tmpstab = stabent("]",allstabs)) {
628 str = STAB_STR(tmpstab);
630 strncpy(tokenbuf,rcsid+19,3);
631 sprintf(tokenbuf+3,"%2.2d",PATCHLEVEL);
632 str->str_u.str_nval = atof(tokenbuf);
635 str_nset(stab_val(stabent("\"", TRUE)), " ", 1);
637 stdinstab = stabent("STDIN",TRUE);
638 stdinstab->str_pok |= SP_MULTI;
639 stab_io(stdinstab) = stio_new();
640 stab_io(stdinstab)->ifp = stdin;
641 tmpstab = stabent("stdin",TRUE);
642 stab_io(tmpstab) = stab_io(stdinstab);
643 tmpstab->str_pok |= SP_MULTI;
645 tmpstab = stabent("STDOUT",TRUE);
646 tmpstab->str_pok |= SP_MULTI;
647 stab_io(tmpstab) = stio_new();
648 stab_io(tmpstab)->ofp = stab_io(tmpstab)->ifp = stdout;
649 defoutstab = tmpstab;
650 tmpstab = stabent("stdout",TRUE);
651 stab_io(tmpstab) = stab_io(defoutstab);
652 tmpstab->str_pok |= SP_MULTI;
654 curoutstab = stabent("STDERR",TRUE);
655 curoutstab->str_pok |= SP_MULTI;
656 stab_io(curoutstab) = stio_new();
657 stab_io(curoutstab)->ofp = stab_io(curoutstab)->ifp = stderr;
658 tmpstab = stabent("stderr",TRUE);
659 stab_io(tmpstab) = stab_io(curoutstab);
660 tmpstab->str_pok |= SP_MULTI;
661 curoutstab = defoutstab; /* switch back to STDOUT */
663 statname = Str_new(66,0); /* last filename we did stat on */
665 perldb = FALSE; /* don't try to instrument evals */
675 just_doit: /* come here if running an undumped a.out */
676 argc--,argv++; /* skip name of script */
678 for (; argc > 0 && **argv == '-'; argc--,argv++) {
679 if (argv[0][1] == '-') {
683 str_numset(stab_val(stabent(argv[0]+1,TRUE)),(double)1.0);
689 if (tmpstab = stabent("0",allstabs))
690 str_set(STAB_STR(tmpstab),origfilename);
691 if (argvstab = stabent("ARGV",allstabs)) {
692 argvstab->str_pok |= SP_MULTI;
693 (void)aadd(argvstab);
694 aclear(stab_array(argvstab));
695 for (; argc > 0; argc--,argv++) {
696 (void)apush(stab_array(argvstab),str_make(argv[0],0));
700 (void) stabent("ENV",TRUE); /* must test PATH and IFS */
702 if (envstab = stabent("ENV",allstabs)) {
703 envstab->str_pok |= SP_MULTI;
705 hclear(stab_hash(envstab));
708 for (; *env; env++) {
709 if (!(s = index(*env,'=')))
712 str = str_make(s--,0);
713 str_magic(str, envstab, 'E', *env, s - *env);
714 (void)hstore(stab_hash(envstab), *env, s - *env, str, 0);
721 if (tmpstab = stabent("$",allstabs))
722 str_numset(STAB_STR(tmpstab),(double)getpid());
724 if (setjmp(top_env)) /* sets goto_targ on longjump */
725 loop_ptr = -1; /* start label stack again */
731 fprintf(stderr,"\nEXECUTING...\n\n");
735 fprintf(stderr,"%s syntax OK\n", origfilename);
741 (void) cmd_exec(main_root,G_SCALAR,-1);
744 fatal("Can't find label \"%s\"--aborting",goto_targ);
755 while (*sym = *list++)
756 magicname(sym, Nullch, 0);
760 magicname(sym,name,namlen)
767 if (stab = stabent(sym,allstabs)) {
768 stab_flags(stab) = SF_VMAGIC;
769 str_magic(stab_val(stab), stab, 0, name, namlen);
773 /* this routine is in perly.c by virtue of being sort of an alternate main() */
776 do_eval(str,optype,stash,gimme,arglast)
783 STR **st = stack->ary_array;
788 char * VOLATILE oldfile = filename;
789 CMD * VOLATILE oldcurcmd = curcmd;
790 VOLATILE int oldtmps_base = tmps_base;
791 VOLATILE int oldsave = savestack->ary_fill;
792 SPAT * VOLATILE oldspat = curspat;
793 static char *last_eval = Nullch;
794 static CMD *last_root = Nullcmd;
795 VOLATILE int sp = arglast[0];
798 tmps_base = tmps_max;
799 if (curstash != stash) {
800 (void)savehptr(&curstash);
803 str_set(stab_val(stabent("@",TRUE)),"");
805 if (optype == O_EVAL) { /* normal eval */
808 str_sset(linestr,str);
809 str_cat(linestr,";"); /* be kind to them */
812 if (last_root && !in_eval) {
817 specfilename = str_get(str);
818 filename = savestr(specfilename); /* can't free this easily */
820 if (optype == O_REQUIRE &&
821 hfetch(stab_hash(incstab), specfilename, strlen(specfilename), 0)) {
823 tmps_base = oldtmps_base;
827 else if (*filename == '/')
828 rsfp = fopen(filename,"r");
830 ar = stab_array(incstab);
832 for (i = 0; i <= ar->ary_fill; i++) {
833 (void)sprintf(buf,"%s/%s",str_get(afetch(ar,i,TRUE)),filename);
834 rsfp = fopen(buf,"r");
838 if (*s == '.' && s[1] == '/')
840 filename = savestr(s);
847 tmps_base = oldtmps_base;
848 if (optype == O_REQUIRE) {
849 sprintf(tokenbuf,"Can't locate %s in @INC", specfilename);
850 if (instr(tokenbuf,".h "))
851 strcat(tokenbuf," (change .h to .ph maybe?)");
852 if (instr(tokenbuf,".ph "))
853 strcat(tokenbuf," (did you run h2ph?)");
854 fatal("%s",tokenbuf);
856 if (gimme != G_ARRAY)
857 st[++sp] = &str_undef;
863 oldoldbufptr = oldbufptr = bufptr = str_get(linestr);
864 bufend = bufptr + linestr->str_cur;
865 if (++loop_ptr >= loop_max) {
867 Renew(loop_stack, loop_max, struct loop);
869 loop_stack[loop_ptr].loop_label = "_EVAL_";
870 loop_stack[loop_ptr].loop_sp = sp;
873 deb("(Pushing label #%d _EVAL_)\n", loop_ptr);
876 if (setjmp(loop_stack[loop_ptr].loop_env)) {
884 else if (last_root && *bufptr == *last_eval && strEQ(bufptr,last_eval)){
886 eval_root = last_root; /* no point in reparsing */
888 else if (in_eval == 1) {
893 last_eval = savestr(bufptr);
897 last_root = eval_root;
902 myroot = eval_root; /* in case cmd_exec does another eval! */
903 if (retval || error_count) {
904 st = stack->ary_array;
906 if (gimme != G_ARRAY)
907 st[++sp] = &str_undef;
908 last_root = Nullcmd; /* can't free on error, for some reason */
912 if (optype == O_REQUIRE)
913 fatal("%s", str_get(stab_val(stabent("@",TRUE))));
917 sp = cmd_exec(eval_root,gimme,sp);
918 st = stack->ary_array;
919 for (i = arglast[0] + 1; i <= sp; i++)
920 st[i] = str_static(st[i]);
921 /* if we don't save result, free zaps it */
922 if (in_eval != 1 && myroot != last_root)
924 if (optype != O_EVAL) {
925 if (gimme == G_SCALAR ? str_true(st[sp]) : sp > arglast[0]) {
926 (void)hstore(stab_hash(incstab), specfilename,
927 strlen(specfilename), str_make(filename,0), 0 );
929 else if (optype == O_REQUIRE)
930 fatal("%s did not return a true value", specfilename);
936 char *tmps = loop_stack[loop_ptr].loop_label;
937 deb("(Popping label #%d %s)\n",loop_ptr,
944 tmps_base = oldtmps_base;
946 if (savestack->ary_fill > oldsave) /* let them use local() */
947 restorelist(oldsave);
951 /* This routine handles any switches that can be given during run */
969 if (euid != uid || egid != gid)
970 fatal("No -d allowed in setuid scripts");
978 if (euid != uid || egid != gid)
979 fatal("No -D allowed in setuid scripts");
983 warn("Recompile perl with -DDEBUGGING to use -D switch\n");
987 inplace = savestr(s+1);
988 for (s = inplace; *s && !isspace(*s); s++) ;
990 argvoutstab = stabent("ARGVOUT",TRUE);
994 if (euid != uid || egid != gid)
995 fatal("No -I allowed in setuid scripts");
998 (void)apush(stab_array(incstab),str_make(s,0));
1001 fatal("No space allowed after -I");
1020 fputs(rcsid,stdout);
1021 fputs("\nCopyright (c) 1989, 1990, Larry Wall\n",stdout);
1023 fputs("MS-DOS port Copyright (c) 1989, 1990, Diomidis Spinellis\n",
1027 Perl may be copied only under the terms of the GNU General Public License,\n\
1028 a copy of which can be found with the Perl 3.0 distribution kit.\n",stdout);
1039 fatal("Switch meaningless after -x: -%s",s);