3 * (c) François Revol, revol@free.fr
8 #include <Application.h>
9 #include <Accelerant.h>
14 printf("%s on|standby|suspend|off|caps|state\n", prog
);
15 printf("on|standby|suspend|off\tsets corresponding state\n");
16 printf("caps\tprints capabilities\n");
17 printf("state\tprints the current state\n");
21 int main(int argc
, char **argv
)
23 BApplication
app("application/x-vnd.Haiku.dpms");
26 return usage(argv
[0]);
27 if (!strcmp(argv
[1], "on"))
28 bs
.SetDPMS(B_DPMS_ON
);
29 else if (!strcmp(argv
[1], "standby"))
30 bs
.SetDPMS(B_DPMS_STAND_BY
);
31 else if (!strcmp(argv
[1], "suspend"))
32 bs
.SetDPMS(B_DPMS_SUSPEND
);
33 else if (!strcmp(argv
[1], "off"))
34 bs
.SetDPMS(B_DPMS_OFF
);
35 else if (!strcmp(argv
[1], "caps")) {
36 uint32 caps
= bs
.DPMSCapabilites(); // nice typo...
37 printf("dpms capabilities: %s%s%s%s\n", (caps
& B_DPMS_ON
)?("on"):(""),
38 (caps
& B_DPMS_STAND_BY
)?(", standby"):(""),
39 (caps
& B_DPMS_SUSPEND
)?(", suspend"):(""),
40 (caps
& B_DPMS_OFF
)?(", off"):(""));
41 } else if (!strcmp(argv
[1], "state")) {
42 uint32 st
= bs
.DPMSState();
43 printf("%s\n", (st
& B_DPMS_ON
)?("on"):
44 ((st
& B_DPMS_STAND_BY
)?("standby"):
45 ((st
& B_DPMS_SUSPEND
)?("suspend"):
46 ((st
& B_DPMS_OFF
)?("off"):("?")))));
48 return usage(argv
[0]);