Module Name:    src
Committed By:   rillig
Date:           Sun Oct 17 17:23:59 UTC 2021

Modified Files:
        src/tests/usr.bin/indent: t_options.sh

Log Message:
tests/lint: use zero-indexed array in awk test program

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/indent/t_options.sh

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

Modified files:

Index: src/tests/usr.bin/indent/t_options.sh
diff -u src/tests/usr.bin/indent/t_options.sh:1.3 src/tests/usr.bin/indent/t_options.sh:1.4
--- src/tests/usr.bin/indent/t_options.sh:1.3	Sun Oct 17 17:20:47 2021
+++ src/tests/usr.bin/indent/t_options.sh	Sun Oct 17 17:23:59 2021
@@ -1,5 +1,5 @@
 #! /bin/sh
-# $NetBSD: t_options.sh,v 1.3 2021/10/17 17:20:47 rillig Exp $
+# $NetBSD: t_options.sh,v 1.4 2021/10/17 17:23:59 rillig Exp $
 #
 # Copyright (c) 2021 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -87,7 +87,7 @@ function die(msg)
 		cmd = ENVIRON["INDENT"]
 		for (i = 3; i <= NF; i++)
 			cmd = cmd " " $i
-		for (i = 1; i <= in_lines_len; i++)
+		for (i = 0; i < in_lines_len; i++)
 			print in_lines[i] | cmd
 		close(cmd)
 		unused = 0
@@ -96,7 +96,7 @@ function die(msg)
 		cmd = ENVIRON["INDENT"]
 		for (i = 3; i <= NF; i++)
 			cmd = cmd " " $i
-		for (i = 1; i <= in_lines_len; i++) {
+		for (i = 0; i < in_lines_len; i++) {
 			print in_lines[i] | cmd
 			print in_lines[i] > "expected.out"
 		}
@@ -116,7 +116,7 @@ function die(msg)
 }
 
 mode == "input" {
-	in_lines[++in_lines_len] = $0
+	in_lines[in_lines_len++] = $0
 	input_all = input_all $0 "\n"
 }
 

Reply via email to