]> git.sesse.net Git - vlc/blob - src/misc/darwin_specific.c
* Added error checking in pthread wrapper ; as a result, intf_msg.h must
[vlc] / src / misc / darwin_specific.c
1 /*****************************************************************************
2  * darwin_specific.c: Darwin specific features 
3  *****************************************************************************
4  * Copyright (C) 2001 VideoLAN
5  * $Id: darwin_specific.c,v 1.5 2001/11/28 15:08:06 massiot Exp $
6  *
7  * Authors: Samuel Hocevar <sam@zoy.org>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  * 
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
22  *****************************************************************************/
23 #include "defs.h"
24
25 #include <string.h>                                              /* strdup() */
26 #include <stdlib.h>                                                /* free() */
27
28 #include "config.h"
29 #include "common.h"
30 #include "intf_msg.h"
31 #include "threads.h"
32 #include "mtime.h"
33
34 #include "darwin_specific.h"
35
36 /*****************************************************************************
37  * Static vars
38  *****************************************************************************/
39 static char * psz_program_path;
40
41 /*****************************************************************************
42  * system_Init: fill in program path.
43  *****************************************************************************/
44 void system_Init( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] )
45 {
46     char i_dummy;
47     char *p_char, *p_oldchar = &i_dummy;
48
49     /* Get the full program path and name */
50     p_char = psz_program_path = strdup( ppsz_argv[ 0 ] );
51
52     /* Remove trailing program name */
53     for( ; *p_char ; )
54     {
55         if( *p_char == '/' )
56         {
57             *p_oldchar = '/';
58             *p_char = '\0';
59             p_oldchar = p_char;
60         }
61
62         p_char++;
63     }
64     
65     return;
66 }
67
68 /*****************************************************************************
69  * system_End: free the program path.
70  *****************************************************************************/
71 void system_End( void )
72 {
73     free( psz_program_path );
74 }
75
76 /*****************************************************************************
77  * system_GetProgramPath: get the full path to the program.
78  *****************************************************************************/
79 char * system_GetProgramPath( void )
80 {
81     return( psz_program_path );
82 }
83