mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 09:24:57 +00:00
Userland: Convert command line arguments to String/StringView
StringView was used where possible. Some utilities still use libc functions which expect null-terminated strings, so String objects were used there instead.
This commit is contained in:
parent
fded8f861d
commit
60f6bc902b
25 changed files with 101 additions and 100 deletions
|
@ -17,7 +17,7 @@ ErrorOr<int> serenity_main(Main::Arguments args)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio unix"));
|
||||
|
||||
char const* name_or_ip = nullptr;
|
||||
String name_or_ip {};
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.set_general_help("Convert between domain name and IPv4 address.");
|
||||
args_parser.add_positional_argument(name_or_ip, "Domain name or IPv4 address", "name");
|
||||
|
@ -37,7 +37,7 @@ ErrorOr<int> serenity_main(Main::Arguments args)
|
|||
return 0;
|
||||
}
|
||||
|
||||
auto* hostent = gethostbyname(name_or_ip);
|
||||
auto* hostent = gethostbyname(name_or_ip.characters());
|
||||
if (!hostent) {
|
||||
warnln("Lookup failed for '{}'", name_or_ip);
|
||||
return 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue