diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2016-11-08 08:09:40 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-08 08:09:40 -0500 |
commit | a809cee58249cc2f42222f1ab5d4746d634c2668 (patch) | |
tree | 1dbd042bd61e17b01ad12143dfb171ecd4e7dbcd /src/shared | |
parent | b719b26cb34e8f2ac752ae7dca2c100b656195a4 (diff) | |
parent | 6e2b4a6994e29544cb25e5387961d8a9dcf65063 (diff) |
Merge pull request #4612 from keszybz/format-strings
Format string tweaks (and a small fix on 32bit)
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/ask-password-api.c | 2 | ||||
-rw-r--r-- | src/shared/cgroup-show.c | 2 | ||||
-rw-r--r-- | src/shared/clean-ipc.c | 2 | ||||
-rw-r--r-- | src/shared/install-printf.c | 2 | ||||
-rw-r--r-- | src/shared/logs-show.c | 11 |
5 files changed, 8 insertions, 11 deletions
diff --git a/src/shared/ask-password-api.c b/src/shared/ask-password-api.c index 2597cfc648..3e877920da 100644 --- a/src/shared/ask-password-api.c +++ b/src/shared/ask-password-api.c @@ -43,7 +43,7 @@ #include "ask-password-api.h" #include "fd-util.h" #include "fileio.h" -#include "formats-util.h" +#include "format-util.h" #include "io-util.h" #include "log.h" #include "macro.h" diff --git a/src/shared/cgroup-show.c b/src/shared/cgroup-show.c index 4db6cefb6e..5d21742a09 100644 --- a/src/shared/cgroup-show.c +++ b/src/shared/cgroup-show.c @@ -28,7 +28,7 @@ #include "cgroup-show.h" #include "cgroup-util.h" #include "fd-util.h" -#include "formats-util.h" +#include "format-util.h" #include "locale-util.h" #include "macro.h" #include "output-mode.h" diff --git a/src/shared/clean-ipc.c b/src/shared/clean-ipc.c index d5db604f03..f2d1555c13 100644 --- a/src/shared/clean-ipc.c +++ b/src/shared/clean-ipc.c @@ -36,7 +36,7 @@ #include "dirent-util.h" #include "fd-util.h" #include "fileio.h" -#include "formats-util.h" +#include "format-util.h" #include "log.h" #include "macro.h" #include "string-util.h" diff --git a/src/shared/install-printf.c b/src/shared/install-printf.c index 007c632f35..823fb61cda 100644 --- a/src/shared/install-printf.c +++ b/src/shared/install-printf.c @@ -22,7 +22,7 @@ #include <string.h> #include <unistd.h> -#include "formats-util.h" +#include "format-util.h" #include "install-printf.h" #include "install.h" #include "macro.h" diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c index 5ad5ade31e..75ea25c8ac 100644 --- a/src/shared/logs-show.c +++ b/src/shared/logs-show.c @@ -33,7 +33,7 @@ #include "alloc-util.h" #include "fd-util.h" -#include "formats-util.h" +#include "format-util.h" #include "hashmap.h" #include "hostname-util.h" #include "io-util.h" @@ -223,10 +223,7 @@ static int output_timestamp_monotonic(FILE *f, sd_journal *j, const char *monoto if (r < 0) return log_error_errno(r, "Failed to get monotonic timestamp: %m"); - fprintf(f, "[%5llu.%06llu]", - (unsigned long long) (t / USEC_PER_SEC), - (unsigned long long) (t % USEC_PER_SEC)); - + fprintf(f, "[%5"PRI_USEC".%06"PRI_USEC"]", t / USEC_PER_SEC, t % USEC_PER_SEC); return 1 + 5 + 1 + 6 + 1; } @@ -268,7 +265,7 @@ static int output_timestamp_realtime(FILE *f, sd_journal *j, OutputMode mode, Ou switch (mode) { case OUTPUT_SHORT_UNIX: - xsprintf(buf, "%10llu.%06llu", (unsigned long long) t, (unsigned long long) (x % USEC_PER_SEC)); + xsprintf(buf, "%10"PRI_TIME".%06"PRIu64, t, x % USEC_PER_SEC); break; case OUTPUT_SHORT_ISO: @@ -292,7 +289,7 @@ static int output_timestamp_realtime(FILE *f, sd_journal *j, OutputMode mode, Ou assert(sizeof(buf) > strlen(buf)); k = sizeof(buf) - strlen(buf); - r = snprintf(buf + strlen(buf), k, ".%06llu", (unsigned long long) (x % USEC_PER_SEC)); + r = snprintf(buf + strlen(buf), k, ".%06"PRIu64, x % USEC_PER_SEC); if (r <= 0 || (size_t) r >= k) { /* too long? */ log_error("Failed to format precise time"); return -EINVAL; |