Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/seq - Default terminator to \n
details: https://anonhg.NetBSD.org/src/rev/6a6f9ca34a86
branches: trunk
changeset: 837742:6a6f9ca34a86
user: christos <christos%NetBSD.org@localhost>
date: Mon Dec 17 20:10:51 2018 +0000
description:
- Default terminator to \n
- Don't print a trailing separator
Behavior now matches GNU seq (from Aram at tech-userlevel)
diffstat:
usr.bin/seq/seq.1 | 7 +++----
usr.bin/seq/seq.c | 14 ++++++++------
2 files changed, 11 insertions(+), 10 deletions(-)
diffs (70 lines):
diff -r d9f697e4b716 -r 6a6f9ca34a86 usr.bin/seq/seq.1
--- a/usr.bin/seq/seq.1 Mon Dec 17 16:26:03 2018 +0000
+++ b/usr.bin/seq/seq.1 Mon Dec 17 20:10:51 2018 +0000
@@ -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 @@
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.
diff -r d9f697e4b716 -r 6a6f9ca34a86 usr.bin/seq/seq.c
--- a/usr.bin/seq/seq.c Mon Dec 17 16:26:03 2018 +0000
+++ b/usr.bin/seq/seq.c Mon Dec 17 20:10:51 2018 +0000
@@ -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 @@
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 @@
fmt = generate_format(first, incr, last, equalize, pad);
if (incr > 0) {
- for (; first <= last; first += incr) {
+ printf(fmt, first);
+ for (first += incr; first <= last; first += incr) {
+ fputs(sep, stdout);
printf(fmt, first);
- fputs(sep, stdout);
}
} else {
- for (; first >= last; first += incr) {
+ printf(fmt, first);
+ for (first += incr; first >= last; first += incr) {
+ fputs(sep, stdout);
printf(fmt, first);
- fputs(sep, stdout);
}
}
if (term != NULL)
Home |
Main Index |
Thread Index |
Old Index