The Single UNIX ® Specification, Version 2
Copyright © 1997 The Open Group

 NAME

tsort - topological sort

 SYNOPSIS



tsort [file]

 DESCRIPTION

The tsort utility writes to standard output a totally ordered list of items consistent with a partial ordering of items contained in the input.

The input consists of pairs of items (non-empty strings) separated by blanks. Pairs of different items indicate ordering. Pairs of identical items indicate presence, but not ordering.

 OPTIONS

None.

 OPERANDS

The following operand is supported:
file
A pathname of a text file to order. If no file operand is given, the standard input is used.

 STDIN

The standard input is a text file that is used if no file operand is given.

 INPUT FILES

The input file named by the file operand is a text file.

 ENVIRONMENT VARIABLES

The following environment variables affect the execution of tsort:
LANG
Provide a default value for the internationalisation variables that are unset or null. If LANG is unset or null, the corresponding value from the implementation-dependent default locale will be used. If any of the internationalisation variables contains an invalid setting, the utility will behave as if none of the variables had been defined.
LC_ALL
If set to a non-empty string value, override the values of all the other internationalisation variables.
LC_CTYPE
Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single- as opposed to multi-byte characters in arguments and input files).
LC_MESSAGES
Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error.
NLSPATH
Determine the location of message catalogues for the processing of LC_MESSAGES .

 ASYNCHRONOUS EVENTS

Default.

 STDOUT

The standard output is a text file consisting of the order list produced from the partially ordered input.

 STDERR

Used only for diagnostic messages.

 OUTPUT FILES

None.

 EXTENDED DESCRIPTION

None.

 EXIT STATUS

The following exit values are returned:
0
Successful completion.
>0
An error occurred.

 CONSEQUENCES OF ERRORS

Default.

 APPLICATION USAGE

The LC_COLLATE variable need not affect the actions of tsort. The output ordering is not lexicographic, but depends on the pairs of items given as input.

 EXAMPLES

The command:

tsort <<EOF
a b c c d e
g g
f g e f
h h
EOF

produces the output:


a
b
c
d
e
f
g
h

 FUTURE DIRECTIONS

None.

 SEE ALSO

None.

UNIX ® is a registered Trademark of The Open Group.
Copyright © 1997 The Open Group
[ Main Index | XSH | XCU | XBD | XCURSES | XNS ]