Module Name: src
Committed By: kre
Date: Sun Aug 30 16:10:40 UTC 2020
Modified Files:
src/bin/kill: kill.1 kill.c
Log Message:
Use the POSIX specified format if POSIXLY_CORRECT is set in the
environment, rather than the nicer layout that is normally used.
Note this applies to /bin/kill only, the builtin kill in sh uses its
"posix" option for the same purpose, the one in csh only ever uses
POSIX format.
To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/bin/kill/kill.1 src/bin/kill/kill.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/bin/kill/kill.1
diff -u src/bin/kill/kill.1:1.30 src/bin/kill/kill.1:1.31
--- src/bin/kill/kill.1:1.30 Wed May 6 13:13:50 2020
+++ src/bin/kill/kill.1 Sun Aug 30 16:10:40 2020
@@ -1,4 +1,4 @@
-.\" $NetBSD: kill.1,v 1.30 2020/05/06 13:13:50 kre Exp $
+.\" $NetBSD: kill.1,v 1.31 2020/08/30 16:10:40 kre Exp $
.\"
.\" Copyright (c) 1980, 1990, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -81,6 +81,10 @@ parameter
or a signal number.
.Pp
If no operand is given, display the names of all the signals.
+In /bin/kill, if the variable
+.Dv POSIXLY_CORRECT
+is set in the environment, this uses the POSIX specified format,
+otherwise a slightly more pleasing layout is used.
.It Fl signal_name
A symbolic signal name specifying the signal to be sent instead of the
default
Index: src/bin/kill/kill.c
diff -u src/bin/kill/kill.c:1.30 src/bin/kill/kill.c:1.31
--- src/bin/kill/kill.c:1.30 Wed Dec 12 20:22:43 2018
+++ src/bin/kill/kill.c Sun Aug 30 16:10:40 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: kill.c,v 1.30 2018/12/12 20:22:43 kre Exp $ */
+/* $NetBSD: kill.c,v 1.31 2020/08/30 16:10:40 kre Exp $ */
/*
* Copyright (c) 1988, 1993, 1994
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19
#if 0
static char sccsid[] = "@(#)kill.c 8.4 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: kill.c,v 1.30 2018/12/12 20:22:43 kre Exp $");
+__RCSID("$NetBSD: kill.c,v 1.31 2020/08/30 16:10:40 kre Exp $");
#endif
#endif /* not lint */
@@ -267,7 +267,9 @@ printsignals(FILE *fp, int len)
int nl, pad;
const char *name;
int termwidth = 80;
+ int posix;
+ posix = getenv("POSIXLY_CORRECT") != 0;
if ((name = getenv("COLUMNS")) != 0)
termwidth = atoi(name);
else if (isatty(fileno(fp))) {
@@ -278,6 +280,8 @@ printsignals(FILE *fp, int len)
}
pad = (len | 7) + 1 - len;
+ if (posix && pad)
+ pad = 1;
for (sig = 0; (sig = signalnext(sig)) != 0; ) {
name = signalname(sig);
@@ -297,6 +301,8 @@ printsignals(FILE *fp, int len)
len += nl + pad;
pad = (nl | 7) + 1 - nl;
+ if (posix && pad)
+ pad = 1;
fprintf(fp, "%s", name);
}