diff options
author | Linus Groh <mail@linusgroh.de> | 2021-05-31 14:39:36 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2021-05-31 17:43:54 +0100 |
commit | 1b81b636637781f7519ab2ad6c107a9e398e830b (patch) | |
tree | 5b9fc2741e21514c1d0883f003b731133fdf1ee4 /Userland/Libraries/LibC | |
parent | 028a337a6db79c00493a7870367911b3f319eb3d (diff) | |
download | serenity-1b81b636637781f7519ab2ad6c107a9e398e830b.zip |
LibC: Replace fprintf(stderr) with warnln()
Diffstat (limited to 'Userland/Libraries/LibC')
-rw-r--r-- | Userland/Libraries/LibC/grp.cpp | 6 | ||||
-rw-r--r-- | Userland/Libraries/LibC/netdb.cpp | 6 | ||||
-rw-r--r-- | Userland/Libraries/LibC/termcap.cpp | 15 |
3 files changed, 11 insertions, 16 deletions
diff --git a/Userland/Libraries/LibC/grp.cpp b/Userland/Libraries/LibC/grp.cpp index 16c2eb011a..a3032b569d 100644 --- a/Userland/Libraries/LibC/grp.cpp +++ b/Userland/Libraries/LibC/grp.cpp @@ -77,7 +77,7 @@ static bool parse_grpdb_entry(const String& line) { auto parts = line.split_view(':', true); if (parts.size() != 4) { - fprintf(stderr, "getgrent(): Malformed entry on line %u: '%s' has %zu parts\n", s_line_number, line.characters(), parts.size()); + warnln("getgrent(): Malformed entry on line {}: '{}' has {} parts", s_line_number, line, parts.size()); return false; } @@ -89,7 +89,7 @@ static bool parse_grpdb_entry(const String& line) auto gid = gid_string.to_uint(); if (!gid.has_value()) { - fprintf(stderr, "getgrent(): Malformed GID on line %u\n", s_line_number); + warnln("getgrent(): Malformed GID on line {}", s_line_number); return false; } @@ -119,7 +119,7 @@ struct group* getgrent() return nullptr; if (ferror(s_stream)) { - fprintf(stderr, "getgrent(): Read error: %s\n", strerror(ferror(s_stream))); + warnln("getgrent(): Read error: {}", strerror(ferror(s_stream))); return nullptr; } diff --git a/Userland/Libraries/LibC/netdb.cpp b/Userland/Libraries/LibC/netdb.cpp index 77d0b790dd..fad14c2b40 100644 --- a/Userland/Libraries/LibC/netdb.cpp +++ b/Userland/Libraries/LibC/netdb.cpp @@ -433,14 +433,14 @@ static bool fill_getserv_buffers(const char* line, ssize_t read) // Services file entries should always at least contain // name and port/protocol, separated by tabs. if (split_line.size() < 2) { - fprintf(stderr, "getservent(): malformed services file\n"); + warnln("getservent(): malformed services file"); return false; } __getserv_name_buffer = split_line[0]; auto port_protocol_split = String(split_line[1]).split('/'); if (port_protocol_split.size() < 2) { - fprintf(stderr, "getservent(): malformed services file\n"); + warnln("getservent(): malformed services file"); return false; } auto number = port_protocol_split[0].to_int(); @@ -615,7 +615,7 @@ static bool fill_getproto_buffers(const char* line, ssize_t read) // This indicates an incorrect file format. Protocols file entries should // always have at least a name and a protocol. if (split_line.size() < 2) { - fprintf(stderr, "getprotoent(): malformed protocols file\n"); + warnln("getprotoent(): malformed protocols file"); return false; } __getproto_name_buffer = split_line[0]; diff --git a/Userland/Libraries/LibC/termcap.cpp b/Userland/Libraries/LibC/termcap.cpp index 30216da2a7..93c4d9f1be 100644 --- a/Userland/Libraries/LibC/termcap.cpp +++ b/Userland/Libraries/LibC/termcap.cpp @@ -9,7 +9,6 @@ #include <AK/String.h> #include <AK/Vector.h> #include <assert.h> -#include <stdio.h> #include <string.h> #include <termcap.h> @@ -21,8 +20,7 @@ char* BC; int tgetent([[maybe_unused]] char* bp, [[maybe_unused]] const char* name) { - if constexpr (TERMCAP_DEBUG) - fprintf(stderr, "tgetent: bp=%p, name='%s'\n", bp, name); + warnln_if(TERMCAP_DEBUG, "tgetent: bp={:p}, name='{}'", bp, name); PC = '\0'; BC = const_cast<char*>("\033[D"); UP = const_cast<char*>("\033[A"); @@ -80,8 +78,7 @@ static void ensure_caps() char* tgetstr(const char* id, char** area) { ensure_caps(); - if constexpr (TERMCAP_DEBUG) - fprintf(stderr, "tgetstr: id='%s'\n", id); + warnln_if(TERMCAP_DEBUG, "tgetstr: id='{}'", id); auto it = caps->find(id); if (it != caps->end()) { char* ret = *area; @@ -90,7 +87,7 @@ char* tgetstr(const char* id, char** area) *area += strlen(val) + 1; return ret; } - fprintf(stderr, "tgetstr: missing cap id='%s'\n", id); + warnln_if(TERMCAP_DEBUG, "tgetstr: missing cap id='{}'", id); return nullptr; } @@ -98,8 +95,7 @@ char* tgetstr(const char* id, char** area) int tgetflag([[maybe_unused]] const char* id) { - if constexpr (TERMCAP_DEBUG) - fprintf(stderr, "tgetflag: '%s'\n", id); + warnln_if(TERMCAP_DEBUG, "tgetflag: '{}'", id); auto it = caps->find(id); if (it != caps->end()) return 1; @@ -108,8 +104,7 @@ int tgetflag([[maybe_unused]] const char* id) int tgetnum(const char* id) { - if constexpr (TERMCAP_DEBUG) - fprintf(stderr, "tgetnum: '%s'\n", id); + warnln_if(TERMCAP_DEBUG, "tgetnum: '{}'", id); auto it = caps->find(id); if (it != caps->end()) return atoi((*it).value); |