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)
This commit is contained in:
Dag-Erling Smørgrav 2024-09-04 19:32:23 +02:00
parent 8d65747f7c
commit d2c02cfae5
2 changed files with 10 additions and 7 deletions

View file

@ -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

View file

@ -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).