4 Copyright (C) 2006-2009 Jonathan Zarate
10 __attribute__ ((noreturn
))
11 static void help(void)
17 for (i
= 0; i
< LED_COUNT
; ++i
) {
18 if (led(i
, LED_PROBE
)) {
19 if (s
[0]) strcat(s
, "/");
20 strcat(s
, led_names
[i
]);
24 fprintf(stderr
, "Not supported.\n");
27 fprintf(stderr
, "led <%s> <on/off> [...]\n", s
);
32 int led_main(int argc
, char *argv
[])
39 if ((argc
< 3) || ((argc
% 2) != 1)) help();
41 for (j
= 1; j
< argc
; j
+= 2) {
43 for (i
= 0; i
< LED_COUNT
; ++i
) {
44 if (strncmp(led_names
[i
], a
, 2) == 0) break;
47 if ((i
>= LED_COUNT
) || ((strcmp(a
, "on") != 0) && (strcmp(a
, "off") != 0))) help();
48 if (!led(i
, (a
[1] == 'n'))) help();