File: util.c

package info (click to toggle)
dv4l 1.0-6
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 568 kB
  • sloc: ansic: 7,541; makefile: 320; sh: 260
file content (49 lines) | stat: -rw-r--r-- 1,291 bytes parent folder | download | duplicates (2)
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
 * Copyright (C) 2007 Free Software Foundation, Inc.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation; version 2.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 *
 * Author: Wolfgang Beck <bewo at users.berlios.de> 2007
 */

#include <sys/ioctl.h>
#include <stdio.h>
#include <unistd.h>
#include <stdarg.h>
#include <string.h>
#include <fcntl.h>
#include <libv4l1-videodev.h>
#include "util.h"

static int tracelevel = 1;

void set_tracelevel(int x)
{
    tracelevel = x;
}

void _trace(int level, const char *file, int lineno, const char *fmt, ...)
{
    va_list ap;

    if(level <= tracelevel) {
	if(tracelevel > 1) {
	    fprintf(stderr, "%s +%d: ", file, lineno);
	}
	va_start(ap, fmt);
	vfprintf(stderr, fmt, ap);
	va_end(ap);
    }
}