Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 6 Oct 2024 11:07:23 GMT
From:      Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?= <des@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: d2c02cfae55a - stable/14 - date: Fix a few nits.
Message-ID:  <202410061107.496B7NGX039107@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by des:

URL: https://cgit.FreeBSD.org/src/commit/?id=d2c02cfae55a1ffb179b55f45a89606845e1acfb

commit d2c02cfae55a1ffb179b55f45a89606845e1acfb
Author:     Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2024-09-04 17:32:23 +0000
Commit:     Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2024-10-06 09:12:24 +0000

    date: Fix a few nits.
    
    * Don't use `asprintf()` when `strdup()` can do the job just as well.
    * Fix a couple of typos in a comment.
    
    Fixes:          eeb04a736cb9
    MFC after:      3 days
    Sponsored by:   Klara, Inc.
    Reviewed by:    markj
    Differential Revision:  https://reviews.freebsd.org/D46533
    
    (cherry picked from commit a8ddd1926a34fc20970d9ceaad71b31fc414b1c5)
    
    date: Documentation nits.
    
    * Fix spurious capitalization.
    * Fix inconsistent quoting.
    * Use `Dq` rather than ASCII double quotes.
    
    MFC after:      3 days
    Sponsored by:   Klara, Inc.
    Reviewed by:    0mp
    Differential Revision:  https://reviews.freebsd.org/D46622
    
    (cherry picked from commit 355ebf80b1ed98cf7ca9c51ce7e3e6dcb376853d)
---
 bin/date/date.1 | 9 ++++++---
 bin/date/date.c | 8 ++++----
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/bin/date/date.1 b/bin/date/date.1
index 29cde37ca904..62d28a7df0a0 100644
--- a/bin/date/date.1
+++ b/bin/date/date.1
@@ -29,7 +29,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd May 2, 2024
+.Dd September 10, 2024
 .Dt DATE 1
 .Os
 .Sh NAME
@@ -538,8 +538,11 @@ Finally the command
 .Pp
 .Dl "TZ=America/Los_Angeles date -z Europe/Paris -j 0900"
 .Pp
-will print the time in the "Europe/Paris" timezone when it is 9:00 in The
-America/Los_Angeles timezone.
+will print the time in the
+.Dq Europe/Paris
+timezone when it is 9:00 in the
+.Dq America/Los_Angeles
+timezone.
 .Sh DIAGNOSTICS
 It is invalid to combine the
 .Fl I
diff --git a/bin/date/date.c b/bin/date/date.c
index 6b6e1f69cabc..d32993dc1eda 100644
--- a/bin/date/date.c
+++ b/bin/date/date.c
@@ -395,8 +395,8 @@ strftime_ns(char * __restrict s, size_t maxsize, const char * __restrict format,
 	bool seen_percent;
 
 	seen_percent = false;
-	if (asprintf(&newformat, "%s", format) < 0)
-		err(1, "asprintf");
+	if ((newformat = strdup(format)) == NULL)
+		err(1, "strdup");
 	tok = newformat;
 	for (tok = newformat; *tok != '\0'; tok++) {
 		switch (*tok) {
@@ -418,9 +418,9 @@ strftime_ns(char * __restrict s, size_t maxsize, const char * __restrict format,
 				suffix = tok + 1;
 				/*
 				 * Construct a new format string from the
-				 * prefix (i.e., the part of the old fromat
+				 * prefix (i.e., the part of the old format
 				 * from its beginning to the currently handled
-				 * "%N" conversion specification, the
+				 * "%N" conversion specification), the
 				 * nanoseconds, and the suffix (i.e., the part
 				 * of the old format from the next token to the
 				 * end).



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202410061107.496B7NGX039107>