Browse Source

Print multiple commands per line in help

tags/v0.9.3
Michael Brown 17 years ago
parent
commit
6e46dddc2c
1 changed files with 12 additions and 2 deletions
  1. 12
    2
      src/hci/shell.c

+ 12
- 2
src/hci/shell.c View File

@@ -62,12 +62,22 @@ struct command exit_command __command = {
62 62
 /** "help" command body */
63 63
 static int help_exec ( int argc __unused, char **argv __unused ) {
64 64
 	struct command *command;
65
+	unsigned int hpos = 0;
65 66
 
66 67
 	printf ( "\nAvailable commands:\n\n" );
67 68
 	for ( command = commands ; command < commands_end ; command++ ) {
68
-		printf ( "  %s\n", command->name );
69
+		hpos += printf ( "  %s", command->name );
70
+		if ( hpos > ( 16 * 4 ) ) {
71
+			printf ( "\n" );
72
+			hpos = 0;
73
+		} else {
74
+			while ( hpos % 16 ) {
75
+				printf ( " " );
76
+				hpos++;
77
+			}
78
+		}
69 79
 	}
70
-	printf ( "\nType \"<command> --help\" for further information\n\n" );
80
+	printf ( "\n\nType \"<command> --help\" for further information\n\n" );
71 81
 	return 0;
72 82
 }
73 83
 

Loading…
Cancel
Save