svn commit: trunk/busybox/coreutils

Bernhard Fischer rep.dot.nop at gmail.com
Thu Apr 19 22:04:24 UTC 2007


On Thu, Apr 19, 2007 at 12:55:55PM -0700, vda at busybox.net wrote:
>Author: vda
>Date: 2007-04-19 12:55:54 -0700 (Thu, 19 Apr 2007)
>New Revision: 18499

>Changeset:
>Modified: trunk/busybox/coreutils/stty.c
>===================================================================
>--- trunk/busybox/coreutils/stty.c	2007-04-19 17:26:34 UTC (rev 18498)
>+++ trunk/busybox/coreutils/stty.c	2007-04-19 19:55:54 UTC (rev 18499)
>@@ -550,24 +550,25 @@
> 
> enum {
> 	param_need_arg = 0x80,
>-	param_line   = 1 | 0x80,
>-	param_rows   = 2 | 0x80,
>-	param_cols   = 3 | 0x80,
>-	param_size   = 4,
>-	param_speed  = 5,
>-	param_ispeed = 6 | 0x80,
>-	param_ospeed = 7 | 0x80,
>+	param_line    = 1 | 0x80,
>+	param_rows    = 2 | 0x80,
>+	param_cols    = 3 | 0x80,
>+	param_columns = 4 | 0x80,
>+	param_size    = 5,
>+	param_speed   = 6,
>+	param_ispeed  = 7 | 0x80,
>+	param_ospeed  = 8 | 0x80,
> };
> 
> static int find_param(const char * const name)
> {
> 	static const char * const params[] = {
>-		"line",
>-		"rows",
>-		"cols",
>-		"columns",
>-		"size",  /* 4 */
>-		"speed", /* 5 */
>+		"line",     /* 1 */
>+		"rows",     /* 2 */
>+		"cols",     /* 3 */
>+		"columns",  /* 4 */
>+		"size",     /* 5 */
>+		"ispeed"+1, /* 6 */
> 		"ispeed",

Can you please explain the +1 here?
It is not immediately obvious to me.
thanks,

> 		"ospeed",
> 		NULL
>@@ -575,9 +576,8 @@
> 	int i = index_in_str_array(params, name) + 1;
> 	if (i == 0)
> 		return 0;
>-	if (!(i == 4 || i == 5))
>+	if (i != 5 && i != 6)
> 		i |= 0x80;
>-
> 	return i;
> }
> 
>@@ -1014,6 +1014,7 @@
> #ifdef TIOCGWINSZ
> 		case param_rows:
> 		case param_cols:
>+		case param_columns:
> 			xatoul_range_sfx(argnext, 1, INT_MAX, stty_suffixes);
> 			break;
> 		case param_size:
>



More information about the busybox mailing list