Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
server:mail
coolmail
coolmail-1.3.dif
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File coolmail-1.3.dif of Package coolmail
--- Makefile +++ Makefile 2011-06-22 00:00:00.000000000 +0000 @@ -24,7 +24,7 @@ # files for coolmail when you type `make install'. CFLAGS = LINK = $(CC) -INCLUDES = -I/usr/X11R5/include +INCLUDES = -I/usr/X11R6/include LIB_DIRS = -L/usr/X11R6/lib BINDIR = /usr/local/bin MANDIR = /usr/local/man/man1 @@ -34,10 +34,17 @@ MANDIR = /usr/local/man/man1 AUDIO = -DAUDIO AUDIO_MODULE = audio.o +# Comment these out if you don't want Maildir support +MAILDIR = -DSUPPORT_MAILDIR +# for debugging: +#MAILDIR = $(MAILDIR) -DSUPPORT_MAILDIR_DEBUG +# normally ignores non-regular files in the Maildir; uncomment to change +#MAILDIR = $(MAILDIR) -DSUPPORT_MAILDIR_STRICTER + #### You really don't need to read past this point. #### LIBS = $(LIB_DIRS) -lXt -lX11 -lm -lXext -COPTS = $(CFLAGS) $(AUDIO) +COPTS = $(CFLAGS) $(AUDIO) $(MAILDIR) all: coolmail # Done. --- audio.c +++ audio.c 2011-06-22 13:13:21.399926836 +0000 @@ -37,14 +37,19 @@ #include <sys/signal.h> /* for signal() */ #include <stdio.h> /* for printing error messages */ #include <pwd.h> /* for getting username */ +#include <stdio.h> /* for getenv() */ #include <stdlib.h> /* for getenv() */ #include <string.h> #include <sys/file.h> #include <sys/fcntl.h> #include <sys/ioctl.h> +#include <sys/socket.h> +#include <unistd.h> #include <errno.h> +#include <arpa/inet.h> + extern int cool_vol; extern char *sndfile; @@ -63,8 +68,13 @@ typedef struct { u_32 channels; /* number of interleaved channels */ } Audio_filehdr; -#ifdef linux +#if defined(linux) || defined(__FreeBSD_kernel__) + +#if defined(linux) #include <linux/soundcard.h> +#else +#include <sys/soundcard.h> +#endif #define DEV_MIXER "/dev/mixer" #define MAX_VOLUME 100 @@ -101,7 +111,7 @@ void setvolume(int which, unsigned char #define CLOSE_FD(afd) { if (afd > -1) close(afd); afd = -1; } -#ifdef linux +#if defined(linux) || defined(__FreeBSD_kernel__) #define INIT_FD { audiofd = filefd = mixer_fd = -1; } #define END_FD { CLOSE_FD(audiofd); CLOSE_FD(filefd); CLOSE_FD(mixer_fd); return; } #else @@ -117,7 +127,7 @@ void audio_beep (void) unsigned char buf[256]; Audio_filehdr *au_hdr; -#ifdef linux +#if defined(linux) || defined(__FreeBSD_kernel__) StereoVolume origVol, volume; int mixer_fd; #else @@ -125,14 +135,18 @@ void audio_beep (void) int origVol; #endif + /* NOP if requested volume is zero. */ + if (cool_vol <= 0) return; + INIT_FD; audiofd = open( "/dev/audio", O_WRONLY | O_NDELAY ); if (audiofd < 0) { + perror("/dev/audio"); fprintf(stderr, "%s: Problem opening /dev/audio.\n", "Coolmail"); END_FD; } -#ifdef linux +#if defined(linux) || defined(__FreeBSD_kernel__) if ( (mixer_fd=open(DEV_MIXER, O_RDWR, 0)) < 0 ) { fprintf(stderr, "Can't open %s: ", DEV_MIXER); END_FD; @@ -185,7 +199,7 @@ void audio_beep (void) /* Strip the header */ au_hdr = (Audio_filehdr *)buf; -#ifdef linux +#if defined(linux) || defined(__FreeBSD_kernel__) rn = ntohl(au_hdr->hdr_size) - sizeof(Audio_filehdr); #else rn = au_hdr->hdr_size - sizeof(Audio_filehdr); @@ -217,7 +231,7 @@ void audio_beep (void) usleep(1000); } } -#ifdef linux +#if defined(linux) || defined(__FreeBSD_kernel__) CLOSE_FD(audiofd); if ( ioctl(mixer_fd, MIXER_WRITE(SOUND_MIXER_VOLUME), &origVol) < 0 ) { --- coolmail.c +++ coolmail.c 2011-06-22 12:57:51.439926019 +0000 @@ -26,6 +26,7 @@ #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> +#include <pwd.h> #ifdef AUDIO #include <string.h> @@ -33,6 +34,7 @@ #include "render1.h" #include "mailbox.h" +#include "display_list.h" #define DEFAULT_MAIL_DIR "/var/spool/mail/" #define DEFAULT_COMMAND "xterm -n Elm -e mail\0" @@ -96,7 +98,7 @@ void cool_usage(void); int main(int argc, char *argv[]) { int reason; - char username[L_cuserid]; + struct passwd *uid; /* Quickly scan for the -h option -- if it is present don't do anything * but print out some help and exit. */ @@ -104,7 +106,11 @@ int main(int argc, char *argv[]) return(0); /* Get the username and use it to create a default mailfile name */ - strcat(mailfile_str, cuserid(username)); + if (!(uid = getpwuid(geteuid()))) { + printf("Couldn't determine your username. Exiting.\n"); + return 1; + } + strcat(mailfile_str, uid->pw_name); /* Initialize the renderer */ rend_init(&argc, argv, (float)150.0); --- render1.c +++ render1.c 2011-06-22 12:58:48.100426761 +0000 @@ -13,6 +13,7 @@ #include <stdlib.h> #include <stdio.h> +#include <string.h> #include <math.h> #include <assert.h> --- system/X11/display_list.c +++ system/X11/display_list.c 2011-06-22 00:00:00.000000000 +0000 @@ -306,9 +306,9 @@ void disp_bell(void) /* play the soundfile */ audio_beep(); else /* no sound file chosen then use system bell */ - XBell(XtDisplay(main_gfx_w), cool_vol); + XBell(XtDisplay(main_gfx_w), (2*cool_vol)-100); #else - XBell(XtDisplay(main_gfx_w), 50); + XBell(XtDisplay(main_gfx_w), 0); #endif }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor