home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
rtsi.com
/
2014.01.www.rtsi.com.tar
/
www.rtsi.com
/
OS9
/
MM1
/
SOUNDUTILS
/
cuckoo.lzh
/
SRC
/
cuckoo.c
Wrap
C/C++ Source or Header
|
1994-01-18
|
1KB
|
53 lines
/* released to PD by Andrzej Kotanski, Jan. 18, 1994 */
#include <stdio.h>
#include <time.h>
extern errno;
main()
{
int hour, min, pipe, i, nil, win;
struct sgtbuf timebuf;
getime(&timebuf);
hour = timebuf.t_hour;
min = timebuf.t_minute;
if ( min > 55 ) {
hour++;
min = 0;
}
pipe = creat("/pipe/cuckoo", 3);
if ( pipe == -1 )
exit(_errmsg(errno, "cannot create pipe\n"));
hour = ((hour % 12) + 11) % 12 + 1;
if ( min > 28 && min < 32 )
hour = 1;
for ( i = 0; i < hour; i++ )
writeln(pipe, "play\n", 5);
writeln(pipe, "quit\n");
nil = open("/nil", 3);
if ( nil == -1 )
exit(_errmsg(errno, "cannot open '/nil'\n"));
win = open("/w", 0);
if ( win == -1 )
exit(_errmsg(errno, "cannot open '/term'\n"));
close(0);
dup(pipe);
close(1);
dup(win);
close(2);
dup(nil);
i = system("playm /h0/demo/snds/cuckoo.iff");
if ( i )
exit(_errmsg(errno, "error in forking 'playm'\n"));
}