main.c (253271) | main.c (253650) |
---|---|
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 253271 2013-07-12 15:29:41Z jilles $"); | 45__FBSDID("$FreeBSD: head/bin/sh/main.c 253650 2013-07-25 15:08:41Z 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> --- 9 unchanged lines hidden (view full) --- 63#include "eval.h" 64#include "jobs.h" 65#include "input.h" 66#include "trap.h" 67#include "var.h" 68#include "show.h" 69#include "memalloc.h" 70#include "error.h" | 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> --- 9 unchanged lines hidden (view full) --- 63#include "eval.h" 64#include "jobs.h" 65#include "input.h" 66#include "trap.h" 67#include "var.h" 68#include "show.h" 69#include "memalloc.h" 70#include "error.h" |
71#include "init.h" | |
72#include "mystring.h" 73#include "exec.h" 74#include "cd.h" | 71#include "mystring.h" 72#include "exec.h" 73#include "cd.h" |
74#include "redir.h" |
|
75#include "builtins.h" 76 77int rootpid; 78int rootshell; 79struct jmploc main_handler; 80int localeisutf8, initial_localeisutf8; 81 | 75#include "builtins.h" 76 77int rootpid; 78int rootshell; 79struct jmploc main_handler; 80int localeisutf8, initial_localeisutf8; 81 |
82static void reset(void); |
|
82static void cmdloop(int); 83static void read_profile(const char *); 84static char *find_dot_file(char *); 85 86/* 87 * Main routine. We initialize things, parse the arguments, execute 88 * profiles if we're a login shell, and then call cmdloop to execute 89 * commands. The setjmp call sets up the location to jump to when an --- 84 unchanged lines hidden (view full) --- 174 if (sflag || minusc == NULL) { 175 cmdloop(1); 176 } 177 exitshell(exitstatus); 178 /*NOTREACHED*/ 179 return 0; 180} 181 | 83static void cmdloop(int); 84static void read_profile(const char *); 85static char *find_dot_file(char *); 86 87/* 88 * Main routine. We initialize things, parse the arguments, execute 89 * profiles if we're a login shell, and then call cmdloop to execute 90 * commands. The setjmp call sets up the location to jump to when an --- 84 unchanged lines hidden (view full) --- 175 if (sflag || minusc == NULL) { 176 cmdloop(1); 177 } 178 exitshell(exitstatus); 179 /*NOTREACHED*/ 180 return 0; 181} 182 |
183static void 184reset(void) 185{ 186 reseteval(); 187 resetinput(); 188 resetparser(); 189 resetredir(); 190} |
|
182 183/* 184 * Read and execute commands. "Top" is nonzero for the top level command 185 * loop; it turns on prompting if the shell is interactive. 186 */ 187 188static void 189cmdloop(int top) --- 151 unchanged lines hidden --- | 191 192/* 193 * Read and execute commands. "Top" is nonzero for the top level command 194 * loop; it turns on prompting if the shell is interactive. 195 */ 196 197static void 198cmdloop(int top) --- 151 unchanged lines hidden --- |