Added patch from William Shipley which allows shutdown time to be specified
in the format +hh:mm. This is in addition to the existing formats such as hh:mm, +m, and "now". Cleared up compiler warning in dowall which can happen if the output message is longer than the size limit on the snprintf() buffer. This is not a bug, a the trucation works, but using a larger buffer avoids the warning on systems with long user/host names.
This commit is contained in:
parent
d4cc79bcb9
commit
584df5efaf
@ -13,6 +13,10 @@ sysvinit (2.97) unreleased; urgency=low
|
|||||||
* Added patch from Didier Gaudin which allows init to load configuration
|
* Added patch from Didier Gaudin which allows init to load configuration
|
||||||
data from files stored in /etc/inittab.d/
|
data from files stored in /etc/inittab.d/
|
||||||
|
|
||||||
|
* Added patch from William Shipley which allows shutdown time to be specified
|
||||||
|
in the format +hh:mm. This is in addition to the existing formats such as
|
||||||
|
hh:mm, +m, and "now".
|
||||||
|
|
||||||
|
|
||||||
sysvinit (2.96) released; urgency=low
|
sysvinit (2.96) released; urgency=low
|
||||||
|
|
||||||
|
@ -142,7 +142,9 @@ The \fItime\fP argument can have different formats. First, it can be an
|
|||||||
absolute time in the format \fIhh:mm\fP, in which \fIhh\fP is the hour
|
absolute time in the format \fIhh:mm\fP, in which \fIhh\fP is the hour
|
||||||
(1 or 2 digits) and \fImm\fP is the minute of the hour (in two digits).
|
(1 or 2 digits) and \fImm\fP is the minute of the hour (in two digits).
|
||||||
Second, it can be in the format \fB+\fP\fIm\fP, in which \fIm\fP is the
|
Second, it can be in the format \fB+\fP\fIm\fP, in which \fIm\fP is the
|
||||||
number of minutes to wait. The word \fBnow\fP is an alias for \fB+0\fP.
|
number of minutes to wait. Third, it can be in the format \fB+\fP\fIhh:mm\fP,
|
||||||
|
in which \fIhh:mm\fP is the number of hours and minutes to wait.
|
||||||
|
The word \fBnow\fP is an alias for \fB+0\fP.
|
||||||
.PP
|
.PP
|
||||||
If shutdown is called with a delay, it will create the advisory file
|
If shutdown is called with a delay, it will create the advisory file
|
||||||
.I /etc/nologin
|
.I /etc/nologin
|
||||||
|
@ -163,7 +163,7 @@ void wall(const char *text, int remote)
|
|||||||
struct utmp *utmp;
|
struct utmp *utmp;
|
||||||
time_t t;
|
time_t t;
|
||||||
char term[UT_LINESIZE+ strlen(_PATH_DEV) + 1];
|
char term[UT_LINESIZE+ strlen(_PATH_DEV) + 1];
|
||||||
char line[81];
|
char line[256];
|
||||||
char hostname[HOST_NAME_MAX+1];
|
char hostname[HOST_NAME_MAX+1];
|
||||||
char *date, *p;
|
char *date, *p;
|
||||||
char *user, *tty;
|
char *user, *tty;
|
||||||
|
@ -788,13 +788,21 @@ int main(int argc, char **argv)
|
|||||||
wt = atoi(when);
|
wt = atoi(when);
|
||||||
if (wt == 0 && when[0] != '0') usage();
|
if (wt == 0 && when[0] != '0') usage();
|
||||||
} else {
|
} else {
|
||||||
/* Time in hh:mm format. */
|
|
||||||
if (sscanf(when, "%d:%2d", &hours, &mins) != 2) usage();
|
if (sscanf(when, "%d:%2d", &hours, &mins) != 2) usage();
|
||||||
if (hours > 23 || mins > 59) usage();
|
/* Time in hh:mm format. */
|
||||||
time(&t);
|
if (when[0] == '+') {
|
||||||
lt = localtime(&t);
|
/* Hours and minutes from now */
|
||||||
wt = (60*hours + mins) - (60*lt->tm_hour + lt->tm_min);
|
if (hours > 99999 || mins > 59) usage();
|
||||||
if (wt < 0) wt += 1440;
|
wt = (60*hours + mins);
|
||||||
|
if (wt < 0) usage();
|
||||||
|
} else {
|
||||||
|
/* Time of day */
|
||||||
|
if (hours > 23 || mins > 59) usage();
|
||||||
|
time(&t);
|
||||||
|
lt = localtime(&t);
|
||||||
|
wt = (60*hours + mins) - (60*lt->tm_hour + lt->tm_min);
|
||||||
|
if (wt < 0) wt += 1440;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/* Shutdown NOW if time == 0 */
|
/* Shutdown NOW if time == 0 */
|
||||||
if (wt == 0) issue_shutdown(halttype);
|
if (wt == 0) issue_shutdown(halttype);
|
||||||
|
Loading…
Reference in New Issue
Block a user