summaryrefslogtreecommitdiffstats
path: root/package/busybox/busybox-1.9.0-stty.patch
blob: d9e7b2e957fa0e3e27185bd105130ea309b78823 (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
--- busybox-1.9.0/coreutils/stty.c	Fri Dec 21 22:00:29 2007
+++ busybox-1.9.0-stty/coreutils/stty.c	Sat Feb  2 18:55:40 2008
@@ -780,30 +780,14 @@
 
 static const struct mode_info *find_mode(const char *name)
 {
-	int i = 0;
-	const char *m = mode_name;
-
-	while (*m) {
-		if (strcmp(name, m) == 0)
-			return &mode_info[i];
-		m += strlen(m) + 1;
-		i++;
-	}
-	return NULL;
+	int i = index_in_strings(mode_name, name);
+	return i >= 0 ? &mode_info[i] : NULL;
 }
 
 static const struct control_info *find_control(const char *name)
 {
-	int i = 0;
-	const char *m = mode_name;
-
-	while (*m) {
-		if (strcmp(name, m) == 0)
-			return &control_info[i];
-		m += strlen(m) + 1;
-		i++;
-	}
-	return NULL;
+	int i = index_in_strings(control_name, name);
+	return i >= 0 ? &control_info[i] : NULL;
 }
 
 enum {