From nobody Fri Dec 22 05:55:50 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4SxGkH0z4Nz54nm3; Fri, 22 Dec 2023 05:55:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4SxGkH0Ld5z3bLl; Fri, 22 Dec 2023 05:55:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703224551; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=pqCAQsuMfJOijBH/RZQFaSjPIYGltQ4f/DiZqQXuzv0=; b=CSn+iM4qQks239sgT6T7c0zmGZ9xfndoQLIU/VvYfXOlxTNHo6m/8l+zVEZFX4yJrK/pgi /qYfpVsLbjJwFSsEWh2zik/8mno5ugv0NjlPMHUuj1wsSAvoEkkBEBs4SchS9YTll3kshj 5jxEuzjsHkmre75BGQBZYlx7xTeC0J3oiD4MFWc9YgUVz+u9s5tABRFYtQOheG0naWCERX I2NFOnJ5h4e/ZWMn1XzoX2zf/GJulIEipKOvRyRRZDA5MI/DdeOQcj/omcSj6a3GHB8JGs +9dmL3SeH6MDiYvsBd79JgSwx99w/9eMbHM6Ag+C+GovvIGtDpAjymVSl7MfkA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703224551; a=rsa-sha256; cv=none; b=r7R0DgGgEEIf6iF0qmAIUxgqRfA8F1Yl6pq02R0GkcKVVTavlVcijn59mjJ1A2KClTYOQp kUzh+YtmQyd5UgUY6SVJFGRiEFYMWT64AYZYoAHQORv5sptibSoCJA9tM8hyUruVH1HidF MnET3G3R0aL2UNKsOIvl/NteLYHgwmi7XV0NXbtQZimWGsBj6n4o0rAkRJkXrRTTky603/ piL/qP9wS168VxMzHDhqL0P0xGlQhTH6KLO8JcjgwgSCSr0UMzH4fStaolPfxo0DuFm6t6 EVDcAA5HTTFn+R+/CaqUwIdmpk86BtyWcH6nqWmz81+heXmkxsOe4qz5xaUS2g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703224551; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=pqCAQsuMfJOijBH/RZQFaSjPIYGltQ4f/DiZqQXuzv0=; b=KzKjgqK45nj9PSqkQkVf2l/vq2iKsTJbvkmJoY0LE0fy1RvsM0IH09QRZippsMFh1YtHyy vfwUG44rSfuKEUA2omZ17VHteRLgbw6n8fNcHk4zjEr5QVERL0QaFmaCLcBTY5yrTqjme6 fdqpo0fGGHR+ER1X/Ia1+IcqyjXLGKVezHDAo94hNsdJJBlzBLQ09df0hruadjlBkxKQmp vX+NsbPqwEwdfsZtxHoqCITARsOXuwQHXNxUD1WA6iisuFhiS6W+DJW7KOInc74lIqyF/S CrVfGd8EuBfDJfbe/RRA7bQhHq/NDT9d8/AwT35zjvhx7aPOy1oZ5V5Jxgf01A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4SxGkG6Wr9z13Vp; Fri, 22 Dec 2023 05:55:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BM5toaX007017; Fri, 22 Dec 2023 05:55:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BM5to39007014; Fri, 22 Dec 2023 05:55:50 GMT (envelope-from git) Date: Fri, 22 Dec 2023 05:55:50 GMT Message-Id: <202312220555.3BM5to39007014@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Pawel Jakub Dawidek Subject: git: eb4d13126d85 - main - seq(1): Put separator only between the elements. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pjd X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: eb4d13126d85665197ed7efc17c1ab442daa70ea Auto-Submitted: auto-generated The branch main has been updated by pjd: URL: https://cgit.FreeBSD.org/src/commit/?id=eb4d13126d85665197ed7efc17c1ab442daa70ea commit eb4d13126d85665197ed7efc17c1ab442daa70ea Author: Pawel Jakub Dawidek AuthorDate: 2023-12-19 02:39:57 +0000 Commit: Pawel Jakub Dawidek CommitDate: 2023-12-22 05:54:05 +0000 seq(1): Put separator only between the elements. - Using non-default ('\n') separator will produce an output with the separator at the end of the output, eg. % echo "[$(seq -s ' ' 0 2)]" [0 1 2 ] - The output should always be followed by a new line character. Currently: % seq -s ' ' 0 2 0 1 2 % This change makes seq(1) to behave the same way Linux seq(1): % echo "[$(seq -s ' ' 0 2)]" [0 1 2] % seq -s ' ' 0 2 0 1 2 % Approved by: oshogbo Differential Revision: https://reviews.freebsd.org/D43094 --- usr.bin/seq/seq.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/usr.bin/seq/seq.c b/usr.bin/seq/seq.c index 2a35ef51690f..771346df1176 100644 --- a/usr.bin/seq/seq.c +++ b/usr.bin/seq/seq.c @@ -181,8 +181,9 @@ main(int argc, char *argv[]) for (step = 1, cur = first; incr > 0 ? cur <= last : cur >= last; cur = first + incr * step++) { + if (step > 1) + fputs(sep, stdout); printf(fmt, cur); - fputs(sep, stdout); prev = cur; } @@ -202,15 +203,19 @@ main(int argc, char *argv[]) } if (strcmp(cur_print, last_print) == 0 && strcmp(cur_print, prev_print) != 0) { - fputs(last_print, stdout); fputs(sep, stdout); + fputs(last_print, stdout); } free(cur_print); free(last_print); free(prev_print); - if (term != NULL) + if (term != NULL) { + fputs(sep, stdout); fputs(term, stdout); + } + + fputs("\n", stdout); return (0); }