Fix Lancer-patched libvorbis-aoTuV so it builds with GCC.
[vorbis-lancer-gcc.git] / vorbis-tools-1.2.0 / ogg123 / transport.c
blobd73d91ae1cba9d06e1a6464b453021d76a897be4
1 /********************************************************************
2 * *
3 * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
4 * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
5 * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *
6 * PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
7 * *
8 * THE Ogg123 SOURCE CODE IS (C) COPYRIGHT 2000-2001 *
9 * by Stan Seibert <volsung@xiph.org> AND OTHER CONTRIBUTORS *
10 * http://www.xiph.org/ *
11 * *
12 ********************************************************************
14 last mod: $Id: transport.c,v 1.4 2002/05/05 03:45:04 segher Exp $
16 ********************************************************************/
18 #ifdef HAVE_CONFIG_H
19 #include <config.h>
20 #endif
22 #include <stdio.h>
23 #include <string.h>
25 #include "transport.h"
26 #include "i18n.h"
28 extern transport_t file_transport;
29 #ifdef HAVE_CURL
30 extern transport_t http_transport;
31 #endif
33 transport_t *transports[] = {
34 #ifdef HAVE_CURL
35 &http_transport,
36 #endif
37 &file_transport,
38 NULL
42 transport_t *get_transport_by_name (char *name)
44 int i = 0;
46 while (transports[i] != NULL && strcmp(name, transports[i]->name) != 0)
47 i++;
49 return transports[i];
53 transport_t *select_transport (char *source)
55 int i = 0;
57 while (transports[i] != NULL && !transports[i]->can_transport(source))
58 i++;
60 return transports[i];
64 data_source_stats_t *malloc_data_source_stats (data_source_stats_t *to_copy)
66 data_source_stats_t *new_stats;
68 new_stats = malloc(sizeof(data_source_stats_t));
70 if (new_stats == NULL) {
71 fprintf(stderr, _("Error: Could not allocate memory in malloc_data_source_stats()\n"));
72 exit(1);
75 *new_stats = *to_copy; /* Copy the data */
77 return new_stats;