]> git.sesse.net Git - vlc/blob - src/misc/win32_specific.c
798bb4bd2844d3f34c82bc531f6110b2f9f8a55b
[vlc] / src / misc / win32_specific.c
1 /*****************************************************************************
2  * win32_specific.c: Win32 specific features 
3  *****************************************************************************
4  * Copyright (C) 2001 VideoLAN
5  * $Id: win32_specific.c,v 1.2 2001/11/14 00:01:36 jlj 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 #include <fcntl.h>
28
29 #include <winsock2.h>
30
31 #include "common.h"
32 #include "threads.h"
33 #include "mtime.h"
34
35 #include "win32_specific.h"
36
37 /*****************************************************************************
38  * system_Init: initialize winsock.
39  *****************************************************************************/
40 void system_Init( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] )
41 {
42     WSADATA Data;
43     int i_err;
44
45     /* WinSock Library Init. */
46     i_err = WSAStartup( MAKEWORD( 1, 1 ), &Data );
47
48     if( i_err )
49     {
50         fprintf( stderr, "error: can't initiate WinSocks, error %i", i_err );
51     }
52
53     _fmode = _O_BINARY;  /* sets the default file-translation mode */
54 }
55
56 /*****************************************************************************
57  * system_End: terminate winsock.
58  *****************************************************************************/
59 void system_End( void )
60 {
61     WSACleanup();
62 }
63