diff options
author | Mike Frysinger <vapier@gentoo.org> | 2009-06-01 14:14:36 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2009-06-01 14:16:43 -0400 |
commit | 6a46ab8b8fe3547cf9de4c0ff7e9420d87f8a3cb (patch) | |
tree | f95bb98bcef465a75d14552bdab3c0ff7bb39a20 /shell | |
parent | ef3e7fdd3b18ef3c43a58a06251eaf615e18a789 (diff) | |
download | busybox-w32-6a46ab8b8fe3547cf9de4c0ff7e9420d87f8a3cb.tar.gz busybox-w32-6a46ab8b8fe3547cf9de4c0ff7e9420d87f8a3cb.tar.bz2 busybox-w32-6a46ab8b8fe3547cf9de4c0ff7e9420d87f8a3cb.zip |
hush: unify syntax_error_unterm_{ch,str} a bit
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'shell')
-rw-r--r-- | shell/hush.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/shell/hush.c b/shell/hush.c index 4c45e6559..e3f7b6eb7 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
@@ -771,6 +771,11 @@ static void syntax_error_at(unsigned lineno, const char *msg) | |||
771 | die_if_script(lineno, "syntax error at '%s'", msg); | 771 | die_if_script(lineno, "syntax error at '%s'", msg); |
772 | } | 772 | } |
773 | 773 | ||
774 | static void syntax_error_unterm_str(unsigned lineno, const char *s) | ||
775 | { | ||
776 | die_if_script(lineno, "syntax error: unterminated %s", s); | ||
777 | } | ||
778 | |||
774 | /* It so happens that all such cases are totally fatal | 779 | /* It so happens that all such cases are totally fatal |
775 | * even if shell is interactive: EOF while looking for closing | 780 | * even if shell is interactive: EOF while looking for closing |
776 | * delimiter. There is nowhere to read stuff from after that, | 781 | * delimiter. There is nowhere to read stuff from after that, |
@@ -779,18 +784,11 @@ static void syntax_error_at(unsigned lineno, const char *msg) | |||
779 | static void syntax_error_unterm_ch(unsigned lineno, char ch) NORETURN; | 784 | static void syntax_error_unterm_ch(unsigned lineno, char ch) NORETURN; |
780 | static void syntax_error_unterm_ch(unsigned lineno, char ch) | 785 | static void syntax_error_unterm_ch(unsigned lineno, char ch) |
781 | { | 786 | { |
782 | char msg[2]; | 787 | char msg[2] = { ch, '\0' }; |
783 | msg[0] = ch; | 788 | syntax_error_unterm_str(lineno, msg); |
784 | msg[1] = '\0'; | ||
785 | die_if_script(lineno, "syntax error: unterminated %s", msg); | ||
786 | xfunc_die(); | 789 | xfunc_die(); |
787 | } | 790 | } |
788 | 791 | ||
789 | static void syntax_error_unterm_str(unsigned lineno, const char *s) | ||
790 | { | ||
791 | die_if_script(lineno, "syntax error: unterminated %s", s); | ||
792 | } | ||
793 | |||
794 | static void syntax_error_unexpected_ch(unsigned lineno, int ch) | 792 | static void syntax_error_unexpected_ch(unsigned lineno, int ch) |
795 | { | 793 | { |
796 | char msg[2]; | 794 | char msg[2]; |