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
11
13 tsort — topological sort
14
16 tsort [file]
17
19 The tsort utility shall write to standard output a totally ordered list
20 of items consistent with a partial ordering of items contained in the
21 input.
22
23 The application shall ensure that the input consists of pairs of items
24 (non-empty strings) separated by <blank> characters. Pairs of different
25 items indicate ordering. Pairs of identical items indicate presence,
26 but not ordering.
27
29 None.
30
32 The following operand shall be supported:
33
34 file A pathname of a text file to order. If no file operand is
35 given, the standard input shall be used.
36
38 The standard input shall be used if no file operand is specified, and
39 shall be used if the file operand is '−' and the implementation treats
40 the '−' as meaning standard input. Otherwise, the standard input shall
41 not be used. See the INPUT FILES section.
42
44 The input file shall be a text file.
45
47 The following environment variables shall affect the execution of
48 tsort:
49
50 LANG Provide a default value for the internationalization vari‐
51 ables that are unset or null. (See the Base Definitions vol‐
52 ume of POSIX.1‐2008, Section 8.2, Internationalization Vari‐
53 ables for the precedence of internationalization variables
54 used to determine the values of locale categories.)
55
56 LC_ALL If set to a non-empty string value, override the values of
57 all the other internationalization variables.
58
59 LC_CTYPE Determine the locale for the interpretation of sequences of
60 bytes of text data as characters (for example, single-byte as
61 opposed to multi-byte characters in arguments and input
62 files).
63
64 LC_MESSAGES
65 Determine the locale that should be used to affect the format
66 and contents of diagnostic messages written to standard
67 error.
68
69 NLSPATH Determine the location of message catalogs for the processing
70 of LC_MESSAGES.
71
73 Default.
74
76 The standard output shall be a text file consisting of the order list
77 produced from the partially ordered input.
78
80 The standard error shall be used only for diagnostic messages.
81
83 None.
84
86 None.
87
89 The following exit values shall be returned:
90
91 0 Successful completion.
92
93 >0 An error occurred.
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 tsort <<EOF
109 a b c c d e
110 g g
111 f g e f
112 h h
113 EOF
114
115 produces the output:
116
117 a
118 b
119 c
120 d
121 e
122 f
123 g
124 h
125
127 None.
128
130 None.
131
133 The Base Definitions volume of POSIX.1‐2008, Chapter 8, Environment
134 Variables
135
137 Portions of this text are reprinted and reproduced in electronic form
138 from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
139 -- Portable Operating System Interface (POSIX), The Open Group Base
140 Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
141 cal and Electronics Engineers, Inc and The Open Group. (This is
142 POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) 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.unix.org/online.html .
147
148 Any typographical or formatting errors that appear in this page are
149 most likely to have been introduced during the conversion of the source
150 files to man page format. To report such errors, see https://www.ker‐
151 nel.org/doc/man-pages/reporting_bugs.html .
152
153
154
155IEEE/The Open Group 2013 TSORT(1P)