tcputil.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /* Network utilities for the Midnight Commander Virtual File System.
  2. Copyright (C) 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2005, 2007
  3. Free Software Foundation, Inc.
  4. This program is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Library General Public License
  6. as published by the Free Software Foundation; either version 2 of
  7. the License, or (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU Library General Public License for more details.
  12. You should have received a copy of the GNU Library General Public
  13. License along with this program; if not, write to the Free Software
  14. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
  15. /**
  16. * \file
  17. * \brief Source: Virtual File System: Network utilities
  18. */
  19. #include <config.h>
  20. #include <stdlib.h>
  21. #include <stdio.h>
  22. #include <signal.h>
  23. #include <sys/types.h>
  24. #include "tcputil.h"
  25. int got_sigpipe;
  26. static void
  27. sig_pipe (int unused)
  28. {
  29. (void) unused;
  30. got_sigpipe = 1;
  31. }
  32. void
  33. tcp_init (void)
  34. {
  35. struct sigaction sa;
  36. got_sigpipe = 0;
  37. sa.sa_handler = sig_pipe;
  38. sa.sa_flags = 0;
  39. sigemptyset (&sa.sa_mask);
  40. sigaction (SIGPIPE, &sa, NULL);
  41. }