home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.ncftp.com
/
ftp.ncftp.com.zip
/
ftp.ncftp.com
/
libncftp
/
older_versions
/
libncftp-3.2.2-src.tar.bz2
/
libncftp-3.2.2-src.tar
/
libncftp-3.2.2
/
sio
/
main.c
< prev
next >
Wrap
C/C++ Source or Header
|
2008-05-07
|
1KB
|
70 lines
#include "syshdrs.h"
#ifdef PRAGMA_HDRSTOP
# pragma hdrstop
#endif
int gLibSio_Uses_Me_To_Quiet_Variable_Unused_Warnings = 0;
/* Your app can set this to 1 to avoid pointless setting/restoring of SIGPIPE */
int sio_sigpipe_ignored_already = 0;
void
SIOPipeSignalIsBeingIgnoredGloballyByApplication(int value)
{
sio_sigpipe_ignored_already = value;
} /* SIOPipeSignalIsBeingIgnoredGloballyByApplication */
#ifdef UNIX_SIGNALS
#if defined(HPUX) || defined(__hpux__)
volatile Sjmp_buf gNetTimeoutJmp;
volatile Sjmp_buf gPipeJmp;
#else
Sjmp_buf gNetTimeoutJmp;
Sjmp_buf gPipeJmp;
#endif
void
SIOHandler(int sigNum)
{
if (sigNum == SIGPIPE)
SLongjmp(gPipeJmp, 1);
SLongjmp(gNetTimeoutJmp, 1);
} /* SIOHandler */
void (*SSignal(int signum, void (*handler)(int)))(int)
{
#ifdef HAVE_SIGACTION
struct sigaction sa, osa;
(void) sigemptyset(&sa.sa_mask);
sa.sa_flags = 0;
sa.sa_handler = handler;
if (signum == SIGALRM) {
#ifdef SA_INTERRUPT
sa.sa_flags |= SA_INTERRUPT;
#endif
} else {
#ifdef SA_RESTART
sa.sa_flags |= SA_RESTART;
#endif
}
if (sigaction(signum, &sa, &osa) < 0)
return (SIG_ERR);
return (osa.sa_handler);
#else
return SSignal(signum, handler);
#endif /* HAVE_SIGACTION */
}
#endif /* UNIX_SIGNALS */
/* eof main.c */