diff options
author | jilles <jilles@FreeBSD.org> | 2013-07-25 15:08:41 +0000 |
---|---|---|
committer | jilles <jilles@FreeBSD.org> | 2013-07-25 15:08:41 +0000 |
commit | 0ad2a46f33944b5fedbda54167af5739c8c5ed84 (patch) | |
tree | 4cdf5ff0108f4909c6111d72ffe6f925dec35704 /bin/sh/main.c | |
parent | 34bfb313cd341ffba7e1c34cdc5f2aabc7cd8ec5 (diff) | |
download | FreeBSD-src-0ad2a46f33944b5fedbda54167af5739c8c5ed84.zip FreeBSD-src-0ad2a46f33944b5fedbda54167af5739c8c5ed84.tar.gz |
sh: Remove mkinit.
Replace the RESET blocks with regular functions and a reset() function that
calls them all.
This code generation tool is unusual and does not appear to provide much
benefit. I do not think isolating the knowledge about which modules need to
be reset is worth an almost 500-line build tool and wider scope for
variables used by the reset functions.
Also, relying on reset functions is often wrong: the cleanup should be done
in exception handlers so that no stale state remains after 'command eval'
and the like.
Diffstat (limited to 'bin/sh/main.c')
-rw-r--r-- | bin/sh/main.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/bin/sh/main.c b/bin/sh/main.c index 0c496d0..2b99edd 100644 --- a/bin/sh/main.c +++ b/bin/sh/main.c @@ -68,10 +68,10 @@ __FBSDID("$FreeBSD$"); #include "show.h" #include "memalloc.h" #include "error.h" -#include "init.h" #include "mystring.h" #include "exec.h" #include "cd.h" +#include "redir.h" #include "builtins.h" int rootpid; @@ -79,6 +79,7 @@ int rootshell; struct jmploc main_handler; int localeisutf8, initial_localeisutf8; +static void reset(void); static void cmdloop(int); static void read_profile(const char *); static char *find_dot_file(char *); @@ -179,6 +180,14 @@ state4: return 0; } +static void +reset(void) +{ + reseteval(); + resetinput(); + resetparser(); + resetredir(); +} /* * Read and execute commands. "Top" is nonzero for the top level command |