/* $Id: qdsort.cc 1995 2007-02-15 20:29:44Z flaterco $ qdsort -- Quick and dirty replacement for sort. The purpose of this filter is to provide semi-intelligent sorting of text files using the Latin-1 character set. None of the switches of the Unix sort program are supported. Requires libdstr, available from http://www.flaterco.com/util/index.html. g++ -Wall -Wextra -pedantic -O2 -s -o qdsort qdsort.cc -ldstr Usage: qdsort < input.txt > output.txt Obsoletes qdsort.c 2005-05-06 */ #include #include #include #include #include int main (int argc, char **argv __attribute__ ((unused))) { std::vector buf; Dstr lineBuf; if (argc > 1) { fprintf (stderr, "Usage: qdsort < input.txt > output.txt\n"); exit (-1); } while (!lineBuf.getline(stdin).isNull()) buf.push_back (lineBuf); std::sort (buf.begin(), buf.end(), InsensitiveOrdering); for (std::vector::iterator it (buf.begin()); it != buf.end(); ++it) printf ("%s\n", it->aschar()); return 0; }