plan9port/src/cmd/date.c
Dan Cross fa325e9b42 Trivial changes: whitespace and modes.
Remote whitespace at the ends of lines.
Remove blank lines from the ends of files.
Change modes on source files so that they
are not executable.

Signed-off-by: Dan Cross <cross@gajendra.net>
2020-01-10 14:54:30 +00:00

30 lines
448 B
C

#include <u.h>
#include <libc.h>
int uflg, nflg;
void
main(int argc, char *argv[])
{
ulong now;
ARGBEGIN{
case 'n': nflg = 1; break;
case 'u': uflg = 1; break;
default: fprint(2, "usage: date [-un] [seconds]\n"); exits("usage");
}ARGEND
if(argc == 1)
now = strtoul(*argv, 0, 0);
else
now = time(0);
if(nflg)
print("%ld\n", now);
else if(uflg)
print("%s", asctime(gmtime(now)));
else
print("%s", ctime(now));
exits(0);
}