diff options
author | anthm <anthm@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-01-05 19:11:26 +0000 |
---|---|---|
committer | anthm <anthm@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-01-05 19:11:26 +0000 |
commit | ffcef3b142ddb66219c2087f3e5e3b49fcb7ee21 (patch) | |
tree | 7025bb838afebf8e38571c156efde7eb4f25ea41 /contrib/utils/rawplayer.c | |
parent | dbe6ddeb43ade81974f82f1cecac1637a547d6dc (diff) |
add rawplayer applet to contrib/utils
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@4675 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'contrib/utils/rawplayer.c')
-rwxr-xr-x | contrib/utils/rawplayer.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/contrib/utils/rawplayer.c b/contrib/utils/rawplayer.c new file mode 100755 index 000000000..61944a885 --- /dev/null +++ b/contrib/utils/rawplayer.c @@ -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); + } +} + |