SCP: Changed command processing variable insertion to format %DATE% as yyyy-mm-dd instead of yyyy/mm/dd and added %STIME% to produce hh_mm_ss.

This commit is contained in:
Mark Pizzolato 2014-01-08 12:47:33 -08:00
parent 5800e5b403
commit 2ea8a0a30f
2 changed files with 10 additions and 4 deletions

View file

@ -212,7 +212,7 @@ The "!" command (execute a command on the local OS), now returns the command's e
#### Command Processing Enhancements #### Command Processing Enhancements
##### Environment variable insertion ##### Environment variable insertion
Built In variables %DATE%, %TIME%, %CTIME%, %STATUS%, %TSTATUS%, %SIM_VERIFY%, %SIM_QUIET%, %SIM_MESSAGE% Built In variables %DATE%, %TIME%, %STIME%, %CTIME%, %STATUS%, %TSTATUS%, %SIM_VERIFY%, %SIM_QUIET%, %SIM_MESSAGE%
Command Aliases Command Aliases
Token "%0" expands to the command file name. Token "%0" expands to the command file name.
@ -228,8 +228,9 @@ Command Aliases
variables, and if one isn't found then can be one of several special variables, and if one isn't found then can be one of several special
variables: variables:
%DATE% yyyy/mm/dd %DATE% yyyy-mm-dd
%TIME% hh:mm:ss %TIME% hh:mm:ss
%STIME% hh_mm_ss
%CTIME% Www Mmm dd hh:mm:ss yyyy %CTIME% Www Mmm dd hh:mm:ss yyyy
%STATUS% Status value from the last command executed %STATUS% Status value from the last command executed
%TSTATUS% The text form of the last status value %TSTATUS% The text form of the last status value

9
scp.c
View file

@ -1758,8 +1758,9 @@ return stat | SCPE_NOMESSAGE; /* suppress message sinc
A Tokens preceeded and followed by % characters are expanded as environment A Tokens preceeded and followed by % characters are expanded as environment
variables, and if one isn't found then can be one of several special variables, and if one isn't found then can be one of several special
variables: variables:
%DATE% yyyy/mm/dd %DATE% yyyy-mm-dd
%TIME% hh:mm:ss %TIME% hh:mm:ss
%STIME% hh_mm_ss
%CTIME% Www Mmm dd hh:mm:ss yyyy %CTIME% Www Mmm dd hh:mm:ss yyyy
%STATUS% Status value from the last command executed %STATUS% Status value from the last command executed
%TSTATUS% The text form of the last status value %TSTATUS% The text form of the last status value
@ -1847,13 +1848,17 @@ for (; *ip && (op < oend); ) {
time(&now); time(&now);
tmnow = localtime(&now); tmnow = localtime(&now);
if (!strcmp ("DATE", gbuf)) { if (!strcmp ("DATE", gbuf)) {
sprintf (rbuf, "%4d/%02d/%02d", tmnow->tm_year+1900, tmnow->tm_mon+1, tmnow->tm_mday); sprintf (rbuf, "%4d-%02d-%02d", tmnow->tm_year+1900, tmnow->tm_mon+1, tmnow->tm_mday);
ap = rbuf; ap = rbuf;
} }
else if (!strcmp ("TIME", gbuf)) { else if (!strcmp ("TIME", gbuf)) {
sprintf (rbuf, "%02d:%02d:%02d", tmnow->tm_hour, tmnow->tm_min, tmnow->tm_sec); sprintf (rbuf, "%02d:%02d:%02d", tmnow->tm_hour, tmnow->tm_min, tmnow->tm_sec);
ap = rbuf; ap = rbuf;
} }
else if (!strcmp ("STIME", gbuf)) {
sprintf (rbuf, "%02d_%02d_%02d", tmnow->tm_hour, tmnow->tm_min, tmnow->tm_sec);
ap = rbuf;
}
else if (!strcmp ("CTIME", gbuf)) { else if (!strcmp ("CTIME", gbuf)) {
strcpy (rbuf, ctime(&now)); strcpy (rbuf, ctime(&now));
rbuf[strlen (rbuf)-1] = '\0'; /* remove trailing \n */ rbuf[strlen (rbuf)-1] = '\0'; /* remove trailing \n */