File: exception.c

package info (click to toggle)
nfqueue-bindings 0.4-3
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 232 kB
  • sloc: ansic: 257; python: 211; perl: 183; makefile: 28; sh: 25
file content (27 lines) | stat: -rw-r--r-- 455 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <exception.h>

static char error_message[256];
static int error_status = 0;

void throw_exception(char *msg) {
        strncpy(error_message,msg,255);
        error_status = 1;
}

void clear_exception() {
        error_status = 0;
}

char *check_exception() {
        if (error_status) {
                return error_message;
        } else {
                return NULL;
        }
}