-#include <errno.h>
-
-static const char uniq_usage[] =
-"Usage: uniq [OPTION]... [INPUT [OUTPUT]]\n"
-"Discard all but one of successive identical lines from INPUT (or\n"
-"standard input), writing to OUTPUT (or standard output).\n"
-"\n"
-"\t-h\tdisplay this help and exit\n"
-"\n"
-"A field is a run of whitespace, then non-whitespace characters.\n"
-"Fields are skipped before chars.\n"
-;
-
-/* max chars in line */
-#define UNIQ_MAX 4096
-
-typedef void (Print)(FILE *, const char *);
-
-typedef int (Decide)(const char *, const char *);
-
-/* container for two lines to be compared */
-typedef struct {
- char *a;
- char *b;
- int recurrence;
- FILE *in;
- FILE *out;
- void *func;
-} Subject;
-
-/* set up all the variables of a uniq operation */
-static Subject *
-subject_init(Subject *self, FILE *in, FILE *out, void *func)
-{
- self->a = NULL;
- self->b = NULL;
- self->in = in;
- self->out = out;
- self->func = func;
- self->recurrence = 0;
- return self;
-}
-
-/* point a and b to the appropriate lines;
- * count the recurrences (if any) of a string;
- */
-static Subject *
-subject_next(Subject *self)
-{
- /* tmp line holders */
- static char line[2][UNIQ_MAX];
- static int alternator = 0;
-
- if (fgets(line[alternator], UNIQ_MAX, self->in)) {
- self->a = self->b;
- self->b = line[alternator];
- alternator ^= 1;
- return self;
- }