1TSORT(P) POSIX Programmer's Manual TSORT(P)
2
3
4
6 tsort - topological sort
7
9 tsort [file]
10
12 The tsort utility shall write to standard output a totally ordered list
13 of items consistent with a partial ordering of items contained in the
14 input.
15
16 The application shall ensure that the input consists of pairs of items
17 (non-empty strings) separated by <blank>s. Pairs of different items
18 indicate ordering. Pairs of identical items indicate presence, but not
19 ordering.
20
22 None.
23
25 The following operand shall be supported:
26
27 file A pathname of a text file to order. If no file operand is given,
28 the standard input shall be used.
29
30
32 The standard input shall be a text file that is used if no file operand
33 is given.
34
36 The input file named by the file operand is a text file.
37
39 The following environment variables shall affect the execution of
40 tsort:
41
42 LANG Provide a default value for the internationalization variables
43 that are unset or null. (See the Base Definitions volume of
44 IEEE Std 1003.1-2001, Section 8.2, Internationalization Vari‐
45 ables for the precedence of internationalization variables used
46 to determine the values of locale categories.)
47
48 LC_ALL If set to a non-empty string value, override the values of all
49 the other internationalization variables.
50
51 LC_CTYPE
52 Determine the locale for the interpretation of sequences of
53 bytes of text data as characters (for example, single-byte as
54 opposed to multi-byte characters in arguments and input files).
55
56 LC_MESSAGES
57 Determine the locale that should be used to affect the format
58 and contents of diagnostic messages written to standard error.
59
60 NLSPATH
61 Determine the location of message catalogs for the processing of
62 LC_MESSAGES .
63
64
66 Default.
67
69 The standard output shall be a text file consisting of the order list
70 produced from the partially ordered input.
71
73 The standard error shall be used only for diagnostic messages.
74
76 None.
77
79 None.
80
82 The following exit values shall be returned:
83
84 0 Successful completion.
85
86 >0 An error occurred.
87
88
90 Default.
91
92 The following sections are informative.
93
95 The LC_COLLATE variable need not affect the actions of tsort. The out‐
96 put ordering is not lexicographic, but depends on the pairs of items
97 given as input.
98
100 The command:
101
102
103 tsort <<EOF
104 a b c c d e
105 g g
106 f g e f
107 h h
108 EOF
109
110 produces the output:
111
112
113 a
114 b
115 c
116 d
117 e
118 f
119 g
120 h
121
123 None.
124
126 None.
127
129 None.
130
132 Portions of this text are reprinted and reproduced in electronic form
133 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
134 -- Portable Operating System Interface (POSIX), The Open Group Base
135 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
136 Electrical and Electronics Engineers, Inc and The Open Group. In the
137 event of any discrepancy between this version and the original IEEE and
138 The Open Group Standard, the original IEEE and The Open Group Standard
139 is the referee document. The original Standard can be obtained online
140 at http://www.opengroup.org/unix/online.html .
141
142
143
144IEEE/The Open Group 2003 TSORT(P)