hautils

[hare] Set of POSIX utilities
Log | Files | Refs | README | LICENSE

commit 40662698e2946aa34fe779329c8d57a843e98f70
parent 747a484e18eff22fac76e601213c75858e02c38d
Author: noname <iamthenoname@perso.be>
Date:   Sat, 23 Jul 2022 16:18:28 +0800

Use fatalf() instead of fatal() for formatted error output

Diffstat:
Mcat.ha | 2+-
Mhead.ha | 2+-
Mnl.ha | 2+-
Mtee.ha | 2+-
Muniq.ha | 4++--
5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/cat.ha b/cat.ha @@ -35,7 +35,7 @@ fn open(path: str) io::handle = { match (os::open(path)) { case let err: fs::error => - fmt::fatal("Error opening '{}': {}", path, fs::strerror(err)); + fmt::fatalf("Error opening '{}': {}", path, fs::strerror(err)); case let file: io::file => return file; }; diff --git a/head.ha b/head.ha @@ -32,7 +32,7 @@ export fn utilmain() (void | main::error) = { for (let i = 0z; i < len(cmd.args); i += 1) { const file = match (os::open(cmd.args[i])) { case let err: fs::error => - fmt::fatal("Error opening '{}': {}", + fmt::fatalf("Error opening '{}': {}", cmd.args[i], fs::strerror(err)); case let file: io::file => yield file; diff --git a/nl.ha b/nl.ha @@ -231,7 +231,7 @@ export fn utilmain() (void | main::error) = { const input: io::handle = if (use_file) match (os::open(cmd.args[0])) { case let err: fs::error => - fmt::fatal("Error opening '{}': {}", + fmt::fatalf("Error opening '{}': {}", cmd.args[0], fs::strerror(err)); case let file: io::file => static const rbuf: [os::BUFSIZ]u8 = [0...]; diff --git a/tee.ha b/tee.ha @@ -39,7 +39,7 @@ export fn utilmain() (main::error | void) = { for (let i = 0z; i < len(cmd.args); i += 1) { const file = match (os::create(cmd.args[i], 0o666, flags)) { case let err: fs::error => - fmt::fatal("Error opening '{}' for writing: {}", + fmt::fatalf("Error opening '{}' for writing: {}", cmd.args[i], fs::strerror(err)); case let file: io::file => yield file; diff --git a/uniq.ha b/uniq.ha @@ -132,7 +132,7 @@ export fn utilmain() (main::error | void) = { match (os::open(cmd.args[0])) { case let err: fs::error => getopt::printusage(os::stderr, os::args[0], help); - fmt::fatal("Error opening '{}': {}", + fmt::fatalf("Error opening '{}': {}", cmd.args[0], fs::strerror(err)); case let file: io::file => cfg.input = &bufio::buffered(file, stdin_rbuf, stdin_wbuf); @@ -147,7 +147,7 @@ export fn utilmain() (main::error | void) = { match (os::create(cmd.args[1], 0o666, fs::flags::WRONLY)) { case let err: fs::error => getopt::printusage(os::stderr, os::args[0], help); - fmt::fatal("Error opening '{}': {}", + fmt::fatalf("Error opening '{}': {}", cmd.args[1], fs::strerror(err)); case let file: io::file => cfg.output = &bufio::buffered(file, stdout_rbuf, stdout_wbuf);