--
char*p="[)1++++++11+(QI1)9191991)9)1)(II1)919Y91)9)1)(AK+9;991+3*(9I1*IY991)Q1\
)(1I1))A91991)Q1)(+)1)1++9;)Q1+(";main(){int _;while(*p){for(_=*p-32>>3;_;--_)
putchar(' ');if(!(_=*p++-32&7))putchar('\n');else while(_--)printf("_/");}}
---%<------%<------%<------%<------%<------%<------%<------%<------%<------%<--
--- FvwmAudio.c.orig Wed May 17 14:55:00 1995
+++ FvwmAudio.c Sun Dec 29 03:01:52 1996
_at_@ -90,7 +90,9 @@
int fd_width;
int fd[2];
char audio_play_cmd_line[BUFSIZE], audio_play_dir[BUFSIZE];
-time_t audio_delay = 0; /* seconds */
+time_t audio_delay = 0, /* seconds */
+ last_time = 0,
+ now;
#ifdef HAVE_RPLAY
int rplay_fd = -1;
#endif
_at_@ -128,10 +130,11 @@
"end_config_info",
"icon_file",
"default_icon",
+ "string",
/* add builtins here */
"startup",
"shutdown",
- "unknown",
+ "unknown"
};
/* define the sound table */
_at_@ -146,13 +149,6 @@
{
char *temp, *s;
- if ((argc != 6)&&(argc != 7))
- {
- fprintf(stderr,"%s Version %s should only be executed by fvwm!\n",
- MyName, VERSION);
- exit(1);
- }
-
/* Save our program name - for error messages */
temp = argv[0];
s=strrchr(argv[0], '/');
_at_@ -163,6 +159,14 @@
strcpy(MyName,"*");
strcat(MyName, temp);
+ if ((argc != 6)&&(argc != 7))
+ {
+ fprintf(stderr,"%s Version %s should only be executed by fvwm!\n",
+ MyName, VERSION);
+ exit(1);
+ }
+
+
/* Dead pipe == Fvwm died */
signal (SIGPIPE, DeadPipe);
_at_@ -353,10 +357,23 @@
***********************************************************************/
void Loop(int *fd)
{
- unsigned long header[HEADER_SIZE], *body;
- char *cbody;
+/* should find something better for resyncing */
+#define RESYNC( ) continue
+
+#define READ_BODY( ) do { \
+ total = 0; \
+ while(total < body_length*sizeof(unsigned long)) \
+ { \
+ if((count2=read(fd[1],&body[total], \
+ body_length*sizeof(unsigned long)-total)) >0) \
+ total += count2; \
+ else if(count2 < 0) \
+ DeadPipe(0); \
+ } \
+} while( 0 )
+
+ unsigned long header[HEADER_SIZE], body[ MAX_BODY_SIZE ];
int body_length,count,count2=0, total;
- time_t now, last_time = 0;
unsigned long code;
while (1)
_at_@ -369,53 +386,42 @@
* period.
*/
now = time(0);
+ body_length = header[2]-HEADER_SIZE;
+ if( header[ 0 ] != START_FLAG )
+ RESYNC( );
if (now < (last_time + audio_delay))
{
+ /*
+ * read the message so we are still synchronized
+ */
+ READ_BODY( );
continue;
}
- last_time = now;
- if(header[0] == START_FLAG)
- {
- body_length = header[2]-HEADER_SIZE;
- body = (unsigned long *)
- safemalloc(body_length * sizeof(unsigned long));
- cbody = (char *)body;
- total = 0;
- while(total < body_length*sizeof(unsigned long))
- {
- if((count2=read(fd[1],&cbody[total],
- body_length*sizeof(unsigned long)-total)) >0)
- total += count2;
- else if(count2 < 0)
- DeadPipe(0);
- }
+ READ_BODY( );
- /*
- * code will equal the number of shifts in the
- * base-2 header[1] number. Could use log here
- * but this should be fast enough.
- */
- code = -1;
- while (header[1])
- {
- code++;
- header[1] >>= 1;
- }
-
- /*
- * Play the sound.
- */
- if (code >= 0 && code < MAX_MESSAGES)
- {
- audio_play(code);
- }
- else
- {
- audio_play(BUILTIN_UNKNOWN);
- }
-
- free(body);
+ /*
+ * code will equal the number of shifts in the
+ * base-2 header[1] number. Could use log here
+ * but this should be fast enough.
+ */
+ code = -1;
+ while (header[1])
+ {
+ code++;
+ header[1] >>= 1;
+ }
+
+ /*
+ * Play the sound.
+ */
+ if (code >= 0 && code < MAX_MESSAGES)
+ {
+ audio_play(code);
+ }
+ else
+ {
+ audio_play(BUILTIN_UNKNOWN);
}
}
if(count <= 0)
_at_@ -457,6 +463,7 @@
int audio_play(short sound)
{
static char buf[BUFSIZE];
+ int ret;
#ifdef HAVE_RPLAY
if (rplay_fd != -1)
_at_@ -467,6 +474,8 @@
{
rplay_perror("rplay");
}
+ else
+ last_time = now;
}
return 0;
}
_at_@ -488,7 +497,11 @@
sprintf(buf,"%s %s/%s &", audio_play_cmd_line, audio_play_dir,
sound_table[sound]);
}
- return system(buf);
+
+ if( ! ( ret = system(buf))) {
+ last_time = now;
+ }
+ return ret;
}
return 1;
---%<------%<------%<------%<------%<------%<------%<------%<------%<------%<--
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to majordomo_at_hpc.uh.edu.
To report problems, send mail to fvwm-owner_at_hpc.uh.edu.
Received on Tue Jan 07 1997 - 02:45:10 GMT
This archive was generated by hypermail 2.3.0 : Mon Aug 29 2016 - 19:37:59 BST