From aed3d73bbef165c1d4c207861476fb054a602d89 Mon Sep 17 00:00:00 2001 From: Meng Zhuo Date: Tue, 24 Sep 2024 15:38:04 +0800 Subject: [PATCH] Basic mkfifo implementation --- src/mkfifo/mkfifo.v | 1 - src/mkfifo/mkfifo_default.c.v | 4 ++++ src/mkfifo/{mkfifo.c.v => mkfifo_nix.c.v} | 0 src/mkfifo/{mkfifo_test.v => mkfifo_nix_test.v} | 10 +++------- 4 files changed, 7 insertions(+), 8 deletions(-) create mode 100644 src/mkfifo/mkfifo_default.c.v rename src/mkfifo/{mkfifo.c.v => mkfifo_nix.c.v} (100%) rename src/mkfifo/{mkfifo_test.v => mkfifo_nix_test.v} (94%) diff --git a/src/mkfifo/mkfifo.v b/src/mkfifo/mkfifo.v index 928a27f..9b30531 100644 --- a/src/mkfifo/mkfifo.v +++ b/src/mkfifo/mkfifo.v @@ -27,7 +27,6 @@ fn run_mkfifo(args []string) { mut opts := Options{ mode: u32(fp.int('mode', `m`, int(default_mode), 'set file permission bits to MODE, not a=rw - umask')) } - println('${opts.mode:o}') help := fp.bool('help', 0, false, 'display this help and exit') version := fp.bool('version', 0, false, 'output version information and exit') diff --git a/src/mkfifo/mkfifo_default.c.v b/src/mkfifo/mkfifo_default.c.v new file mode 100644 index 0000000..18d114c --- /dev/null +++ b/src/mkfifo/mkfifo_default.c.v @@ -0,0 +1,4 @@ +// mkfifo on unsupported platforms +fn mkfifo(pathname string, mode int) int { + return -1 +} diff --git a/src/mkfifo/mkfifo.c.v b/src/mkfifo/mkfifo_nix.c.v similarity index 100% rename from src/mkfifo/mkfifo.c.v rename to src/mkfifo/mkfifo_nix.c.v diff --git a/src/mkfifo/mkfifo_test.v b/src/mkfifo/mkfifo_nix_test.v similarity index 94% rename from src/mkfifo/mkfifo_test.v rename to src/mkfifo/mkfifo_nix_test.v index 4c9936d..c0b3be9 100644 --- a/src/mkfifo/mkfifo_test.v +++ b/src/mkfifo/mkfifo_nix_test.v @@ -1,16 +1,12 @@ import os import common.testing -const util = 'mkfifo' -const platform_util = $if !windows { - util -} - const rig = testing.prepare_rig(util: util) -const eol = testing.output_eol() - const tfolder = os.join_path(os.temp_dir(), 'coreutils', 'mkfifo_test') +const util = 'mkfifo' +const platform_util = util + const executable_under_test = testing.prepare_executable(util) const cmd = testing.new_paired_command(platform_util, executable_under_test)