Module Name: src
Committed By: riz
Date: Sun Jun 13 18:14:53 UTC 2010
Modified Files:
src/bin/date [netbsd-4]: date.c
Log Message:
Pull up following revision(s) (requested by dholland in ticket #1396):
bin/date/date.c: revision 1.53
Don't blow up on date +''. Patch from Robert Elz in followup to PR 39392.
To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.49.2.1 src/bin/date/date.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/bin/date/date.c
diff -u src/bin/date/date.c:1.49 src/bin/date/date.c:1.49.2.1
--- src/bin/date/date.c:1.49 Mon Nov 20 20:35:14 2006
+++ src/bin/date/date.c Sun Jun 13 18:14:53 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: date.c,v 1.49 2006/11/20 20:35:14 christos Exp $ */
+/* $NetBSD: date.c,v 1.49.2.1 2010/06/13 18:14:53 riz Exp $ */
/*
* Copyright (c) 1985, 1987, 1988, 1993
@@ -40,7 +40,7 @@
#if 0
static char sccsid[] = "@(#)date.c 8.2 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: date.c,v 1.49 2006/11/20 20:35:14 christos Exp $");
+__RCSID("$NetBSD: date.c,v 1.49.2.1 2010/06/13 18:14:53 riz Exp $");
#endif
#endif /* not lint */
@@ -118,11 +118,11 @@
if (!rflag && time(&tval) == -1)
err(EXIT_FAILURE, "time");
- format = "%a %b %e %H:%M:%S %Z %Y";
+ format = "+%a %b %e %H:%M:%S %Z %Y";
/* allow the operands in any order */
if (*argv && **argv == '+') {
- format = *argv + 1;
+ format = *argv;
++argv;
}
@@ -132,14 +132,14 @@
}
if (*argv && **argv == '+')
- format = *argv + 1;
+ format = *argv;
if ((buf = malloc(bufsiz = 1024)) == NULL)
goto bad;
while (strftime(buf, bufsiz, format, localtime(&tval)) == 0)
if ((buf = realloc(buf, bufsiz <<= 1)) == NULL)
goto bad;
- (void)printf("%s\n", buf);
+ (void)printf("%s\n", buf+1);
free(buf);
return 0;
bad: