$OpenBSD: patch-libapm_c,v 1.2 2004/02/18 17:10:12 espie Exp $ --- libapm.c.orig 1998-06-19 02:28:23.000000000 +0200 +++ libapm.c 2004-02-18 18:03:01.000000000 +0100 @@ -17,6 +17,9 @@ #include #include #include +#if defined(__OpenBSD__) || defined(__NetBSD__) +#include +#endif #include "libapm.h" #ifndef CMOS_ACCESS @@ -63,20 +66,20 @@ int main(int argc, char *argv[]) int r; char c; - struct option longopts[] = { - { "Help", 0, 0, 'h' }, - { "Version", 0, 0, 'v' }, - { "PowerUp", 1, 0, 'P' }, - { "StandbyTime", 1, 0, 'T' }, - { "AutoOff", 1, 0, 'a' }, - { "PanelSwitch", 1, 0, 'S' }, - { "AlarmOn", 1, 0, 'A' }, - { "LcdPower", 1, 0, 'L' }, + static struct option longopts[] = { + { "Help", no_argument, NULL, 'h' }, + { "Version", no_argument, NULL, 'v' }, + { "PowerUp", required_argument, NULL, 'P' }, + { "StandbyTime", required_argument, NULL, 'T' }, + { "AutoOff", required_argument, NULL, 'a' }, + { "PanelSwitch", required_argument, NULL, 'S' }, + { "AlarmOn", required_argument, NULL, 'A' }, + { "LcdPower", required_argument, NULL, 'L' }, #ifndef CMOS_ACCESS - { "Volume", 1, 0, 'V' }, - { "Off", 1, 0, 'O' }, + { "Volume", required_argument, NULL, 'V' }, + { "Off", required_argument, NULL, 'O' }, #endif /* CMOS_ACCESS */ - {0, 0, 0, 0} + {NULL, 0, NULL, 0} }; if( 0 != geteuid() ){ @@ -101,9 +104,6 @@ int main(int argc, char *argv[]) while ((c = getopt_long(argc,argv, "hvP:T:a:S:A:L:V:O:", longopts, NULL)) != -1) { switch (c) { - case 'h': - usage(); - break; case 'v': printf("version : %s\n", version); exit(0); @@ -186,10 +186,9 @@ int main(int argc, char *argv[]) else usage(); break; #endif /* CMOS_ACCESS */ - case '?': + default: usage(); break; - default: } } #ifdef DEBUG @@ -215,29 +214,27 @@ int main(int argc, char *argv[]) void usage(void) { #ifdef CMOS_ACCESS - printf(" -usage: libapm [-v --Version] - [-h --Help] - [-P --PowerUp {boot,hibernation}] - [-T --StandbyTime {0,5,10,15,30,45,60,unlimit}] - [-a --AutoOff {disable,10,20,30,40,50,60}] - [-S --PanelSwitch {disable,enable}] - [-A --AlarmOn {disable,