]> git.sesse.net Git - vlc/blob - modules/codec/cmml/browser_open.c
* More compiler warning fixes (const mostly)
[vlc] / modules / codec / cmml / browser_open.c
1 /*****************************************************************************
2  * browser_open.c: platform-independent opening of a web browser
3  *****************************************************************************
4  * Copyright (C) 2004 Commonwealth Scientific and Industrial Research
5  *                    Organisation (CSIRO) Australia
6  * Copyright (C) 2004 the VideoLAN team
7  *
8  * $Id$
9  *
10  * Authors: Andre Pang <Andre.Pang@csiro.au>
11  *
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation; either version 2 of the License, or
15  * (at your option) any later version.
16  * 
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, write to the Free Software
24  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
25  *****************************************************************************/
26
27 #include <stdlib.h>
28 #include <string.h>
29
30 #include "xstrcat.h"
31 #include "browser_open.h"
32
33 int browser_Open( const char *psz_url )
34 {
35 #ifdef __APPLE__
36     char *psz_open_commandline;
37
38     psz_open_commandline = strdup( "/usr/bin/open " );
39     psz_open_commandline = xstrcat( psz_open_commandline, psz_url );
40
41     return system( psz_open_commandline );
42
43 #elif defined( UNDER_CE )
44     return -1;
45
46 #elif defined( WIN32 )
47     char *psz_open_commandline;
48
49     psz_open_commandline = strdup( "explorer " );
50     xstrcat( psz_open_commandline, psz_url );
51
52     return system( psz_open_commandline );
53
54 #else
55     /* Assume we're on a UNIX of some sort */
56     char *psz_open_commandline;
57     int i_ret;
58
59     /* Debian uses www-browser */
60     psz_open_commandline = strdup( "www-browser" );
61     xstrcat( psz_open_commandline, psz_url );
62     i_ret = system( psz_open_commandline );
63
64     if( i_ret == 0 ) return 0;
65
66     free( psz_open_commandline );
67
68     /* Try mozilla */
69     psz_open_commandline = strdup( "mozilla" );
70     xstrcat( psz_open_commandline, psz_url );
71     return system( psz_open_commandline );
72 #endif
73 }
74