/alps/ipecamera

To get this branch, use:
bzr branch http://suren.me/webbzr/alps/ipecamera

« back to all changes in this revision

Viewing changes to error.c

  • Committer: Suren A. Chilingaryan
  • Date: 2015-04-27 00:28:57 UTC
  • Revision ID: csa@suren.me-20150427002857-82fk6r3e8rfgy4wr
First stand-alone ipecamera implementation

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#define _PCILIB_ERROR_C
2
 
 
3
 
#include <stdio.h>
4
 
#include <stdarg.h>
5
 
 
6
 
#include "error.h"
7
 
 
8
 
static void pcilib_print_error(const char *msg, ...) {
9
 
    va_list va;
10
 
    
11
 
    va_start(va, msg);
12
 
    vprintf(msg, va);
13
 
    va_end(va);
14
 
    printf("\n");
15
 
}
16
 
 
17
 
void (*pcilib_error)(const char *msg, ...) = pcilib_print_error;
18
 
void (*pcilib_warning)(const char *msg, ...) = pcilib_print_error;
19
 
 
20
 
int pcilib_set_error_handler(void (*err)(const char *msg, ...), void (*warn)(const char *msg, ...)) {
21
 
    if (err) pcilib_error = err;
22
 
    else pcilib_error = pcilib_print_error;
23
 
    if (warn) pcilib_warning = warn;
24
 
    else pcilib_warning = pcilib_print_error;
25
 
 
26
 
    return 0;
27
 
}