diff options
author | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-03-03 18:13:26 +0000 |
---|---|---|
committer | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-03-03 18:13:26 +0000 |
commit | 67da2f8263b4e9bb5522fa59b27e143381d69774 (patch) | |
tree | e69baf2b1594606e9ea2e80d26d691a10bd23831 /1.2-netsec/contrib/utils/rawplayer.c | |
parent | 187ac8fdb51443812933047136b96b5a532dd857 (diff) |
Creating tag for the release of asterisk-1.2.5
git-svn-id: http://svn.digium.com/svn/asterisk/tags/1.2.5@11747 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to '1.2-netsec/contrib/utils/rawplayer.c')
-rw-r--r-- | 1.2-netsec/contrib/utils/rawplayer.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/1.2-netsec/contrib/utils/rawplayer.c b/1.2-netsec/contrib/utils/rawplayer.c new file mode 100644 index 000000000..61944a885 --- /dev/null +++ b/1.2-netsec/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); + } +} + |