-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathutils.c
53 lines (49 loc) · 1.38 KB
/
utils.c
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
50
51
52
53
/*
* raw2rgbpnm --- convert raw bayer images to RGB PNM for easier viewing
*
* Copyright (C) 2008--2011 Nokia Corporation
*
* Contact: Sakari Ailus <[email protected]>
*
* Author:
* Tuukka Toivonen <[email protected]>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* version 2 as published by the Free Software Foundation.
*
* 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., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
#include "utils.h"
#include <stdio.h>
#include <stdarg.h>
#include <errno.h>
#include <string.h>
#include <stdlib.h>
#include <sys/ioctl.h>
extern char *progname;
void error(const char *format, ...) {
va_list ap;
int err;
err = errno;
va_start(ap, format);
fprintf(stderr, "%s: ", progname);
if (format)
vfprintf(stderr, format, ap);
else
fprintf(stderr, "error");
if (err) fprintf(stderr, " (%s)", strerror(err));
fprintf(stderr, "\n");
va_end(ap);
if (!err)
err = 1;
exit(err);
}