diff --git a/bin/date/date.1 b/bin/date/date.1 index 29cde37ca90..62d28a7df0a 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 6b6e1f69cab..d32993dc1ed 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).