Index: trunk/Ohana/src/opihi/lib.shell/CommandOps.c
===================================================================
--- trunk/Ohana/src/opihi/lib.shell/CommandOps.c	(revision 14449)
+++ trunk/Ohana/src/opihi/lib.shell/CommandOps.c	(revision 16040)
@@ -130,4 +130,20 @@
 }
 
+void sort_commands (int *seq) {
+
+  int i;
+
+  for (i = 0; i < Ncommands; i++) seq[i] = i;
+
+# define SWAPFUNC(A,B){ int tmp = seq[A]; seq[A] = seq[B]; seq[B] = tmp; }
+# define COMPARE(A,B)(strcmp (commands[seq[A]].name, commands[seq[B]].name) < 0)
+
+  OHANA_SORT (Ncommands, COMPARE, SWAPFUNC);
+
+# undef SWAPFUNC
+# undef COMPARE
+  
+}
+
 void print_commands (FILE *f) {
 
@@ -143,39 +159,2 @@
   return;
 }
-
-void sort_commands (int *seq) {
-
-  int l,j,ir,i, N;
-  int temp;
-  
-  N = Ncommands;
-  for (i = 0; i < N; i++) 
-    seq[i] = i;
-  
-  l = N >> 1;
-  ir = N - 1;
-  for (;;) {
-    if (l > 0) {
-      temp = seq[--l];
-    }
-    else {
-      temp = seq[ir];
-      seq[ir] = seq[0];
-      if (--ir == 0) {
-        seq[0] = temp;
-        return;
-      }
-    }
-    i = l;
-    j = (l << 1) + 1;
-    while (j <= ir) {
-      if (j < ir && (strcmp (commands[seq[j]].name, commands[seq[j+1]].name) < 0)) ++j;
-      if (strcmp (commands[temp].name, commands[seq[j]].name) < 0) {
-        seq[i]=seq[j];
-        j += (i=j) + 1;
-      }
-      else j = ir + 1;
-    }
-    seq[i] = temp;
-  }
-}
