Module Name:    src
Committed By:   rillig
Date:           Mon Sep  5 17:13:37 UTC 2022

Modified Files:
        src/usr.bin/make: make.1

Log Message:
make.1: clarify interpretation of conditionals

String literals in quotes are never interpreted as numbers.

The operators '<', '<=', '>', '>=' are only allowed in numeric
comparisons.

Avoid the term 'C relational operators' since in C, the relational
operators exclude '==' and '!=', which are called equality operators
instead.


To generate a diff of this commit:
cvs rdiff -u -r1.332 -r1.333 src/usr.bin/make/make.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/make.1
diff -u src/usr.bin/make/make.1:1.332 src/usr.bin/make/make.1:1.333
--- src/usr.bin/make/make.1:1.332	Sat Sep  3 00:50:07 2022
+++ src/usr.bin/make/make.1	Mon Sep  5 17:13:36 2022
@@ -1,4 +1,4 @@
-.\"	$NetBSD: make.1,v 1.332 2022/09/03 00:50:07 rillig Exp $
+.\"	$NetBSD: make.1,v 1.333 2022/09/05 17:13:36 rillig Exp $
 .\"
 .\" Copyright (c) 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -2011,23 +2011,28 @@ has been defined and has commands associ
 .Pp
 .Ar Expression
 may also be an arithmetic or string comparison.
-Variable expansion is
-performed on both sides of the comparison, after which the numerical
-values are compared.
-A value is interpreted as hexadecimal if it is
-preceded by 0x, otherwise it is decimal; octal numbers are not supported.
-The standard C relational operators are all supported.
-If after
-variable expansion, either the left or right hand side of a
-.Sq Ic ==
-or
-.Sq Ic "!="
-operator is not a numerical value, then
-string comparison is performed between the expanded
-variables.
-If no relational operator is given, it is assumed that the expanded
-variable is being compared against 0, or an empty string in the case
-of a string comparison.
+Variable expansion is performed on both sides of the comparison.
+If both sides are numeric and neither is enclosed in quotes,
+the comparison is done numerically, otherwise lexicographically.
+A string is interpreted as hexadecimal integer if it is preceded by
+.Li 0x ,
+otherwise it is a decimal floating-point number;
+octal numbers are not supported.
+.Pp
+All comparisons may use the operators
+.Sq Ic \&==
+and
+.Sq Ic \&!= .
+Numeric comparisons may also use the operators
+.Sq Ic \&< ,
+.Sq Ic \&<= ,
+.Sq Ic \&>
+and
+.Sq Ic \&>= .
+.Pp
+If the comparison has neither a comparison operator nor a right side,
+the expression evaluates to true if it is nonempty
+and its numeric value (if any) is not zero.
 .Pp
 When
 .Nm

Reply via email to