mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 01:27:34 +00:00
Userland: Replace most printf-style APIs with AK::Format APIs :^)
This commit is contained in:
parent
4f1889c2cb
commit
f5c35fccca
75 changed files with 642 additions and 644 deletions
|
@ -8,17 +8,16 @@
|
|||
#include <AK/ByteBuffer.h>
|
||||
#include <AK/JsonObject.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
auto file = Core::File::construct("/proc/net/arp");
|
||||
if (!file->open(Core::OpenMode::ReadOnly)) {
|
||||
fprintf(stderr, "Error: %s\n", file->error_string());
|
||||
warnln("Failed to open {}: {}", file->name(), file->error_string());
|
||||
return 1;
|
||||
}
|
||||
|
||||
printf("Address HWaddress\n");
|
||||
outln("Address HWaddress");
|
||||
auto file_contents = file->read_all();
|
||||
auto json = JsonValue::from_string(file_contents);
|
||||
VERIFY(json.has_value());
|
||||
|
@ -28,9 +27,7 @@ int main()
|
|||
auto ip_address = if_object.get("ip_address").to_string();
|
||||
auto mac_address = if_object.get("mac_address").to_string();
|
||||
|
||||
printf("%-15s ", ip_address.characters());
|
||||
printf("%-17s ", mac_address.characters());
|
||||
printf("\n");
|
||||
outln("{:15} {:17}", ip_address, mac_address);
|
||||
});
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue