summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2010-11-18 19:34:58 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2010-11-18 19:34:58 +0800
commitebe78b93280787d4b019493e72df8e8fa1e17eb6 (patch)
treeec9b7acc50c04eff15d5ebf07fde0ba2c94ca0cc
parentc3367722772e1cde28591104b731b603ab5e4b84 (diff)
downloadpttbbs-ebe78b93280787d4b019493e72df8e8fa1e17eb6.tar
pttbbs-ebe78b93280787d4b019493e72df8e8fa1e17eb6.tar.gz
pttbbs-ebe78b93280787d4b019493e72df8e8fa1e17eb6.tar.bz2
pttbbs-ebe78b93280787d4b019493e72df8e8fa1e17eb6.tar.lz
pttbbs-ebe78b93280787d4b019493e72df8e8fa1e17eb6.tar.xz
pttbbs-ebe78b93280787d4b019493e72df8e8fa1e17eb6.tar.zst
pttbbs-ebe78b93280787d4b019493e72df8e8fa1e17eb6.zip
refine toplazyBM output
git-svn-id: http://opensvn.csie.org/pttbbs/trunk@5266 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--pttbbs/util/toplazyBM.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/pttbbs/util/toplazyBM.c b/pttbbs/util/toplazyBM.c
index af26f8b1..0b712779 100644
--- a/pttbbs/util/toplazyBM.c
+++ b/pttbbs/util/toplazyBM.c
@@ -59,9 +59,18 @@ int need_alert(int days) {
int bmlostdays_cmp(const void *va, const void *vb)
{
lostbm *a=(lostbm *)va, *b=(lostbm *)vb;
- if (a->lostdays > b->lostdays) return -1;
- else if (a->lostdays == b->lostdays) return 0;
- else return 1;
+ int r;
+
+ if (a->lostdays != b->lostdays)
+ return (a->lostdays > b->lostdays) ? -1 : 1;
+ // same lost days, let's sort by category -> board -> userid
+ r = strncmp(a->ctitle, b->ctitle, 4);
+ if (r != 0)
+ return r;
+ r = strcmp(a->title, b->title);
+ if (r != 0)
+ return r;
+ return strcmp(a->bmname, b->bmname);
}
int main(int argc, char *argv[])