sorry Jer
ok so im playing with qsort ey?
why not gota start sometime. anyway heres the bugger.

#0  0x400507f9 in msort_with_tmp (b=0x80ff054, n=20, s=20, cmp=0x8098410
<srt_cmds>, t=0x813aab8 "\e\030\020\b\237\005\b\b")
    at ../sysdeps/i386/i486/bits/string.h:121
121     ../sysdeps/i386/i486/bits/string.h: No such file or directory.
        in ../sysdeps/i386/i486/bits/string.h

string.h tells me alot. heres the code.

int srt_cmds(const void *p1, const void *p2)
{
 const struct cmd_type cmd1 = *(struct cmd_type *)p1; //gimme somthing to
//look at
 const struct cmd_type cmd2 = *(struct cmd_type *)p2; //just plain simple

  if (cmd1.name == NULL) return 2; //null'em
    else
  if (cmd2.name == NULL) return 1; //null'em

  return ( strcmp( cmd1.name, cmd2.name ) ); //puke
}

void sort_commands(void)
{
 int cmd; // bla

   for (cmd=0; cmd_table[cmd].name != NULL && cmd_table[cmd].name[0] !=
'\0'; cmd++) // countem
   if (cmd_table[cmd].name == NULL) break; //if all else fails

 logf("Number of useless commands i have %d.", cmd); // What this
mean Edwin?

 qsort((void *)cmd_table, //Yar!
       cmd,//count
       sizeof(cmd_table[0]), //size
       srt_cmds); // sort
}




Reply via email to