From 7d69ac56e256400ab598f6be10e2a0a74619b739 Mon Sep 17 00:00:00 2001 From: apio Date: Fri, 29 Mar 2024 14:42:38 +0100 Subject: [PATCH] apps+libos+shell+wind: Correct a bunch of format strings --- apps/launch.cpp | 2 +- apps/ls.cpp | 11 ++++++----- apps/mktemp.cpp | 2 +- apps/time.cpp | 2 +- libos/src/SharedMemory.cpp | 2 +- shell/main.cpp | 4 ++-- wind/main.cpp | 2 +- 7 files changed, 13 insertions(+), 12 deletions(-) diff --git a/apps/launch.cpp b/apps/launch.cpp index 3282bc7c..f409953a 100644 --- a/apps/launch.cpp +++ b/apps/launch.cpp @@ -95,7 +95,7 @@ Result luna_main(int argc, char** argv) if (fds[i + 1].revents & POLLIN) clients[i]->check_for_messages(); if (fds[i + 1].revents & POLLHUP) { - os::println("launch: Client %d disconnected", i); + os::println("launch: Client %zu disconnected", i); fds.remove_at(i + 1); auto client = clients.remove_at(i); client->disconnect(); diff --git a/apps/ls.cpp b/apps/ls.cpp index ed0141ba..ffa0c5d4 100644 --- a/apps/ls.cpp +++ b/apps/ls.cpp @@ -212,14 +212,15 @@ Result luna_main(int argc, char** argv) { if (colors) { - os::println("%s %u %4s %4s %10lu %s%s" RESET_COLORS "%s" SYMLINK_COLOR "%s" RESET_COLORS, + os::println("%s %lu %4s %4s %10lu %s%s" RESET_COLORS "%s" SYMLINK_COLOR "%s" RESET_COLORS, formatted_mode, st.st_nlink, owner.chars(), group.chars(), st.st_size, file_type_color(file), file.name.chars(), link.is_empty() ? "" : " -> ", link.chars()); } else { - os::println("%s %u %4s %4s %10lu %s%s%s", formatted_mode, st.st_nlink, owner.chars(), group.chars(), - st.st_size, file.name.chars(), link.is_empty() ? "" : " -> ", link.chars()); + os::println("%s %lu %4s %4s %10lu %s%s%s", formatted_mode, st.st_nlink, owner.chars(), + group.chars(), st.st_size, file.name.chars(), link.is_empty() ? "" : " -> ", + link.chars()); } } else @@ -227,13 +228,13 @@ Result luna_main(int argc, char** argv) auto size = TRY(to_dynamic_unit(st.st_size, 10, false, si ? Unit::SI : Unit::Binary, false)); if (colors) { - os::println("%s %u %4s %4s %6s %s%s" RESET_COLORS "%s" SYMLINK_COLOR "%s" RESET_COLORS, + os::println("%s %lu %4s %4s %6s %s%s" RESET_COLORS "%s" SYMLINK_COLOR "%s" RESET_COLORS, formatted_mode, st.st_nlink, owner.chars(), group.chars(), size.chars(), file_type_color(file), file.name.chars(), link.is_empty() ? "" : " -> ", link.chars()); } else { - os::println("%s %u %4s %4s %6s %s%s%s", formatted_mode, st.st_nlink, owner.chars(), group.chars(), + os::println("%s %lu %4s %4s %6s %s%s%s", formatted_mode, st.st_nlink, owner.chars(), group.chars(), size.chars(), file.name.chars(), link.is_empty() ? "" : " -> ", link.chars()); } } diff --git a/apps/mktemp.cpp b/apps/mktemp.cpp index 4e53576b..0d15dd8a 100644 --- a/apps/mktemp.cpp +++ b/apps/mktemp.cpp @@ -34,7 +34,7 @@ Result luna_main(int argc, char** argv) close(fd); } - os::println("%s"_sv, str.chars()); + os::println("%s", str.chars()); return 0; } diff --git a/apps/time.cpp b/apps/time.cpp index abafd482..f38d5fd4 100644 --- a/apps/time.cpp +++ b/apps/time.cpp @@ -33,7 +33,7 @@ Result luna_main(int argc, char** argv) auto cmdline = TRY(String::join(command, " ")); - os::println("%s %d.%.2ds user %d.%.2ds system"_sv, cmdline.chars(), usage.ru_utime.tv_sec, + os::println("%s %ld.%.2lds user %ld.%.2lds system", cmdline.chars(), usage.ru_utime.tv_sec, usage.ru_utime.tv_usec / 10000, usage.ru_stime.tv_sec, usage.ru_stime.tv_usec / 10000); return 0; diff --git a/libos/src/SharedMemory.cpp b/libos/src/SharedMemory.cpp index a2c1405b..49311d93 100644 --- a/libos/src/SharedMemory.cpp +++ b/libos/src/SharedMemory.cpp @@ -23,7 +23,7 @@ namespace os::SharedMemory if (fd < 0) { int olderr = errno; - os::eprintln("os: could not create shared memory region: shm_open failed (%s) - %s", path, + os::eprintln("os: could not create shared memory region: shm_open failed (%s) - %s", path.chars(), strerror(olderr)); return err(olderr); } diff --git a/shell/main.cpp b/shell/main.cpp index 026475af..80c73031 100644 --- a/shell/main.cpp +++ b/shell/main.cpp @@ -144,7 +144,7 @@ Result luna_main(int argc, char** argv) { if (maybe_cmd.error() == EINTR) { - os::println(""); + os::print("\n"); continue; } return maybe_cmd.release_error(); @@ -200,7 +200,7 @@ Result luna_main(int argc, char** argv) int sig = WTERMSIG(status); if (sig != SIGINT && sig != SIGQUIT) os::println("[sh] Process %d exited: %s", child, strsignal(sig)); else - os::println(""); + os::print("\n"); } } diff --git a/wind/main.cpp b/wind/main.cpp index fd67eb75..37823118 100644 --- a/wind/main.cpp +++ b/wind/main.cpp @@ -186,7 +186,7 @@ Result luna_main(int argc, char** argv) if (fds[i + 4].revents & POLLHUP) clients[i]->should_be_disconnected = true; if (clients[i]->should_be_disconnected) { - os::println("wind: Client %d disconnected", i); + os::println("wind: Client %zu disconnected", i); fds.remove_at(i + 4); auto client = clients.remove_at(i); client->conn->disconnect();