Module Name:    src
Committed By:   christos
Date:           Mon Dec 17 20:10:52 UTC 2018

Modified Files:
        src/usr.bin/seq: seq.1 seq.c

Log Message:
- Default terminator to \n
- Don't print a trailing separator
Behavior now matches GNU seq (from Aram at tech-userlevel)


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/usr.bin/seq/seq.1
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/seq/seq.c

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/seq/seq.1
diff -u src/usr.bin/seq/seq.1:1.9 src/usr.bin/seq/seq.1:1.10
--- src/usr.bin/seq/seq.1:1.9	Thu Aug 18 18:55:28 2016
+++ src/usr.bin/seq/seq.1	Mon Dec 17 15:10:51 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: seq.1,v 1.9 2016/08/18 22:55:28 sevan Exp $
+.\"	$NetBSD: seq.1,v 1.10 2018/12/17 20:10:51 christos Exp $
 .\"
 .\" Copyright (c) 2005 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -28,7 +28,7 @@
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
 .\"
-.Dd August 18, 2016
+.Dd December 17, 2018
 .Dt SEQ 1
 .Os
 .Sh NAME
@@ -117,8 +117,7 @@ The
 can contain character escape sequences in backslash notation as
 defined in
 .St -ansiC .
-This option is useful when the default separator
-does not contain a
+The default is
 .Cm \en .
 .It Fl w
 Equalize the widths of all numbers by padding with zeros as necessary.

Index: src/usr.bin/seq/seq.c
diff -u src/usr.bin/seq/seq.c:1.10 src/usr.bin/seq/seq.c:1.11
--- src/usr.bin/seq/seq.c:1.10	Sat Oct 28 21:28:46 2017
+++ src/usr.bin/seq/seq.c	Mon Dec 17 15:10:51 2018
@@ -31,7 +31,7 @@
 #ifndef lint
 __COPYRIGHT("@(#) Copyright (c) 2005\
  The NetBSD Foundation, Inc.  All rights reserved.");
-__RCSID("$NetBSD: seq.c,v 1.10 2017/10/29 01:28:46 ginsbach Exp $");
+__RCSID("$NetBSD: seq.c,v 1.11 2018/12/17 20:10:51 christos Exp $");
 #endif /* not lint */
 
 #include <ctype.h>
@@ -85,7 +85,7 @@ main(int argc, char *argv[])
 	struct lconv *locale;
 	char *fmt = NULL;
 	const char *sep = "\n";
-	const char *term = NULL;
+	const char *term = "\n";
 	char pad = ZERO;
 
 	/* Determine the locale's decimal point. */
@@ -171,14 +171,16 @@ main(int argc, char *argv[])
 		fmt = generate_format(first, incr, last, equalize, pad);
 
 	if (incr > 0) {
-		for (; first <= last; first += incr) {
-			printf(fmt, first);
+		printf(fmt, first);
+		for (first += incr; first <= last; first += incr) {
 			fputs(sep, stdout);
+			printf(fmt, first);
 		}
 	} else {
-		for (; first >= last; first += incr) {
-			printf(fmt, first);
+		printf(fmt, first);
+		for (first += incr; first >= last; first += incr) {
 			fputs(sep, stdout);
+			printf(fmt, first);
 		}
 	}
 	if (term != NULL)

Reply via email to