]> git.sesse.net Git - vlc/blob - src/misc/linux_specific.c
Fix [10fcb9f9c3c73d13340c0bd4153fc4c9c87b7186] (win doesn't have setenv).
[vlc] / src / misc / linux_specific.c
1 /*****************************************************************************
2  * linux_specific.c: Linux-specific initialization
3  *****************************************************************************
4  * Copyright © 2008 Rémi Denis-Courmont
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
19  *****************************************************************************/
20
21 #ifdef HAVE_CONFIG_H
22 # include "config.h"
23 #endif
24
25 #include <vlc_common.h>
26 #include "../libvlc.h"
27
28 #if 0
29 #include <stdio.h>
30 #include <assert.h>
31 #include <pthread.h>
32
33 static void set_libvlc_path (void)
34 {
35     static char libvlc_path[PATH_MAX];
36
37     assert (strlen (LIBDIR) < sizeof (libvlc_path));
38     strcpy (libvlc_path, LIBDIR); /* fail safe */
39     vlc_global ()->psz_vlcpath = libvlc_path;
40
41     /* Find the path to libvlc (i.e. ourselves) */
42     FILE *maps = fopen ("/proc/self/maps", "rt");
43     if (maps == NULL)
44         return;
45
46     for (;;)
47     {
48         char buf[5000], *dir, *end;
49
50         if (fgets (buf, sizeof (buf), maps) == NULL)
51             break;
52
53         dir = strchr (buf, '/');
54         if (dir == NULL)
55             continue;
56         end = strrchr (dir, '/');
57         if (end == NULL)
58             continue;
59         if (strncmp (end + 1, "libvlc.so.", 10))
60             continue;
61
62         *end = '\0';
63         printf ("libvlc at %s\n", dir);
64         if (strlen (dir) < sizeof (libvlc_path))
65             strcpy (libvlc_path, dir);
66         break;
67     }
68
69     fclose (maps);
70 }
71 #endif
72
73 void system_Init (libvlc_int_t *libvlc, int *argc, const char *argv[])
74 {
75 #if 0
76     static pthread_once_t once = PTHREAD_ONCE_INIT;
77     pthread_once (&once, set_libvlc_path);
78 #endif
79     (void)libvlc; (void)argc; (void)argv;
80 }
81
82 void system_Configure (libvlc_int_t *libvlc, int *argc, const char *argv[])
83 {
84     (void)libvlc; (void)argc; (void)argv;
85 }
86
87 void system_End (libvlc_int_t *libvlc)
88 {
89     (void)libvlc;
90 }
91