Remove unneeded `struct` keyword for typedef'd structs
[midnight-commander.git] / lib / vfs / netutil.c
blob7d69b162d0a5133b0a61f13a4b9b725a05b209ec
1 /*
2 Network utilities for the Midnight Commander Virtual File System.
4 Copyright (C) 1995-2016
5 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>
32 #include <string.h> /* memset() */
34 #include "lib/global.h"
36 #include "netutil.h"
38 /*** global variables ****************************************************************************/
40 SIG_ATOMIC_VOLATILE_T got_sigpipe = 0;
42 /*** file scope macro definitions ****************************************************************/
44 /*** file scope type declarations ****************************************************************/
46 /*** file scope variables ************************************************************************/
48 /*** file scope functions ************************************************************************/
49 /* --------------------------------------------------------------------------------------------- */
51 static void
52 sig_pipe (int unused)
54 (void) unused;
55 got_sigpipe = 1;
58 /* --------------------------------------------------------------------------------------------- */
59 /*** public functions ****************************************************************************/
60 /* --------------------------------------------------------------------------------------------- */
62 void
63 tcp_init (void)
65 static gboolean initialized = FALSE;
66 struct sigaction sa;
68 if (initialized)
69 return;
71 got_sigpipe = 0;
72 memset (&sa, 0, sizeof (sa));
73 sa.sa_handler = sig_pipe;
74 sigemptyset (&sa.sa_mask);
75 sigaction (SIGPIPE, &sa, NULL);
77 initialized = TRUE;
80 /* --------------------------------------------------------------------------------------------- */