diff --git a/apps/socket-client.cpp b/apps/socket-client.cpp index 67d2f3d2..9ea4fd29 100644 --- a/apps/socket-client.cpp +++ b/apps/socket-client.cpp @@ -1,11 +1,20 @@ +#include #include #include #include #include #include -int main() +Result luna_main(int argc, char** argv) { + StringView message; + + os::ArgumentParser parser; + parser.add_description("A UNIX domain socket client, to test said sockets."); + parser.add_system_program_info("socket-client"_sv); + parser.add_positional_argument(message, "message"_sv, "exit"_sv); + parser.parse(argc, argv); + int sockfd = socket(AF_UNIX, SOCK_STREAM, 0); if (sockfd < 0) { @@ -31,8 +40,7 @@ int main() printf("Message from server: %s\n", buf); } - const char* message = "EXIT"; - write(sockfd, message, strlen(message)); + write(sockfd, message.chars(), message.length()); close(sockfd);