static struct item *head;
/* A scratch variable. */
-static struct item *r = NULL;
+static struct item *rr = NULL;
/* The number of strings to sort. */
-static int n = 0;
+static int n_strings = 0;
static struct option const long_options[] =
{
static void
count_items (struct item *k)
{
- n++;
+ n_strings++;
}
static void
{
if (k->count == 0)
{
- if (r == NULL)
+ if (rr == NULL)
head = k;
else
- r->qlink = k;
+ rr->qlink = k;
- r = k;
+ rr = k;
}
}
return read_pos - *lineptr;
}
+/* FIXME: describe */
static void
-sort (const char *file)
+tsort (const char *file)
{
struct item *root;
struct item *j = NULL;
/* T5. Output front of queue. */
printf ("%s\n", head->str);
- n--;
+ n_strings--;
/* T6. Erase relations. */
while (p)
p->suc->count--;
if (p->suc->count == 0)
{
- r->qlink = p->suc;
- r = p->suc;
+ rr->qlink = p->suc;
+ rr = p->suc;
}
p = p->next;
}
/* T8. End of process. */
- assert (n >= 0);
- if (n > 0)
+ assert (n_strings >= 0);
+ if (n_strings > 0)
{
if (have_read_stdin)
fprintf (stderr, _("%s: input contains a loop:\n"), program_name);
}
if (optind < argc)
- sort (argv[optind]);
+ tsort (argv[optind]);
else
- sort ("-");
+ tsort ("-");
if (fclose (stdout) == EOF)
error (EXIT_FAILURE, errno, _("write error"));