summaryrefslogtreecommitdiff
path: root/release/sysinstall/command.c
diff options
context:
space:
mode:
authorJordan K. Hubbard <jkh@FreeBSD.org>1995-11-04 11:09:16 +0000
committerJordan K. Hubbard <jkh@FreeBSD.org>1995-11-04 11:09:16 +0000
commit4a461b9185b5274a48105c04ecaf5cd8a57cef46 (patch)
tree89450a5443afcb79d4f11408029ba2cb9f85d00c /release/sysinstall/command.c
parent4497f6e3b0f2386f5a9a4970d00b1631a60fd2fd (diff)
Notes
Diffstat (limited to 'release/sysinstall/command.c')
-rw-r--r--release/sysinstall/command.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/release/sysinstall/command.c b/release/sysinstall/command.c
index 1fad8d2e4114..43ebe4b993c5 100644
--- a/release/sysinstall/command.c
+++ b/release/sysinstall/command.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: command.c,v 1.11.4.1 1995/07/21 11:45:35 rgrimes Exp $
+ * $Id: command.c,v 1.11.4.2 1995/09/18 17:00:14 peter Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -125,15 +125,27 @@ command_func_add(char *key, commandFunc func, void *data)
/* arg to sort */
static int
-sort_compare(const void *p1, const void *p2)
+sort_compare(Command *p1, Command *p2)
{
- return strcmp(((Command *)p1)->key, ((Command *)p2)->key);
+ return strcmp(p1->key, p2->key);
}
void
command_sort(void)
{
- qsort(commandStack, numCommands, sizeof(Command *), sort_compare);
+ int i, j;
+
+ /* Just do a crude bubble sort since the list is small */
+ for (i = 0; i < numCommands; i++) {
+ for (j = 0; j < numCommands; j++) {
+ if (sort_compare(commandStack[j], commandStack[j + 1]) > 0) {
+ Command *tmp = commandStack[j];
+
+ commandStack[j] = commandStack[j + 1];
+ commandStack[j + 1] = tmp;
+ }
+ }
+ }
}
/* Run all accumulated commands in sorted order */