svn commit: trunk/busybox/coreutils

vda at busybox.net vda at busybox.net
Sun Jan 27 23:24:32 UTC 2008


Author: vda
Date: 2008-01-27 15:24:31 -0800 (Sun, 27 Jan 2008)
New Revision: 20912

Log:
stty: fix mishandling of 'control' keywords (Ralf Friedl <Ralf.Friedl at online.de>)



Modified:
   trunk/busybox/coreutils/stty.c


Changeset:
Modified: trunk/busybox/coreutils/stty.c
===================================================================
--- trunk/busybox/coreutils/stty.c	2008-01-27 22:40:39 UTC (rev 20911)
+++ trunk/busybox/coreutils/stty.c	2008-01-27 23:24:31 UTC (rev 20912)
@@ -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 {




More information about the busybox-cvs mailing list