diff options
author | Andreas Kling <kling@serenityos.org> | 2020-03-25 15:48:35 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-03-25 15:48:35 +0100 |
commit | efbcdd6d34ea427d19d4118ada276d48ad9981da (patch) | |
tree | 276f090a528f09e927e0fa69dbed573b7a8acf42 /Userland/uname.cpp | |
parent | 45488401b108c376cd1cc91414bcf8007e45c13a (diff) | |
download | serenity-efbcdd6d34ea427d19d4118ada276d48ad9981da.zip |
uname: Remove trailing space character
Diffstat (limited to 'Userland/uname.cpp')
-rw-r--r-- | Userland/uname.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/Userland/uname.cpp b/Userland/uname.cpp index b24b33cee7..fe9e22f84a 100644 --- a/Userland/uname.cpp +++ b/Userland/uname.cpp @@ -24,6 +24,9 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include <AK/String.h> +#include <AK/StringBuilder.h> +#include <AK/Vector.h> #include <stdio.h> #include <sys/utsname.h> #include <unistd.h> @@ -74,14 +77,17 @@ int main(int argc, char** argv) } if (!flag_s && !flag_n && !flag_r && !flag_m) flag_s = true; + Vector<String> parts; if (flag_s) - printf("%s ", uts.sysname); + parts.append(uts.sysname); if (flag_n) - printf("%s ", uts.nodename); + parts.append(uts.nodename); if (flag_r) - printf("%s ", uts.release); + parts.append(uts.release); if (flag_m) - printf("%s ", uts.machine); - printf("\n"); + parts.append(uts.machine); + StringBuilder builder; + builder.join(' ', parts); + puts(builder.to_string().characters()); return 0; } |