[hackers] [sbase] Add mandoc-manpage for date(1) and clean up code || FRIGN
commit c208c6328a6e45bc793f3491128da7201f833f13
Author: FRIGN <dev_AT_frign.de>
Date: Fri Jan 23 22:54:25 2015 +0100
Add mandoc-manpage for date(1) and clean up code
and mark it as finished in README.
diff --git a/README b/README
index f40ce20..09da2e1 100644
--- a/README
+++ b/README
_AT_@ -23,7 +23,7 @@ The following tools are implemented ('*' == finished, '#' == UTF-8 support,
= cp no -H, -i, -L
=* cron non-posix none
#* cut yes none
-= date yes none
+=* date yes none
= dirname yes none
= du no -H, -L, -x
= echo yes none
diff --git a/date.1 b/date.1
index 176509f..2d3bb89 100644
--- a/date.1
+++ b/date.1
_AT_@ -1,26 +1,38 @@
-.TH DATE 1 sbase\-VERSION
-.SH NAME
-date \- print date and time
-.SH SYNOPSIS
-.B date
-.RB [ \-d
-.IR time ]
-.RB [ \-u ]
-.RI [+ format ]
-.SH DESCRIPTION
-.B date
-prints the date and time. If a
-.I format
-is given it is used to format the date as per
-.IR strftime (3).
-.SH OPTIONS
-.TP
-.BI \-d " time"
-prints
-.I time
-instead of the system time, given as the number of seconds since the Unix epoch.
-.TP
-.B \-u
-prints UTC time instead of local time.
-.SH SEE ALSO
-.IR strftime (3)
+.Dd January 23, 2015
+.Dt DATE 1 sbase\-VERSION
+.Sh NAME
+.Nm date
+.Nd print date and time
+.Sh SYNOPSIS
+.Nm date
+.Op Fl d Ar time
+.Op Fl u
+.Op Cm + Ns Ar format
+.Sh DESCRIPTION
+.Nm
+prints the date and time according to
+.Xr locale 7
+or
+.Ar format
+using
+.Xr strftime 3 .
+.Sh OPTIONS
+.Bl -tag -width Ds
+.It Fl d Ar time
+Print
+.Ar time
+given as the number of seconds since the
+Unix epoch 1970-01-01T00:00:00Z.
+.It Fl u
+Print UTC time instead of local time.
+.El
+.Sh STANDARDS
+The
+.Nm
+utility is compliant with the
+.St -p1003.1-2008
+specification.
+.Pp
+The
+.Op Fl d
+flag is an extension to that specification.
diff --git a/date.c b/date.c
index 3ca11c9..95fa62f 100644
--- a/date.c
+++ b/date.c
_AT_@ -34,12 +34,13 @@ main(int argc, char *argv[])
default:
usage();
} ARGEND;
+
if (argc > 0 && argv[0][0] == '+')
fmt = &argv[0][1];
if (!(now = tztime(&t)))
eprintf("%stime failed\n", tz);
- strftime(buf, sizeof buf, fmt, now);
+ strftime(buf, sizeof(buf), fmt, now);
puts(buf);
return 0;
Received on Tue Mar 24 2015 - 23:53:14 CET
This archive was generated by hypermail 2.3.0
: Wed Mar 25 2015 - 00:02:16 CET