Lines Matching defs:h

29 #include <fcntl.h>
30 #include <string.h>
31 #include <errno.h>
32 #include <sys/types.h>
33 #include <unistd.h>
34 #include <sys/stat.h>
35 #include <sys/statvfs.h>
36 #include <stdio.h>
37 #include <stdlib.h>
38 #include <libintl.h>
39 #include <limits.h>
40 #include <audio/au.h>
42 #include "bstream.h"
43 #include "util.h"
44 #include "audio.h"
45 #include "byteorder.h"
46 #include "main.h"
82 file_stream_size(bstreamhandle h, off_t *size)
88 if (fstat(h->bstr_fd, &st) < 0)
99 audio_stream_size(bstreamhandle h, off_t *size)
102 *size = (off_t)(uintptr_t)(h->bstr_private);
107 file_stream_read(bstreamhandle h, uchar_t *buf, off_t size)
110 return (read(h->bstr_fd, buf, size));
114 file_stream_write(bstreamhandle h, uchar_t *buf, off_t size)
117 return (write(h->bstr_fd, buf, size));
124 file_stream_read_wrbo(bstreamhandle h, uchar_t *buf, off_t size)
129 cnt = read(h->bstr_fd, buf, size);
147 file_stream_write_wrbo(bstreamhandle h, uchar_t *buf, off_t size)
160 return (write(h->bstr_fd, buf, size));
164 file_stream_close(bstreamhandle h)
169 fd = h->bstr_fd;
170 free(h);
175 stdin_stream_close(bstreamhandle h)
178 free(h);
183 wav_write_stream_close(bstreamhandle h)
190 sz = lseek(h->bstr_fd, 0L, SEEK_END);
191 (void) lseek(h->bstr_fd, 0L, SEEK_SET);
192 if (read(h->bstr_fd, &wav, sizeof (wav)) != sizeof (wav)) {
197 (void) lseek(h->bstr_fd, 0L, SEEK_SET);
198 if (write(h->bstr_fd, &wav, sizeof (wav)) != sizeof (wav)) {
201 (void) close(h->bstr_fd);
202 free(h);
207 au_write_stream_close(bstreamhandle h)
212 sz = lseek(h->bstr_fd, 0L, SEEK_END);
215 if (lseek(h->bstr_fd, 8L, SEEK_SET) < 0)
218 if (write(h->bstr_fd, &sz, 4) < 0)
221 (void) close(h->bstr_fd);
222 free(h);
228 stdin_stream_rewind(bstreamhandle h)
233 file_stream_rewind(bstreamhandle h)
235 (void) lseek(h->bstr_fd, 0L, SEEK_SET);
239 au_stream_rewind(bstreamhandle h)
243 (void) lseek(h->bstr_fd, 0L, SEEK_SET);
244 if (read(h->bstr_fd, &au, sizeof (au)) != sizeof (au)) {
248 if (lseek(h->bstr_fd, (long)(BE32_TO_CPU(au.au_offset)),
255 wav_stream_rewind(bstreamhandle h)
257 (void) lseek(h->bstr_fd, (long)(sizeof (Wave_filehdr)), SEEK_SET);
263 bstreamhandle h;
277 h = (bstreamhandle)my_zalloc(sizeof (*h));
278 h->bstr_fd = fd;
279 h->bstr_read = file_stream_read;
280 h->bstr_close = file_stream_close;
281 h->bstr_size = file_stream_size;
282 h->bstr_rewind = file_stream_rewind;
284 return (h);
290 bstreamhandle h;
294 h = open_file_read_stream(fname);
297 if (h == NULL)
304 h->bstr_size(h, &iso_size);
308 h->bstr_close(h);
317 (void) lseek(h->bstr_fd, ISO9660_BOOT_BLOCK_SIZE, SEEK_SET);
323 if (read(h->bstr_fd, iso_desc, ISO9660_PRIMARY_DESC_SIZE) ==
339 h->bstr_close(h);
344 h->bstr_close(h);
355 h->bstr_rewind(h);
356 return (h);
362 bstreamhandle h;
375 h = (bstreamhandle)my_zalloc(sizeof (*h));
376 h->bstr_fd = 0;
377 h->bstr_read = file_stream_read;
378 h->bstr_close = stdin_stream_close;
379 h->bstr_size = file_stream_size;
380 h->bstr_rewind = stdin_stream_rewind;
382 return (h);
388 bstreamhandle h;
447 h = (bstreamhandle)my_zalloc(sizeof (*h));
448 h->bstr_fd = fd;
449 h->bstr_read = file_stream_read_wrbo;
450 h->bstr_close = file_stream_close;
451 h->bstr_size = audio_stream_size;
452 h->bstr_rewind = au_stream_rewind;
453 h->bstr_private = (void *)data_size;
455 return (h);
469 bstreamhandle h;
516 h = (bstreamhandle)my_zalloc(sizeof (*h));
517 h->bstr_fd = fd;
518 h->bstr_read = file_stream_read;
519 h->bstr_close = file_stream_close;
520 h->bstr_size = audio_stream_size;
521 h->bstr_rewind = wav_stream_rewind;
522 h->bstr_private = (void *)data_size;
524 return (h);
538 bstreamhandle h;
540 h = open_file_read_stream(fname);
541 if (h != NULL) {
542 h->bstr_read = file_stream_read_wrbo;
544 return (h);
550 bstreamhandle h;
563 h = (bstreamhandle)my_zalloc(sizeof (*h));
564 h->bstr_fd = fd;
565 h->bstr_write = file_stream_write_wrbo;
566 h->bstr_close = au_write_stream_close;
567 return (h);
580 bstreamhandle h;
592 h = (bstreamhandle)my_zalloc(sizeof (*h));
593 h->bstr_fd = fd;
594 h->bstr_write = file_stream_write;
595 h->bstr_close = wav_write_stream_close;
596 return (h);
609 bstreamhandle h;
616 h = (bstreamhandle)my_zalloc(sizeof (*h));
617 h->bstr_fd = fd;
618 h->bstr_write = file_stream_write_wrbo;
619 h->bstr_close = file_stream_close;
620 return (h);
626 bstreamhandle h;
633 h = (bstreamhandle)my_zalloc(sizeof (*h));
634 h->bstr_fd = fd;
635 h->bstr_write = file_stream_write;
636 h->bstr_close = file_stream_close;
637 return (h);
643 bstreamhandle h;
663 h = (bstreamhandle)my_zalloc(sizeof (*h));
664 h->bstr_fd = fd;
665 h->bstr_read = file_stream_read;
666 h->bstr_write = file_stream_write;
667 h->bstr_close = file_stream_close;
668 h->bstr_size = file_stream_size;
669 h->bstr_rewind = file_stream_rewind;
671 return (h);