summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/sig.c
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>1997-08-25 00:29:32 +0000
committerbrian <brian@FreeBSD.org>1997-08-25 00:29:32 +0000
commit1a67d257255b14fb46fc02630bf861a49bebd625 (patch)
tree5a0190bb42d398d91fc5bbdd17de31f54aec2459 /usr.sbin/ppp/sig.c
parentbbf38e6e36ecd35771c55badcb09ca745a61d881 (diff)
downloadFreeBSD-src-1a67d257255b14fb46fc02630bf861a49bebd625.zip
FreeBSD-src-1a67d257255b14fb46fc02630bf861a49bebd625.tar.gz
Make the code format more in line with style(9).
Update loadalias to use the new libalias api. Update to version 1.1.
Diffstat (limited to 'usr.sbin/ppp/sig.c')
-rw-r--r--usr.sbin/ppp/sig.c77
1 files changed, 41 insertions, 36 deletions
diff --git a/usr.sbin/ppp/sig.c b/usr.sbin/ppp/sig.c
index b9c1451..1abe6b1 100644
--- a/usr.sbin/ppp/sig.c
+++ b/usr.sbin/ppp/sig.c
@@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: sig.c,v 1.6 1997/03/13 12:45:33 brian Exp $
+ * $Id: sig.c,v 1.7 1997/06/09 03:27:36 brian Exp $
*
* TODO:
*
@@ -44,52 +44,57 @@ static sig_type handler[NSIG]; /* all start at SIG_DFL */
/* Record a signal in the "caused" array */
-static void signal_recorder(int sig) {
- caused[sig-1]++;
+static void
+signal_recorder(int sig)
+{
+ caused[sig - 1]++;
}
/*
- set up signal_recorder, and record handler as the function to ultimately
- call in handle_signal()
+ * Set up signal_recorder, and record handler as the function to ultimately
+ * call in handle_signal()
*/
-sig_type pending_signal(int sig,sig_type fn) {
- sig_type Result;
+sig_type
+pending_signal(int sig, sig_type fn)
+{
+ sig_type Result;
- if (sig <= 0 || sig > NSIG) {
- /* Oops - we must be a bit out of date (too many sigs ?) */
- LogPrintf(LogALERT, "Eeek! %s:%s: I must be out of date!\n",
- __FILE__,__LINE__);
- return signal(sig,fn);
- }
-
- Result = handler[sig-1];
- if (fn == SIG_DFL || fn == SIG_IGN) {
- signal(sig,fn);
- handler[sig-1] = (sig_type)0;
- } else {
- handler[sig-1] = fn;
- signal(sig,signal_recorder);
- }
- caused[sig-1] = 0;
- return Result;
+ if (sig <= 0 || sig > NSIG) {
+ /* Oops - we must be a bit out of date (too many sigs ?) */
+ LogPrintf(LogALERT, "Eeek! %s:%s: I must be out of date!\n",
+ __FILE__, __LINE__);
+ return signal(sig, fn);
+ }
+ Result = handler[sig - 1];
+ if (fn == SIG_DFL || fn == SIG_IGN) {
+ signal(sig, fn);
+ handler[sig - 1] = (sig_type) 0;
+ } else {
+ handler[sig - 1] = fn;
+ signal(sig, signal_recorder);
+ }
+ caused[sig - 1] = 0;
+ return Result;
}
/* Call the handlers for any pending signals */
-void handle_signals() {
- int sig;
- int got;
+void
+handle_signals()
+{
+ int sig;
+ int got;
- do {
- got = 0;
- for (sig = 0; sig < NSIG; sig++)
- if (caused[sig]) {
- caused[sig]--;
- got++;
- (*handler[sig])(sig+1);
- }
- } while(got);
+ do {
+ got = 0;
+ for (sig = 0; sig < NSIG; sig++)
+ if (caused[sig]) {
+ caused[sig]--;
+ got++;
+ (*handler[sig]) (sig + 1);
+ }
+ } while (got);
}
OpenPOWER on IntegriCloud