.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
.\" 02110-1301, USA.
.\"
-.TH RTCWAKE 8 "July 2014" "util-linux" "System Administration"
+.TH RTCWAKE 8 "June 2015" "util-linux" "System Administration"
.SH NAME
rtcwake \- enter a system sleep state until specified wakeup time
.SH SYNOPSIS
Assume that the hardware clock is set to local time, regardless of the
contents of the \fIadjtime\fP file.
.TP
+.B \-\-list\-modes
+List available \-\-mode option arguments.
+.TP
.BR \-m , " \-\-mode " \fImode
Go into the given standby state. Valid values for \fImode\fP are:
.RS
fputs(_(" -d, --device <device> select rtc device (rtc0|rtc1|...)\n"), out);
fputs(_(" -n, --dry-run does everything, but suspend\n"), out);
fputs(_(" -l, --local RTC uses local timezone\n"), out);
+ fputs(_(" --list-modes list available modes\n"), out);
fputs(_(" -m, --mode <mode> standby|mem|... sleep mode\n"), out);
fputs(_(" -s, --seconds <seconds> seconds to sleep\n"), out);
fputs(_(" -t, --time <time_t> time to wake\n"), out);
return fd;
}
+static void list_modes(void)
+{
+ int i = ARRAY_SIZE(mode_str);
+
+ while (i--)
+ printf("%s%s", mode_str[i], i == 0 ? "" : " ");
+ putchar('\n');
+}
+
int main(int argc, char **argv)
{
struct rtcwake_control ctl = {
time_t alarm = 0;
enum {
- OPT_DATE = CHAR_MAX + 1
+ OPT_DATE = CHAR_MAX + 1,
+ OPT_LIST
};
static const struct option long_options[] = {
{"seconds", required_argument, 0, 's'},
{"time", required_argument, 0, 't'},
{"date", required_argument, 0, OPT_DATE},
+ {"list-modes", no_argument, 0, OPT_LIST},
{0, 0, 0, 0 }
};
ctl.clock_mode = CM_LOCAL;
break;
+ case OPT_LIST:
+ list_modes();
+ return EXIT_SUCCESS;
+
case 'm':
if ((suspend = get_mode(optarg)) < 0)
errx(EXIT_FAILURE, _("unrecognized suspend state '%s'"), optarg);