summaryrefslogtreecommitdiff
path: root/usr/src/lib/libcmd/common/date.c
diff options
context:
space:
mode:
authorApril Chin <April.Chin@Sun.COM>2008-12-27 14:59:38 -0800
committerApril Chin <April.Chin@Sun.COM>2008-12-27 14:59:38 -0800
commit7c2fbfb345896881c631598ee3852ce9ce33fb07 (patch)
tree4b173b5657508562dfc0aa05f7d056d1e9add505 /usr/src/lib/libcmd/common/date.c
parent6071ac1de68fed78e1e10052045bbb5f1732a263 (diff)
downloadillumos-joyent-7c2fbfb345896881c631598ee3852ce9ce33fb07.tar.gz
PSARC/2008/094 ksh93 Update 1
PSARC/2008/344 ksh93 Integration Update 1 Amendments 1 PSARC/2008/589 Remove /usr/bin/printf from PSARC case 2008 094 6619428 *ksh93* RFE: Update ksh93 in Solaris to ast-ksh.2008-11-04 6788659 RFE: Update libpp in Solaris to ast-open.2008-07-25 6561901 RFE: Add "shcomp" (shell script compiler) + kernel module to exec binary sh code 6599668 RFE: Move consumers of alias.sh over to ksh93 6595183 *ksh93* RFE: Update ksh93-integration demo code 6775901 *ksh93* no C message catalogs are generated for ksh93 6451262 *sleep* RFE: /usr/bin/sleep should support floating-point values 6687139 *ksh93* command substitution, exec, and stdout redirection cause allocation loop 6703761 *ksh93* crashes in script containing uncommon output redirections 6715496 *ksh93* SEGVs on array reinitialization 6713682 *ksh93* Creating a compound variable in a subshell "bleeds through" to the calling subshell 6672350 *ksh93* causes parent shell to die when child shell is suspended 6745015 *ksh93* VARIABLE=`command substitution` assignment is not reliable on OpenSolaris 6710205 *ksh93* problem with command substitution (within back quotes) containing \$' 6737600 *ksh93* exits debugger when user presses ctrl-c 6748645 *ksh93* fc -l -e - is mis-parsed, outputs wrong error message "-e - requires single argument" 6754020 *ksh93* does weird '[' expansion 6753538 *ksh93* umask modification leaks out of a ksh93 subshell 6766246 *ksh93* bug in pattern matching 6763594 *ksh93* executes command after "command" builtin twice on failure 6762665 *ksh93* Difficult-to-reproduce SIGSEGV in ksh93
Diffstat (limited to 'usr/src/lib/libcmd/common/date.c')
-rw-r--r--usr/src/lib/libcmd/common/date.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/usr/src/lib/libcmd/common/date.c b/usr/src/lib/libcmd/common/date.c
index b2ea46d146..1984570b2d 100644
--- a/usr/src/lib/libcmd/common/date.c
+++ b/usr/src/lib/libcmd/common/date.c
@@ -1,10 +1,10 @@
/***********************************************************************
* *
* This software is part of the ast package *
-* Copyright (c) 1992-2007 AT&T Knowledge Ventures *
+* Copyright (c) 1992-2008 AT&T Intellectual Property *
* and is licensed under the *
* Common Public License, Version 1.0 *
-* by AT&T Knowledge Ventures *
+* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* http://www.opensource.org/licenses/cpl1.0.txt *
@@ -27,7 +27,7 @@
*/
static const char usage[] =
-"[-?\n@(#)$Id: date (AT&T Research) 2007-03-28 $\n]"
+"[-?\n@(#)$Id: date (AT&T Research) 2007-05-21 $\n]"
USAGE_LICENSE
"[+NAME?date - set/list/convert dates]"
"[+DESCRIPTION?\bdate\b sets the current date and time (with appropriate"
@@ -96,7 +96,7 @@ USAGE_LICENSE
" [+e?blank padded day of month number]"
" [+E?unpadded day of month number]"
" [+f?locale default override date format]"
-" [+F?locale default date format]"
+" [+F?%ISO 8601:2000 standard date format; equivalent to Y-%m-%d]"
" [+g?\bls\b(1) \b-l\b recent date with \ahh:mm\a]"
" [+G?\bls\b(1) \b-l\b distant date with \ayyyy\a]"
" [+h?abbreviated month name]"
@@ -108,6 +108,7 @@ USAGE_LICENSE
" [+k?\bdate\b(1) style date]"
" [+K?all numeric date; equivalent to \b%Y-%m-%d+%H:%M:%S\b]"
" [+l?\bls\b(1) \b-l\b date; equivalent to \b%Q/%g/%G/\b]"
+" [+L?locale default date format]"
" [+m?month number]"
" [+M?minutes]"
" [+n?newline character]"
@@ -206,7 +207,7 @@ typedef struct Fmt
*/
static int
-settime(const char* cmd, Time_t now, int adjust, int network)
+settime(void* context, const char* cmd, Time_t now, int adjust, int network)
{
char* s;
char** argv;
@@ -222,13 +223,13 @@ settime(const char* cmd, Time_t now, int adjust, int network)
*argv++ = s;
if (streq(astconf("UNIVERSE", NiL, NiL), "att"))
{
- tmxfmt(buf, sizeof(buf), "%m%d%H" "%M" "%Y.%S", now);
+ tmxfmt(buf, sizeof(buf), "%m%d%H" "%M%Y.%S", now);
if (adjust)
*argv++ = "-a";
}
else
{
- tmxfmt(buf, sizeof(buf), "%Y" "%m%d%H" "%M.%S", now);
+ tmxfmt(buf, sizeof(buf), "%Y%m%d%H" "%M.%S", now);
if (network)
*argv++ = "-n";
if (tm_info.flags & TM_UTC)
@@ -236,7 +237,7 @@ settime(const char* cmd, Time_t now, int adjust, int network)
}
*argv++ = buf;
*argv = 0;
- if (!procrun(s, args))
+ if (!sh_run(context, argv - args, args))
return 0;
}
return -1;
@@ -473,7 +474,7 @@ b_date(int argc, register char** argv, void* context)
tmxfmt(buf, sizeof(buf), format, now);
sfprintf(sfstdout, "%s\n", buf);
}
- else if (settime(cmd, now, increment, network))
+ else if (settime(context, cmd, now, increment, network))
error(ERROR_SYSTEM|3, "cannot set system time");
}
while (fmts != &fmt)