From ac495185aab17ef6030a02ddc0be33380a27a94d Mon Sep 17 00:00:00 2001 From: Chet Ramey Date: Wed, 22 Feb 2017 11:09:11 -0500 Subject: commit bash-20170210 snapshot --- shell.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'shell.c') diff --git a/shell.c b/shell.c index f577ae20..17962a99 100644 --- a/shell.c +++ b/shell.c @@ -223,6 +223,8 @@ int dump_po_strings; /* Dump strings in $"..." in po format */ int wordexp_only = 0; /* Do word expansion only */ int protected_mode = 0; /* No command substitution with --wordexp */ +int pretty_print_mode = 0; /* pretty-print a shell script */ + #if defined (STRICT_POSIX) int posixly_correct = 1; /* Non-zero means posix.2 superset. */ #else @@ -251,6 +253,7 @@ static const struct { { "noprofile", Int, &no_profile, (char **)0x0 }, { "norc", Int, &no_rc, (char **)0x0 }, { "posix", Int, &posixly_correct, (char **)0x0 }, + { "pretty-print", Int, &pretty_print_mode, (char **)0x0 }, #if defined (WORDEXP_OPTION) { "protected", Int, &protected_mode, (char **)0x0 }, #endif @@ -779,6 +782,14 @@ main (argc, argv, env) shell_initialized = 1; + if (pretty_print_mode && interactive_shell) + { + internal_warning (_("pretty-printing mode ignored in interactive shells")); + pretty_print_mode = 0; + } + if (pretty_print_mode) + exit_shell (pretty_print_loop ()); + /* Read commands until exit condition. */ reader_loop (); exit_shell (last_command_exit_value); -- cgit v1.2.1