diff options
author | mi <mi@FreeBSD.org> | 2008-01-07 01:31:52 +0800 |
---|---|---|
committer | mi <mi@FreeBSD.org> | 2008-01-07 01:31:52 +0800 |
commit | 5122b9f5afce199882950eb4220bb4365e07bc74 (patch) | |
tree | 779065f929fe3828d25f63779bab7278eb2fe1f1 /sysutils/wmhm | |
parent | df109ad1970aa933661f0ea33a1f4bc598765b34 (diff) | |
download | freebsd-ports-gnome-5122b9f5afce199882950eb4220bb4365e07bc74.tar.gz freebsd-ports-gnome-5122b9f5afce199882950eb4220bb4365e07bc74.tar.zst freebsd-ports-gnome-5122b9f5afce199882950eb4220bb4365e07bc74.zip |
Slightly improve error-handling/reporting. Don't choke on
absense of /dev/speaker at runtime.
Diffstat (limited to 'sysutils/wmhm')
-rw-r--r-- | sysutils/wmhm/Makefile | 3 | ||||
-rw-r--r-- | sysutils/wmhm/files/patch-warned | 126 |
2 files changed, 128 insertions, 1 deletions
diff --git a/sysutils/wmhm/Makefile b/sysutils/wmhm/Makefile index f181a9de9b8e..a361f7c4c087 100644 --- a/sysutils/wmhm/Makefile +++ b/sysutils/wmhm/Makefile @@ -7,7 +7,7 @@ PORTNAME= wmhm PORTVERSION= 1.46 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= sysutils windowmaker MASTER_SITES= ${MASTER_SITE_LOCAL} MASTER_SITE_SUBDIR= fenner @@ -25,6 +25,7 @@ USE_X_PREFIX= yes USE_XPM= yes ONLY_FOR_ARCHS= i386 amd64 ONLY_FOR_ARCHS_REASON= "requires speaker(4)" +ALL_TARGET= -j`${SYSCTL} -n hw.ncpu` CONFIGURE_ARGS+=--with-xpm-includes=${X11BASE}/include \ --with-xpm-library=${X11BASE}/lib diff --git a/sysutils/wmhm/files/patch-warned b/sysutils/wmhm/files/patch-warned new file mode 100644 index 000000000000..0f6d89f562ec --- /dev/null +++ b/sysutils/wmhm/files/patch-warned @@ -0,0 +1,126 @@ +--- operations.h 2001-07-22 01:01:02.000000000 -0400 ++++ operations.h 2008-01-06 12:08:15.000000000 -0500 +@@ -7,3 +7,3 @@ + int ReadByte(u_char *return_value, int addr); + int WriteByte(int addr, int value); +-int PlaySpeaker(char *tune_array); ++int PlaySpeaker(const char *tune_array); +--- operations.c 2001-07-22 01:00:55.000000000 -0400 ++++ operations.c 2008-01-06 12:07:11.000000000 -0500 +@@ -35,6 +35,8 @@ + #include "config.h" + ++#include <errno.h> + #include <fcntl.h> + #include <stdio.h> ++#include <sysexits.h> + #include <unistd.h> + #include <math.h> +@@ -60,12 +62,14 @@ + + int +-PlaySpeaker(char *tune_array) ++PlaySpeaker(const char *tune_array) + { + int i; + int open_spkr; ++ static int warned; + if ((open_spkr=open("/dev/speaker", O_WRONLY)) < 0) { +- fprintf(stderr, "Failed to open /dev/speaker for writing.\n" +- "No Permission?\n" +- ); ++ if (errno != warned) { ++ warn("Failed to open /dev/speaker for writing"); ++ warned = errno; ++ } + return(1); + } +@@ -83,6 +87,10 @@ + + if (ioctl(open_spkr, SPKRTUNE, tone_array) == -1) { +- perror("ioctl"); +- exit(-1); ++ if (errno != warned) { ++ warn("Could not play a tune on spkr"); ++ warned = errno; ++ } ++ close(open_spkr); ++ return(2); + } + +@@ -102,10 +110,6 @@ + cmd.data.byte_ptr=&smb_return; + if ((open_smb=open("/dev/smb0", 000)) < 0) { +- fprintf(stderr, "Failed to open /dev/smb0.\nPossible reasons:\n" +- "- Your kernel does not support SMBUS.\n" +- "- You are not running wmhm suid root.\n" +- "- WMHM is already running.\n" +- ); +- exit(1); ++ err(errno == EACCES ? EX_NOPERM : EX_UNAVAILABLE, ++ "Failed to open /dev/smb0."); + } + cmd.cmd=0x47; +@@ -116,21 +120,13 @@ + return(0); + } +- else { ++ else ++#endif ++ { + if ((io_file=open("/dev/io", 000)) < 0) { +- fprintf(stderr, "Failed to open /dev/io.\n" +- "Possible reasons:\n" +- "- You are not running wmhm suid root.\n" +- "- WMHM is already running\n"); +- exit (-1); +- } ++ err(errno == EACCES ? EX_NOPERM : EX_UNAVAILABLE, ++ "Failed to open /dev/io."); ++ } + return(0); + } +-#else +- if((io_file=open("/dev/io",000))<0) { +- fprintf(stderr, "Failed to open /dev/io.\n"); +- exit (1); +- } +- return(0); +-#endif + } + +@@ -151,14 +147,11 @@ + return(0); + } +- else { ++ else ++#endif ++ { + outb(WBIO1,addr); + *return_value = inb(WBIO2); + return(0); + } +-#else +- outb(WBIO1,addr); +- *return_value = inb(WBIO2); +- return(0); +-#endif + } + +@@ -178,13 +171,10 @@ + } + } +- else { ++ else ++#endif ++ { + outb(WBIO1,addr); + outb(WBIO2,value); + } +-#else +- outb(WBIO1,addr); +- outb(WBIO2,value); +-#endif + return(0); + } +- |