Gentoo Archives: gentoo-commits

From: "Petteri Räty" <betelgeuse@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/libbash:master commit in: scripts/, src/builtins/
Date: Fri, 27 May 2011 23:04:15
Message-Id: f2cf06bb14022d693a21b6f2763314770b912034.betelgeuse@gentoo
1 commit: f2cf06bb14022d693a21b6f2763314770b912034
2 Author: Mu Qiao <qiaomuf <AT> gentoo <DOT> org>
3 AuthorDate: Wed May 25 14:11:47 2011 +0000
4 Commit: Petteri Räty <betelgeuse <AT> gentoo <DOT> org>
5 CommitDate: Thu May 26 08:20:31 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/libbash.git;a=commit;h=f2cf06bb
7
8 Builtin: fix a bug in echo built-in
9
10 The echo built-in should print an empty line if no argument is
11 provided. Now this is supported.
12
13 ---
14 scripts/function_def.bash.result | 1 +
15 src/builtins/echo_builtin.cpp | 6 ++++++
16 2 files changed, 7 insertions(+), 0 deletions(-)
17
18 diff --git a/scripts/function_def.bash.result b/scripts/function_def.bash.result
19 index 41e19ca..cebbfae 100644
20 --- a/scripts/function_def.bash.result
21 +++ b/scripts/function_def.bash.result
22 @@ -1,4 +1,5 @@
23 hi 1 1
24 +
25 overloaded let
26 1 2 3
27 1 2 3
28
29 diff --git a/src/builtins/echo_builtin.cpp b/src/builtins/echo_builtin.cpp
30 index 28b4d65..0e21707 100644
31 --- a/src/builtins/echo_builtin.cpp
32 +++ b/src/builtins/echo_builtin.cpp
33 @@ -42,6 +42,12 @@ int echo_builtin::exec(const std::vector<std::string>& bash_args)
34 bool enable_escapes = false;
35 bool options_parsed = false;
36
37 + if(bash_args.empty())
38 + {
39 + this->out_buffer() << std::endl;
40 + return 0;
41 + }
42 +
43 for(auto i = bash_args.begin(); i != bash_args.end(); i++)
44 {
45 const std::string& str = *i;