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