diff options
author | John Beppu | 1999-12-22 23:02:12 +0000 |
---|---|---|
committer | John Beppu | 1999-12-22 23:02:12 +0000 |
commit | 568cb7b45f8ec1e0f6e6cad296c5431e66785a6b (patch) | |
tree | 4625d9aadc868432eff0a9a3ce8140fdd54b6255 /sort.c | |
parent | d19385e160593e45f1334f207a8f6ba3487ef188 (diff) | |
download | busybox-568cb7b45f8ec1e0f6e6cad296c5431e66785a6b.zip busybox-568cb7b45f8ec1e0f6e6cad296c5431e66785a6b.tar.gz |
oops.. qsort(2) misunderstanding on my part.
it's ok, now.
Diffstat (limited to 'sort.c')
-rw-r--r-- | sort.c | 29 |
1 files changed, 24 insertions, 5 deletions
@@ -1,5 +1,5 @@ /* - * Mini find implementation for busybox + * Mini sort implementation for busybox * * * Copyright (C) 1999 by Lineo, inc. @@ -107,12 +107,23 @@ line_release(Line *self) /* Comparison */ +/* ascii order */ static int compare_ascii(const void *a, const void *b) { - return 0; + Line **doh; + Line *x, *y; + + doh = (Line **) a; + x = (Line *) *doh; + doh = (Line **) b; + y = (Line *) *doh; + + // fprintf(stdout, "> %p: %s< %p: %s", x, x->data, y, y->data); + return strcmp(x->data, y->data); } +/* numeric order */ static int compare_numeric(const void *a, const void *b) { @@ -173,7 +184,7 @@ list_sort(List *self, Compare *compare) } /* apply qsort */ - qsort(self->sorted, sizeof(Line*), self->len, compare); + qsort(self->sorted, self->len, sizeof(Line*), compare); return self; } @@ -260,10 +271,18 @@ sort_main(int argc, char **argv) exit(0); } -/* $Id: sort.c,v 1.5 1999/12/22 22:27:01 beppu Exp $ */ +/* $Id: sort.c,v 1.6 1999/12/22 23:02:12 beppu Exp $ */ /* * $Log: sort.c,v $ + * Revision 1.6 1999/12/22 23:02:12 beppu + * oops.. qsort(2) misunderstanding on my part. + * it's ok, now. + * * Revision 1.5 1999/12/22 22:27:01 beppu - * playing w/ $Log$ + * playing w/ $Log: sort.c,v $ + * playing w/ Revision 1.6 1999/12/22 23:02:12 beppu + * playing w/ oops.. qsort(2) misunderstanding on my part. + * playing w/ it's ok, now. + * playing w/ * */ |