$FreeBSD: ports/sysutils/libretto-config/files/patch-ab,v 1.4 2004/08/22 21:33:09 krion Exp $ --- libapm.c.orig Fri Jun 19 02:28:23 1998 +++ libapm.c Sun Aug 22 23:31:55 2004 @@ -8,12 +8,19 @@ /* */ /***********************************************************/ +#undef HAVE_GETOPT_LONG +#ifdef __linux__ +#define HAVE_GETOPT_LONG 1 +#endif + #include #include #include #include #include +#ifdef HAVE_GETOPT_LONG #include +#endif #include #include #include @@ -63,6 +70,7 @@ int r; char c; +#ifdef HAVE_GETOPT_LONG struct option longopts[] = { { "Help", 0, 0, 'h' }, { "Version", 0, 0, 'v' }, @@ -78,6 +86,7 @@ #endif /* CMOS_ACCESS */ {0, 0, 0, 0} }; +#endif if( 0 != geteuid() ){ printf("%s: Only root can execute !!\n", argv[0]); @@ -98,8 +107,12 @@ get_status(); +#ifdef HAVE_GETOPT_LONG while ((c = getopt_long(argc,argv, "hvP:T:a:S:A:L:V:O:", longopts, NULL)) != -1) { +#else + while ((c = getopt(argc,argv, "hvP:T:a:S:A:L:V:O:")) != -1) { +#endif switch (c) { case 'h': usage(); @@ -189,7 +202,7 @@ case '?': usage(); break; - default: + default: break; } } #ifdef DEBUG @@ -215,29 +228,60 @@ 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,