X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fsn-apply.c;h=24f01d70a2d650a8791e234b69c4b1529494e727;hb=8764b3122abba9e60cacb591f16a5e71abb5155f;hp=47930978456a77a03a48895baade6806a8cef498;hpb=ca174a94bbc1fc36688a3e130665a64a9dc1690b;p=sort-networks.git diff --git a/src/sn-apply.c b/src/sn-apply.c index 4793097..24f01d7 100644 --- a/src/sn-apply.c +++ b/src/sn-apply.c @@ -1,6 +1,6 @@ /** - * collectd - src/sn-apply.c - * Copyright (C) 2008 Florian octo Forster + * libsortnetwork - src/sn-apply.c + * Copyright (C) 2008-2010 Florian octo Forster * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -16,11 +16,10 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * * Authors: - * Florian octo Forster + * Florian octo Forster **/ -#define _ISOC99_SOURCE -#define _POSIX_C_SOURCE 200112L +#include "config.h" #include #include @@ -49,7 +48,7 @@ static void exit_usage (const char *name) " -i File holding the network (REQUIRED)\n" "\n", name); - exit (1); + exit (EXIT_FAILURE); } /* void exit_usage */ int read_options (int argc, char **argv) @@ -138,23 +137,9 @@ static int show_sort (int *values) for (i = 0; i < stages_num; i++) { sn_stage_t *s; - int j; s = SN_NETWORK_STAGE_GET (network, i); - - for (j = 0; j < SN_STAGE_COMP_NUM (s); j++) - { - sn_comparator_t *c; - - c = SN_STAGE_COMP_GET (s, j); - - if (values[c->min] > values[c->max]) - { - int temp = values[c->min]; - values[c->min] = values[c->max]; - values[c->max] = temp; - } - } /* for (comparators) */ + sn_stage_sort (s, values); show_values (SN_NETWORK_INPUT_NUM (network), values); } /* for (stages) */ @@ -207,8 +192,8 @@ int main (int argc, char **argv) } if (status < 0) - return (1); - return (0); + exit (EXIT_FAILURE); + exit (EXIT_SUCCESS); } /* int main */ /* vim: set shiftwidth=2 softtabstop=2 : */