Re: sort --version-sort

2025-02-18 Thread наб
On Tue, Feb 18, 2025 at 09:10:44AM -0500, enh wrote: > fwiw, one reason i never bothered implementing strverscmp() for > Android is that (a) basic testing showed that the gnu documentation > didn't match their implementation and (b) no two existing > implementations appeared to behave the same. It

Re: crontab(1) using stdin

2024-10-30 Thread наб
On Thu, Oct 31, 2024 at 12:35:01AM +0100, Steffen Nurpmeso wrote: > наб wrote in >.xyz>: > |You can still write this portably: > | echo crontab > ./- > | crontab - < - > | rm - > |unideal, sure, but. > OpenIndiana says > #?1|oi-2024:steffen$ cr

Re: crontab(1) using stdin

2024-10-30 Thread наб
On Wed, Oct 30, 2024 at 06:29:57PM +0100, Edgar Fuß wrote: > > If NetBSD "crontab" errors with > > "use crontab - to replace your crontab from the standard input stream" > > then that's an improvement over both the standard and the status quo IMO > While I agree that what POSIX demands is not idea

Re: crontab(1) using stdin

2024-10-30 Thread наб
On Tue, Oct 29, 2024 at 07:11:10PM +0100, Edgar Fuß wrote: > > Those are not inconsistent, unless SUS specifies other behaviour for > > the case of a bare -, or NetBSD's version doesn't read from stdin when > > no (pseudo-)filename is given. They are, POSIX says something like 97851 STDIN 9785

[PATCH] link.2: NetBSD doesn't allow link(2) to a directory, ever

2024-07-19 Thread наб
cf. src/sys/kern/vfs_syscalls.c#do_sys_linkat: /* Prevent hard links on directories. */ if (vp->v_type == VDIR) { error = EPERM; goto abortop; } This happens before any call to the VFS, so NetBSD simply refuses links to directories (this is l

Re: POSIX.2, IFS and echo command

2024-07-06 Thread наб
On Sat, Jul 06, 2024 at 06:09:16PM +0200, tlaro...@kergis.com wrote: > With sh(1), and specially on NetBSD, I tend to expect this behavior: > > $ line=$(printf "a\tb") > $ echo $line | od -a > 000a sp b nl > 004 line has the value a, tab, b. Given the default value of IFS (space,

Re: compilers and unused args in functions

2024-07-05 Thread наб
On Fri, Jul 05, 2024 at 10:03:05AM -0400, Mouse wrote: > In...C++, I think it is?, you can do this by declaring the unused arg > without a name, as in > > void fxn(int arg1, int) > { > ... > } > > but as far as I know nobody's picked that up in C. (It strikes me as a > very sensible approach.)

Re: lseek on tty

2023-09-18 Thread наб
is not a proper value, or the resulting file offset would 46260be negative for a regular file, block special file, or directory. Best, наб signature.asc Description: PGP signature

Re: old style tail(1) options and bin/57483

2023-07-04 Thread наб
For my personal use and tail, I've arrived at: if(argv[0] && argv[1] && (!argv[2] || !argv[3]) && (*argv[1] == '-' || *argv[1] == '+') && (*argv[1] != '-' || (*(argv[1] + 1) != 'c' && *(argv[1] + 1) != 'f' && *(argv[1] + 1) != 'r')) && (!argv[2] || *argv[2] != '-')) {

Re: printf(1), sh(1), POSIX.2 and octal escape sequences

2023-07-03 Thread наб
On Mon, Jul 03, 2023 at 06:13:45AM +, David Holland wrote: > On Fri, Jun 30, 2023 at 05:51:13PM +0200, tlaro...@polynum.com wrote: > > For this one I will go with the established behavior, but what should I > > do when someone is passing, in octal or in hexa: "\000" ou "\x00"? > If you don't

Re: printf(1), sh(1), POSIX.2 and octal escape sequences

2023-06-28 Thread наб
g indicates "Extension to the ISO C standard"). Funnily, one place in the teletype definitions still uses "bits per byte" instead of "bits per character" as a historical artifact. uudecode is defined as undefined if the encoder and decoder have different byte widths. Best, наб signature.asc Description: PGP signature

Re: Proposed chown(8)/chgrp(1) enhancement

2023-04-28 Thread наб
anges existing behaviour. OTOH if you add a && !(p->fts_statp->st_mode & 07000) then that's probably fine. Best, наб signature.asc Description: PGP signature

Re: POSIX changes in upcoming (maybe this year) standard (tsort)

2023-01-05 Thread наб
ns that the implementation need not support any options. Standard utilities that do not accept options, but that do accept operands, shall recognize "--" as a first argument to be discarded. Best, наб signature.asc Description: PGP signature

[PATCH] script.c: bubble exit code with -c instead of always exiting 143

2022-01-29 Thread наб
Right now, doshell() with -c always falls down to fail(), which SIGTERMs the process group, so the exit code is always 143: $ script -ec 'echo a; exit 12' Script started, output file is typescript a Script done, output file is typescript $ echo $? 143 Instead, handle non-error returns

Re: [PATCH 0/6] script(1) cleanups, -e to pass through exit code

2022-01-04 Thread наб
use the string is subject to shell expansion. > Sure, it could say "is run by /bin/sh", but there's no need to > have people race off to the sh manual to find out what -c means, > if they don't already know. I mean, I wouldn't say I necessarily agree because that'

Re: [PATCH 0/6] script(1) cleanups, -e to pass through exit code

2022-01-04 Thread наб
-c /actually/ took a command, like FreeBSD script does. As it stands, and, for compatibility, presumably as it will stand, script takes a shell program, not a command, and script -c 'for i in 0 1 2 3 4 5 6; do echo $i; done; exec ls' is valid. Admittedly, saying "-c script" or "-c shell-program" /would/ be too much, but as it stands, it's still important to note this, because the string is subject to shell expansion. Best, наб signature.asc Description: PGP signature

[PATCH 0/6] script(1) cleanups, -e to pass through exit code

2022-01-03 Thread наб
atomic as possible; there are, of course, ways to meld them together if you'd rather them be bigger; it's possible, also, that you'd prefer passthrough to happen always: in this case 5/6 needs to be dropped and 6/6 reworded. Best, наб (6): script.c: fix usage string script.c: use

[PATCH] dd: merge ibm and oldibm

2022-01-03 Thread наб
#x27;s) dd: the "ibm" and "oldibm" tables are identical, because POSIX just standardised the table from V7. No-body, including the original authors, seeems to have noticed this. This patch merges them and notes this fact in the manual (and also fixes the odd, inconsistent, spellin

[PATCH 6/6] script.1: note -e flag

2022-01-03 Thread наб
--- script.1 | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/script.1 b/script.1 index 07d01f0..6e8dc87 100644 --- a/script.1 +++ b/script.1 @@ -37,7 +37,7 @@ .Nd make typescript of terminal session .Sh SYNOPSIS .Nm -.Op Fl adfpqr +.Op Fl adefpqr .Op Fl c Ar command .

[PATCH 5/6] script.c: gate child exit code on -e flag

2022-01-03 Thread наб
--- script.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/script.c b/script.c index 4899d35..407793f 100644 --- a/script.c +++ b/script.c @@ -81,6 +81,7 @@ static intusesleep, rawout; static int quiet, flush; static const char *fname; +static int e

[PATCH 4/6] script.c: exit with the exit code of the child

2022-01-03 Thread наб
--- script.c | 37 +++-- 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/script.c b/script.c index 1b42a3b..4899d35 100644 --- a/script.c +++ b/script.c @@ -84,7 +84,7 @@ static const char *fname; static int isterm; static struct termios tt;

[PATCH 3/6] script.1: clarify that -c runs the argument via sh -c

2022-01-03 Thread наб
--- script.1 | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/script.1 b/script.1 index 51c76d8..07d01f0 100644 --- a/script.1 +++ b/script.1 @@ -29,7 +29,7 @@ .\" .\"@(#)script.18.1 (Berkeley) 6/6/93 .\" -.Dd October 17, 2009 +.Dd January 3, 2022 .Dt SCRIPT

[PATCH 2/6] script.c: use sh -c directly instead of system(3)

2022-01-03 Thread наб
--- script.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/script.c b/script.c index 209505c..1b42a3b 100644 --- a/script.c +++ b/script.c @@ -293,12 +293,12 @@ doshell(const char *command) if (shell == NULL) shell = _PATH_BSHELL;

[PATCH 1/6] script.c: fix usage string

2022-01-03 Thread наб
--- script.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script.c b/script.c index 0c60922..209505c 100644 --- a/script.c +++ b/script.c @@ -139,7 +139,7 @@ main(int argc, char *argv[]) case '?': default: (void)fprintf