Subversion Repositories SvarDOS

Compare Revisions

Ignore whitespace Rev 989 → Rev 988

/svarcom/trunk/cmd/time.c
1,7 → 1,7
/* This file is part of the SvarCOM project and is published under the terms
* of the MIT license.
*
* Copyright (C) 2021-2022 Mateusz Viste
* Copyright (C) 2021 Mateusz Viste
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
141,11 → 141,12
signed char ho = -1, mi = -1, se = -1;
 
if (cmd_ishlp(p)) {
nls_outputnl(22,0); /* "Displays or sets the system time." */
outputnl("Displays or sets the system time.");
outputnl("");
nls_outputnl(22,1); /* "TIME [time]" */
outputnl("TIME [time]");
outputnl("");
nls_outputnl(22,2); /* "Type TIME with no parameters to display the current time and (...)" */
outputnl("Type TIME with no parameters to display the current time and a prompt for a");
outputnl("new one. Press ENTER to keep the same time.");
return(CMD_OK);
}
 
177,12 → 178,12
}
buff[0] = ' ';
nls_format_time(buff + 1, ho, mi, se, nls);
nls_output(22,3); /* "Current time is" */
output("Current time is");
outputnl(buff);
ho = -1;
} else { /* parse time if provided */
if (cmd_time_parse(p->argv[0], &ho, &mi, &se, nls) != 0) {
nls_outputnl(22,4); /* "Invalid time" */
outputnl("Invalid time");
ho = -1;
}
}
189,7 → 190,7
 
/* ask for time if not provided or if input was malformed */
while (ho < 0) {
nls_output(22,5); /* "Enter new time:" */
output("Enter new time:");
output(" ");
/* collect user input into buff */
_asm {
223,7 → 224,7
}
if (buff[1] == 0) break; /* empty string = do not change time */
if (cmd_time_parse(buff + 2, &ho, &mi, &se, nls) == 0) break;
nls_outputnl(22,4); /* "Invalid time" */
outputnl("Invalid time");
return(CMD_FAIL);
}