add rawplayer applet to contrib/utils

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@4675 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Anthony Minessale II
2005-01-05 19:11:26 +00:00
parent 7568d9a4ef
commit 5ad345f6b0
2 changed files with 75 additions and 0 deletions

38
contrib/utils/rawplayer.c Executable file
View File

@@ -0,0 +1,38 @@
/*
Rawplayer.c simple raw file stdout player
(c) Anthony C Minessale II <anthmct@yahoo.com>
*/
#define BUFLEN 320
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
static int deliver_file(char *path, int fdout) {
int fd = 0, bytes = 0;
short buf[BUFLEN];
if ((fd = open(path,O_RDONLY))) {
while ((bytes=read(fd, buf, BUFLEN))) {
write(fdout, buf, bytes);
}
if(fd)
close(fd);
} else
return -1;
return 0;
}
int main(int argc, char *argv[]) {
int x = 0, fdout = 0;
fdout = fileno(stdout);
for (;;)
for (x = 1; x < argc ; x++) {
if(deliver_file(argv[x], fdout))
exit(1);
}
}