X-Git-Url: http://git.asbjorn.biz/?p=debian%2Fdhcpd-pools.git;a=blobdiff_plain;f=src%2Fsort.c;h=e436f5a08998ed9f772f0b5be30e736d8afa5786;hp=40ecad4e8514b4df1a41676f05ed17956f180143;hb=HEAD;hpb=849c8f5e73d671c7f9e3f74f0652a0876d7a2787 diff --git a/src/sort.c b/src/sort.c index 40ecad4..e436f5a 100644 --- a/src/sort.c +++ b/src/sort.c @@ -1,19 +1,18 @@ -/* -** Copyright (C) 2006- Sami Kerola -** -** This program is free software; you can redistribute it and/or modify +/* http://dhcpd-pools.sourceforge.net/ +** Copyright 2006- Sami Kerola +** +** 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 Free Software Foundation; either version 2 of the License, or +** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. -** +** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. -** +** ** You should have received a copy of the GNU General Public License -** along with this program; if not, write to the Free Software -** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** along with this program. If not, see . */ #ifdef HAVE_CONFIG_H @@ -23,10 +22,10 @@ #include #include #include +#include #include #include "dhcpd-pools.h" -#include "defaults.h" /* Sort functions for range sorting */ int intcomp(const void *x, const void *y) @@ -117,9 +116,9 @@ void field_selector(char c) returner = ret_tcperc; break; default: - errx(EXIT_FAILURE, - "field_selector: unknown sort order `%c'", - config.sort[0]); + warnx("field_selector: unknown sort order `%c'", c); + errx(EXIT_FAILURE, "Try `%s --help' for more information.", + program_invocation_short_name); } } @@ -167,6 +166,8 @@ void mergesort_ranges(struct range_t *orig, int size, struct range_t *temp) { int left, right, i; struct range_t hold; + /* Merge sort split size */ + static const int MIN_MERGE_SIZE = 8; if (size < MIN_MERGE_SIZE) { for (left = 0; left < size; left++) {