I wasn't going to write this, but I couldn't help myself. Had to see how
it would turn out.

This version passes the current tests/tsort.test. It also correctly prints
a loop, e.g. if the input is:

a b
b c
c a
c d
d e

it prints:

tsort: input contains a loop:
a ->
b ->
c ->
a

Note that c -> d -> e are not part of a loop.

This runs really fast even on a million lines (if run through | cat > outfile).

Ray

Attachment: tsort.c
Description: Binary data

_______________________________________________
Toybox mailing list
Toybox@lists.landley.net
http://lists.landley.net/listinfo.cgi/toybox-landley.net

Reply via email to