#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
Go to the source code of this file.
|
static int | deliver_file (char *path, int fdout) |
|
int | main (int argc, char *argv[]) |
|
◆ BUFLEN
◆ deliver_file()
static int deliver_file |
( |
char * |
path, |
|
|
int |
fdout |
|
) |
| |
|
static |
Definition at line 17 of file rawplayer.c.
17 {
18 int fd = 0, bytes = 0,
error = 0;
20
21 if ((fd = open(path,O_RDONLY))) {
22 while ((bytes=read(fd,
buf,
BUFLEN)) > 0) {
23 if(write(fdout,
buf, bytes) < 0){
25 break;
26 }
27 }
28 if(fd)
29 close(fd);
30 } else
31 return -1;
32
34}
int error(const char *format,...)
References buf, BUFLEN, and error().
Referenced by main().
◆ main()
int main |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
Definition at line 37 of file rawplayer.c.
37 {
38 int x = 0, fdout = 0;
39 fdout = fileno(stdout);
40 for (;;)
41 for (x = 1; x < argc ; x++) {
43 exit(1);
44 }
45}
static int deliver_file(char *path, int fdout)
References deliver_file().