From 724d0a049f46f68f24d3eca6c7975d12d37d6062 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Tue, 5 May 2026 14:15:22 +0000 Subject: Change redirfd -v to redirfd -f, for less cognitive load No matter how much I tried to use -v, it kept coming out as -f. So, work with the brain, not against it. --- doc/redirfd.html | 6 +++--- src/execline/redirfd.c | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/doc/redirfd.html b/doc/redirfd.html index 295b603..b64743b 100644 --- a/doc/redirfd.html +++ b/doc/redirfd.html @@ -28,7 +28,7 @@ executes a program.
      redirfd [ -r | -w | -u | -a | -x ] [ -n ] [ -b ] fd file prog...
- redirfd [ -r | -w | -u | -a | -x ] [ -n ] [ -b ] [ -v ] [ -e | -E ] var file prog...
+ redirfd [ -r | -w | -u | -a | -x ] [ -n ] [ -b ] [ -f ] [ -e | -E ] var file prog...

@@ -60,10 +60,10 @@ the -n and -b options may be added in any case.

  • -b : change mode of file after opening it: to non-blocking mode if the -n option was not given, to blocking mode if it was.
  • -
  • -v : interpret the first argument as an environment variable, +
  • -f : interpret the first argument as an environment variable, and stores the new file descriptor into that variable before execing.
  • -e : no autoimport. This is the default.
  • -
  • -E : autoimport. This is only useful with the -v option. +
  • -E : autoimport. This is only useful with the -f option. Instead of executing prog..., execute importas -uSi var prog.... This substitutes var into the command line instead of putting it into diff --git a/src/execline/redirfd.c b/src/execline/redirfd.c index e7f491b..c3562f9 100644 --- a/src/execline/redirfd.c +++ b/src/execline/redirfd.c @@ -10,7 +10,7 @@ #include -#define USAGE "redirfd -[ r | w | u | a | x ] [ -N | -n ] [ -b ] [ -v ] [ -E | -e ] fd file prog..." +#define USAGE "redirfd -[ r | w | u | a | x ] [ -N | -n ] [ -b ] [ -f ] [ -E | -e ] fd|var file prog..." #define dieusage() strerr_dieusage(100, USAGE) enum golb_e @@ -23,7 +23,7 @@ enum golb_e GOLB_EXCL = 0x0020, GOLB_NONBLOCK = 0x0040, GOLB_CHANGEMODE = 0x0100, - GOLB_VAR = 0x0200, + GOLB_OPEN = 0x0200, GOLB_AUTOIMPORT = 0x0400, } ; @@ -39,7 +39,7 @@ int main (int argc, char const *const *argv) { .so = 'N', .lo = "block", .clear = GOLB_NONBLOCK, .set = 0 }, { .so = 'n', .lo = "nonblock", .clear = 0, .set = GOLB_NONBLOCK }, { .so = 'b', .lo = "switch-block", .clear = 0, .set = GOLB_CHANGEMODE }, - { .so = 'v', .lo = "variable", .clear = 0, .set = GOLB_VAR }, + { .so = 'f', .lo = "open", .clear = 0, .set = GOLB_OPEN }, { .so = 'e', .lo = "no-autoimport", .clear = GOLB_AUTOIMPORT, .set = 0 }, { .so = 'E', .lo = "autoimport", .clear = 0, .set = GOLB_AUTOIMPORT }, { .so = 0, .lo = "no-read", .clear = GOLB_READ, .set = 0 }, @@ -66,7 +66,7 @@ int main (int argc, char const *const *argv) argc -= golc ; argv += golc ; if (argc < 3) dieusage() ; if (!(wgolb & (GOLB_READ | GOLB_WRITE))) dieusage() ; - if (!(wgolb & GOLB_VAR)) + if (!(wgolb & GOLB_OPEN)) if (!uint0_scan(argv[0], &fdto)) dieusage() ; flags = @@ -90,7 +90,7 @@ int main (int argc, char const *const *argv) if (wgolb & GOLB_CHANGEMODE) if ((wgolb & GOLB_NONBLOCK ? ndelay_off(fd) : ndelay_on(fd)) == -1) strerr_diefu1sys(111, "change blocking mode") ; - if (wgolb & GOLB_VAR) + if (wgolb & GOLB_OPEN) { char fmt[UINT_FMT] ; fmt[uint_fmt(fmt, fd)] = 0 ; -- cgit v1.3.1