wmacpi: fix multiple definitions of two global variables.
[dockapps.git] / wmjmail / src / Jet.post-andre.patch
bloba7c4b57a03a3820eaf433ed96ef58d745a077e2d
1 --- wmjmail.c Wed Mar 28 08:34:44 2001
2 +++ wmjmail.c.3 Wed Mar 28 08:33:08 2001
3 @@ -14,22 +14,27 @@
4 #define AUDIOPLAYER "/usr/bin/play"
5 #define AUDIOFILE "/usr/share/audio/clink.au"
6 #define SPOOLDIR "/var/spool/mail/"
7 -#define APPLICATION "xterm -sb -sl 2000 +si +sk -title XTerm -fg black -bg wheat -geometry 71x50-0-0 -e mutt &"
8 +#define APPLICATION "Eterm -g 80x40 -e mutt"
10 +// I wanted a different default than Andre, since I print it and no-longer use '&'
11 +//#define APPLICATION "xterm -sb -sl 2000 +si +sk -title XTerm -fg black -bg wheat -geometry 71x50-0-0 -e mutt &"
13 int dontread = 0;
14 static char my_folder[256];
15 static char my_app[256];
16 static char my_audio[512];
17 +static char my_aplayer[256]; // made global for the help
18 +static char my_afile[256]; // made global for the help
19 static int my_new, my_tot, my_read;
20 static off_t size;
22 void show_help() {
23 - printf("-r : Don't show the read mail stat.\n");
24 - printf("-s <sec> : Seconds between executions of mailchk\n");
25 - printf("-x <exe> : Program to execute on button click \n");
26 - printf("-f <folder>: Mail folder to watch \n");
27 - printf("-P <player>: Audio player to use for notification \n");
28 - printf("-p <afile> : Audio file to play for notification \n");
29 + printf("-r : Don't show the number of unread messages.\n");
30 + printf("-s <sec> : Seconds between executions of mailchk [15]\n");
31 + printf("-x <exe> : Program to execute on button click [%s]\n", my_app);
32 + printf("-f <folder>: Mail folder to watch [%s]\n", my_folder);
33 + printf("-P <player>: Audio player to use for notification [%s]\n", my_afile);
34 + printf("-p <afile> : Audio file to play for notification [%s]\n", my_aplayer);
36 exit(0);
38 @@ -37,8 +42,6 @@
39 void setup(int argc, char** argv) {
40 char c;
41 int i;
42 - char my_aplayer[256];
43 - char my_afile[256];
45 snprintf (my_app, 255, "%s", APPLICATION);
46 snprintf (my_folder, 255, "%s/%s", SPOOLDIR, getenv("USER"));
47 @@ -70,15 +73,13 @@
48 int in;
49 struct stat buf;
51 - if ( stat (my_folder, &buf) != 0 )
52 - {
53 + if ( stat (my_folder, &buf) != 0 ) {
54 perror ("");
55 fprintf (stderr, "Could not stat '%s'\n", my_folder);
56 exit (-2);
59 - if ( size != buf.st_size )
60 - {
61 + if ( size != buf.st_size ) {
62 FILE *f = popen ("mailchk", "r");
63 fscanf (f, "%i - %i - %i", &my_new, &my_tot, &my_read);
64 pclose (f);
65 @@ -121,6 +122,9 @@
68 void do_button_release() {
69 - system (my_app);
70 + if(!fork()) {
71 + system( my_app );
72 + exit( 0 );
73 + }