main.c (217175) | main.c (218306) |
---|---|
1/*- 2 * Copyright (c) 1991, 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 --- 28 unchanged lines hidden (view full) --- 37#endif /* not lint */ 38 39#ifndef lint 40#if 0 41static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 5/28/95"; 42#endif 43#endif /* not lint */ 44#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1991, 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 --- 28 unchanged lines hidden (view full) --- 37#endif /* not lint */ 38 39#ifndef lint 40#if 0 41static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 5/28/95"; 42#endif 43#endif /* not lint */ 44#include <sys/cdefs.h> |
45__FBSDID("$FreeBSD: head/bin/sh/main.c 217175 2011-01-08 23:08:13Z jilles $"); | 45__FBSDID("$FreeBSD: head/bin/sh/main.c 218306 2011-02-04 22:47:55Z jilles $"); |
46 47#include <stdio.h> 48#include <signal.h> 49#include <sys/stat.h> 50#include <unistd.h> 51#include <fcntl.h> 52#include <locale.h> 53#include <errno.h> --- 39 unchanged lines hidden (view full) --- 93{ 94 struct stackmark smark; 95 volatile int state; 96 char *shinit; 97 98 (void) setlocale(LC_ALL, ""); 99 state = 0; 100 if (setjmp(main_handler.loc)) { | 46 47#include <stdio.h> 48#include <signal.h> 49#include <sys/stat.h> 50#include <unistd.h> 51#include <fcntl.h> 52#include <locale.h> 53#include <errno.h> --- 39 unchanged lines hidden (view full) --- 93{ 94 struct stackmark smark; 95 volatile int state; 96 char *shinit; 97 98 (void) setlocale(LC_ALL, ""); 99 state = 0; 100 if (setjmp(main_handler.loc)) { |
101 /* 102 * When a shell procedure is executed, we raise the 103 * exception EXSHELLPROC to clean up before executing 104 * the shell procedure. 105 */ | |
106 switch (exception) { | 101 switch (exception) { |
107 case EXSHELLPROC: 108 rootpid = getpid(); 109 rootshell = 1; 110 minusc = NULL; 111 state = 3; 112 break; 113 | |
114 case EXEXEC: 115 exitstatus = exerrno; 116 break; 117 118 case EXERROR: 119 exitstatus = 2; 120 break; 121 122 default: 123 break; 124 } 125 | 102 case EXEXEC: 103 exitstatus = exerrno; 104 break; 105 106 case EXERROR: 107 exitstatus = 2; 108 break; 109 110 default: 111 break; 112 } 113 |
126 if (exception != EXSHELLPROC) { 127 if (state == 0 || iflag == 0 || ! rootshell) 128 exitshell(exitstatus); 129 } | 114 if (state == 0 || iflag == 0 || ! rootshell) 115 exitshell(exitstatus); |
130 reset(); 131 if (exception == EXINT) 132 out2fmt_flush("\n"); 133 popstackmark(&smark); 134 FORCEINTON; /* enable interrupts */ 135 if (state == 1) 136 goto state1; 137 else if (state == 2) --- 210 unchanged lines hidden --- | 116 reset(); 117 if (exception == EXINT) 118 out2fmt_flush("\n"); 119 popstackmark(&smark); 120 FORCEINTON; /* enable interrupts */ 121 if (state == 1) 122 goto state1; 123 else if (state == 2) --- 210 unchanged lines hidden --- |