summaryrefslogtreecommitdiff
path: root/package/kbd/patches/patch-src_setvtrgb_c
blob: fc72c2409dfc90f32450c207c2df053e1289d73d (plain)
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
--- kbd-2.0.1.orig/src/setvtrgb.c	2013-08-27 22:45:33.000000000 +0200
+++ kbd-2.0.1/src/setvtrgb.c	2014-03-24 13:10:47.000000000 +0100
@@ -5,7 +5,7 @@
 #include <sys/ioctl.h>
 #include <linux/kd.h>
 #include <errno.h>
-#include <error.h>
+#include <err.h>
 #include "kbd.h"
 #include "getfd.h"
 #include "nls.h"
@@ -60,7 +60,7 @@ set_colormap(unsigned char *colormap)
 
 	/* Apply the color map to the tty via ioctl */
 	if (ioctl(fd, PIO_CMAP, colormap) == -1)
-		error(EXIT_FAILURE, errno, "ioctl");
+		err(EXIT_FAILURE, "ioctl");
 
 	close(fd);
 }
@@ -72,7 +72,7 @@ parse_file(FILE *fd, const char *filenam
 	unsigned int rows, cols, val;
 
 	if ((cmap = calloc(3 * 16, sizeof(unsigned char))) == NULL)
-		error(EXIT_FAILURE, errno, "calloc");
+		err(EXIT_FAILURE, "calloc");
 
 	for (rows = 0; rows < 3; rows++) {
 		cols = 0;
@@ -80,26 +80,26 @@ parse_file(FILE *fd, const char *filenam
 		while (cols < 16) {
 			if ((c = fscanf(fd, "%u", &val)) != 1) {
 				if (c == EOF)
-					error(EXIT_FAILURE, errno, "fscanf");
+					err(EXIT_FAILURE, "fscanf");
 
-				error(EXIT_FAILURE, 0, _("Error: %s: Invalid value in field %u in line %u."),
+				err(EXIT_FAILURE, _("Error: %s: Invalid value in field %u in line %u."),
 				      filename, rows + 1, cols + 1);
 			}
 
 			cmap[rows + cols * 3] = (unsigned char) val;
 
 			if (cols < 15 && fgetc(fd) != ',')
-				error(EXIT_FAILURE, 0, _("Error: %s: Insufficient number of fields in line %u."),
+				err(EXIT_FAILURE, _("Error: %s: Insufficient number of fields in line %u."),
 				      filename, rows + 1);
 			cols++;
 		}
 
 		if ((c = fgetc(fd)) == EOF)
-			error(EXIT_FAILURE, 0, _("Error: %s: Line %u has ended unexpectedly.\n"),
+			err(EXIT_FAILURE, _("Error: %s: Line %u has ended unexpectedly.\n"),
 			      filename, rows + 1); 
 
 		if (c != '\n')
-			error(EXIT_FAILURE, 0, _("Error: %s: Line %u is too long.\n"),
+			err(EXIT_FAILURE, _("Error: %s: Line %u is too long.\n"),
 			      filename, rows + 1);
 	}
 }
@@ -141,7 +141,7 @@ main(int argc, char **argv) {
 
 	} else {
 		if ((fd = fopen(file, "r")) == NULL)
-			error(EXIT_FAILURE, errno, "fopen");
+			err(EXIT_FAILURE, "fopen");
 
 		parse_file(fd, file);
 		fclose(fd);