summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorBrian Gianforcaro <bgianf@serenityos.org>2021-12-24 08:21:09 -0800
committerBrian Gianforcaro <b.gianfo@gmail.com>2021-12-24 14:29:52 -0800
commit81c98502f3f362036c9a4e48ffc1c541520a3f9b (patch)
tree028cf2c723803d412d4d84fc084ac74289b141aa /Userland
parenta62669ebcfbec7e633a2250ca17d48a2550fee98 (diff)
downloadserenity-81c98502f3f362036c9a4e48ffc1c541520a3f9b.zip
pwd: Convert to `serenity_main(..)`
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Utilities/CMakeLists.txt1
-rw-r--r--Userland/Utilities/pwd.cpp14
2 files changed, 8 insertions, 7 deletions
diff --git a/Userland/Utilities/CMakeLists.txt b/Userland/Utilities/CMakeLists.txt
index 8a1677b4dc..8916ec32b0 100644
--- a/Userland/Utilities/CMakeLists.txt
+++ b/Userland/Utilities/CMakeLists.txt
@@ -125,6 +125,7 @@ target_link_libraries(pls LibCrypt)
target_link_libraries(pmap LibMain)
target_link_libraries(pro LibProtocol)
target_link_libraries(ps LibMain)
+target_link_libraries(pwd LibMain)
target_link_libraries(run-tests LibRegex)
target_link_libraries(shot LibGUI)
target_link_libraries(sql LibLine LibSQL LibIPC)
diff --git a/Userland/Utilities/pwd.cpp b/Userland/Utilities/pwd.cpp
index 43fa05c8b1..358b095c45 100644
--- a/Userland/Utilities/pwd.cpp
+++ b/Userland/Utilities/pwd.cpp
@@ -4,14 +4,14 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
+#include <AK/Format.h>
+#include <AK/String.h>
+#include <LibCore/System.h>
+#include <LibMain/Main.h>
-int main(int, char**)
+ErrorOr<int> serenity_main(Main::Arguments)
{
- char* cwd = getcwd(nullptr, 0);
- puts(cwd);
- free(cwd);
+ TRY(Core::System::pledge("stdio"));
+ outln(TRY(Core::System::getcwd()));
return 0;
}