Merge branch '2944_cleanup'
[midnight-commander.git] / lib / vfs / netutil.c
blob6d6ed66600c0169c46bea3f7999c844206f37cb9
1 /*
2 Network utilities for the Midnight Commander Virtual File System.
4 Copyright (C) 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2005, 2007, 2011
5 The Free Software Foundation, Inc.
7 This file is part of the Midnight Commander.
9 The Midnight Commander is free software: you can redistribute it
10 and/or modify it under the terms of the GNU General Public License as
11 published by the Free Software Foundation, either version 3 of the License,
12 or (at your option) any later version.
14 The Midnight Commander 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.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>.
23 /**
24 * \file
25 * \brief Source: Virtual File System: Network utilities
28 #include <config.h>
30 #include <stdlib.h>
31 #include <signal.h>
33 #include "lib/global.h"
35 #include "netutil.h"
37 /*** global variables ****************************************************************************/
39 SIG_ATOMIC_VOLATILE_T got_sigpipe = 0;
41 /*** file scope macro definitions ****************************************************************/
43 /*** file scope type declarations ****************************************************************/
45 /*** file scope variables ************************************************************************/
47 /*** file scope functions ************************************************************************/
48 /* --------------------------------------------------------------------------------------------- */
50 static void
51 sig_pipe (int unused)
53 (void) unused;
54 got_sigpipe = 1;
57 /* --------------------------------------------------------------------------------------------- */
58 /*** public functions ****************************************************************************/
59 /* --------------------------------------------------------------------------------------------- */
61 void
62 tcp_init (void)
64 static gboolean initialized = FALSE;
65 struct sigaction sa;
67 if (initialized)
68 return;
70 got_sigpipe = 0;
71 sa.sa_handler = sig_pipe;
72 sa.sa_flags = 0;
73 sigemptyset (&sa.sa_mask);
74 sigaction (SIGPIPE, &sa, NULL);
76 initialized = TRUE;
79 /* --------------------------------------------------------------------------------------------- */