RECEIVEDIPDBUSORT(1) RECEIVEDIPDBUSORT(1) NAME receivedIPdbusort - sort the IP addresses in a database file SYNOPSIS receivedIPdbusort [-v] dbfilename DESCRIPTION ReceivedIPdbusort is for sorting a database of IP addresses-each IP address in the output will be unique. The program requires mmap(2) to map the database file of IP addresses into the Unix VM system. The database file name is a required command line argument. The database is a standard Unix text file, one IP address per line, in lexical order, constructed with "sort -u infile > outfile", or equiva- lent. An IP address range can be represented as a Class A, B, or C range. For example, the IP address "123.210." in the database file would match "123.210.1.0". The most common usage is where the input database, example.db, is a list of IP addresses, and the output file is a uniquely sorted list of IP addresses, out.db. receivedIPdbusort example.db > out.db. The sort mechanism is implemented as a quicksort. The program, also, eliminates duplicate records, (i.e., records that are lexically equal,) and removes leading and trailing white space in each record. The program contains less than 300 lines of declarations and state- ments, all of which are documented with in line comments. The program has been compiled and tested on SunOS, Solaris, and Linux, and may work on other brands of Unix. The program returns 0 if no error; else returns a unique error code greater than 1 representing the error encountered-which will, also, print an error diagnostic to stderr. OPTIONS dbfilename Database file name of IP addresses. -v Print the program's version information. WARNINGS Under buffer overflow conditions, the program makes no attempts at han- dling the situation-it just detects it, prints an error message, and exits. The program is capable of rejecting entire Class A, Class B, or Class C, IP address ranges. Discretion is advised. SEE ALSO receivedIP(1), receivedIPdb(1), receivedIPdbdedup(1), receivedIPdbrm(1), receivedIPdbusort(1), bsearchtext(1), receivedAd- dress(1), receivedTodb(1), receivedMSGIDdb(1), receivedUnknowndb(1), tolower(1), toupper(1), bsorttext(1) receivedIPforgedb(1), hsearch- text(1), bsearchbody(1) DIAGNOSTICS Error messages for incompatible arguments, failure to allocate memory, inaccessible files, opening and closing files. AUTHORS ---------------------------------------------------------------------- A license is hereby granted to reproduce this software source code and to create executable versions from this source code for personal, non-commercial use. The copyright notice included with the software must be maintained in all copies produced. THIS PROGRAM IS PROVIDED "AS IS". THE AUTHOR PROVIDES NO WARRANTIES WHATSOEVER, EXPRESSED OR IMPLIED, INCLUDING WARRANTIES OF MERCHANTABILITY, TITLE, OR FITNESS FOR ANY PARTICULAR PURPOSE. THE AUTHOR DOES NOT WARRANT THAT USE OF THIS PROGRAM DOES NOT INFRINGE THE INTELLECTUAL PROPERTY RIGHTS OF ANY THIRD PARTY IN ANY COUNTRY. Copyright (c) 2001-2007, John Conover, All Rights Reserved. Comments and/or bug reports should be addressed to: john@email.johncon.com (John Conover) ---------------------------------------------------------------------- January 16, 2007 RECEIVEDIPDBUSORT(1)