summaryrefslogtreecommitdiff
path: root/libraries/libgphoto2/print-camera-list.c.diff
blob: 57d1883449e20dc0a533a090d3bc39999e7b66af (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
71
72
73
74
75
--- packaging/generic/print-camera-list.c	2007-07-27 02:35:28.000000000 +0200
+++ packaging/generic/print-camera-list.c.new	2008-02-22 20:24:35.000000000 +0100
@@ -382,14 +382,31 @@
 	char *owner;
 	char *group;
 	char *script;
-	char *begin_string;
-	char *usbcam_string;
+	const char *begin_string;
+	const char *usbcam_string;
 } udev_persistent_data_t;
 
 
 static void
 udev_parse_params (const func_params_t *params, void **data)
 {
+	/* Note: 2 lines because we need to use || ... having them on the same
+	 * line would mean &&.
+	 */
+	static const char * const begin_strings[] = {
+		/* UDEV_PRE_0_98 */
+		"BUS!=\"usb_device\", GOTO=\"libgphoto2_rules_end\"\n"
+		"ACTION!=\"add\", GOTO=\"libgphoto2_rules_end\"\n\n",
+		/* UDEV_0_98 */
+		"SUBSYSTEM!=\"usb|usb_device\", GOTO=\"libgphoto2_rules_end\"\n"
+		"ACTION!=\"add\", GOTO=\"libgphoto2_rules_end\"\n\n"
+	};
+	static const char * const usbcam_strings[] = {
+		/* UDEV_PRE_0_98 */
+		"SYSFS{idVendor}==\"%04x\", SYSFS{idProduct}==\"%04x\", ",
+		/* UDEV_0_98 */
+		"ATTRS{idVendor}==\"%04x\", ATTRS{idProduct}==\"%04x\", ",
+	};
 	udev_persistent_data_t *pdata;
 	pdata = calloc(1, sizeof(udev_persistent_data_t));
 	pdata->version = UDEV_0_98;
@@ -436,37 +453,12 @@
 		FATAL("The <script> parameter conflicts with the <mode,group,owner> parameters.");
 	}
 
-	/* Note: 2 lines because we need to use || ... having them on the same
-	 * line would mean &&.
-	 */
-	static char *begin_strings[] = {
-		/* UDEV_PRE_0_98 */
-		"BUS!=\"usb_device\", GOTO=\"libgphoto2_rules_end\"\n"
-		"ACTION!=\"add\", GOTO=\"libgphoto2_rules_end\"\n\n",
-		/* UDEV_0_98 */
-		"SUBSYSTEM!=\"usb_device\", GOTO=\"libgphoto2_rules_end\"\n"
-		"ACTION!=\"add\", GOTO=\"libgphoto2_rules_end\"\n\n"
-	};
-	static char *usbcam_strings[] = {
-		/* UDEV_PRE_0_98 */
-		"SYSFS{idVendor}==\"%04x\", SYSFS{idProduct}==\"%04x\", ",
-		/* UDEV_0_98 */
-		"ATTRS{idVendor}==\"%04x\", ATTRS{idProduct}==\"%04x\", ",
-	};
 	pdata->begin_string = begin_strings[pdata->version];
 	pdata->usbcam_string = usbcam_strings[pdata->version];
 }
 
-static void
-version_str_func(const char *str, void *data)
-{
-	const char **foo = (const char **)data;
-	fprintf(stdout, "V[%s]", str);
-	fflush(stdout);
-	*foo = str;
-}
 
-static inline const char *
+static const char *
 get_version_str(udev_version_t version)
 {
 	return gpi_enum_to_string(version, udev_version_t_map);