]> git.ipfire.org Git - thirdparty/squid.git/blob - compat/psignal.c
SourceFormat Enforcement
[thirdparty/squid.git] / compat / psignal.c
1 /*
2 * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
3 *
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
7 */
8
9 #include "squid.h"
10 #include "psignal.h"
11
12 #if _SQUID_AIX_ || _SQUID_ANDROID_ || _SQUID_MINGW_
13 extern const char* const sys_siglist[];
14 #define _sys_nsig 64
15 #define _sys_siglist sys_siglist
16 #endif
17
18 /// purpose: print message, colon, space, signal name and LF.
19 /// paramtr: sig (IN): signal number
20 /// msg (IN): message to prepend
21 void
22 psignal( int sig, const char* msg )
23 {
24 if ( msg && *msg ) fprintf( stderr, "%s: ", msg );
25 if ( sig > 0 && sig < _sys_nsig )
26 fprintf( stderr, "%s\n", _sys_siglist[sig] );
27 else
28 fputs( "(unknown)\n", stderr );
29 }
30