Main Page | Modules | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

browser_open.c

00001 /*****************************************************************************
00002  * browser_open.c: platform-independent opening of a web browser
00003  *****************************************************************************
00004  * Copyright (C) 2004 Commonwealth Scientific and Industrial Research
00005  *                    Organisation (CSIRO) Australia
00006  * Copyright (C) 2004 the VideoLAN team
00007  *
00008  * $Id: browser_open.c 11664 2005-07-09 06:17:09Z courmisch $
00009  *
00010  * Authors: Andre Pang <[email protected]>
00011  *
00012  * This program is free software; you can redistribute it and/or modify
00013  * it under the terms of the GNU General Public License as published by
00014  * the Free Software Foundation; either version 2 of the License, or
00015  * (at your option) any later version.
00016  * 
00017  * This program is distributed in the hope that it will be useful,
00018  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020  * GNU General Public License for more details.
00021  *
00022  * You should have received a copy of the GNU General Public License
00023  * along with this program; if not, write to the Free Software
00024  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
00025  *****************************************************************************/
00026 
00027 #include <stdlib.h>
00028 #include <string.h>
00029 
00030 #include "xstrcat.h"
00031 
00032 int browser_Open( const char *psz_url )
00033 {
00034 #ifdef SYS_DARWIN
00035     char *psz_open_commandline;
00036 
00037     psz_open_commandline = strdup( "/usr/bin/open " );
00038     psz_open_commandline = xstrcat( psz_open_commandline, psz_url );
00039 
00040     return system( psz_open_commandline );
00041 
00042 #elif defined( UNDER_CE )
00043     return -1;
00044 
00045 #elif defined( WIN32 )
00046     char *psz_open_commandline;
00047 
00048     psz_open_commandline = strdup( "explorer " );
00049     xstrcat( psz_open_commandline, psz_url );
00050 
00051     return system( psz_open_commandline );
00052 
00053 #else
00054     /* Assume we're on a UNIX of some sort */
00055     char *psz_open_commandline;
00056     int i_ret;
00057 
00058     /* Debian uses www-browser */
00059     psz_open_commandline = strdup( "www-browser" );
00060     xstrcat( psz_open_commandline, psz_url );
00061     i_ret = system( psz_open_commandline );
00062 
00063     if( i_ret == 0 ) return 0;
00064 
00065     free( psz_open_commandline );
00066 
00067     /* Try mozilla */
00068     psz_open_commandline = strdup( "mozilla" );
00069     xstrcat( psz_open_commandline, psz_url );
00070     return system( psz_open_commandline );
00071 #endif
00072 }
00073 

Generated on Tue Dec 20 10:14:28 2005 for vlc-0.8.4a by  doxygen 1.4.2