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> characters. Pairs of different
24 items indicate ordering. Pairs of identical items indicate presence,
25 but not 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
34 given, the standard input shall be used.
35
37 The standard input shall be used if no file operand is specified, and
38 shall be used if the file operand is '-' and the implementation treats
39 the '-' as meaning standard input. Otherwise, the standard input shall
40 not be used. See the INPUT FILES section.
41
43 The input file shall be a text file.
44
46 The following environment variables shall affect the execution of
47 tsort:
48
49 LANG Provide a default value for the internationalization vari‐
50 ables that are unset or null. (See the Base Definitions vol‐
51 ume of POSIX.1‐2017, Section 8.2, Internationalization Vari‐
52 ables for the precedence of internationalization variables
53 used to determine the values of locale categories.)
54
55 LC_ALL If set to a non-empty string value, override the values of
56 all the other internationalization variables.
57
58 LC_CTYPE 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
61 files).
62
63 LC_MESSAGES
64 Determine the locale that should be used to affect the format
65 and contents of diagnostic messages written to standard
66 error.
67
68 NLSPATH Determine the location of message catalogs for the processing
69 of LC_MESSAGES.
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
95 Default.
96
97 The following sections are informative.
98
100 The LC_COLLATE variable need not affect the actions of tsort. The out‐
101 put ordering is not lexicographic, but depends on the pairs of items
102 given as input.
103
105 The command:
106
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
118 a
119 b
120 c
121 d
122 e
123 f
124 g
125 h
126
128 None.
129
131 None.
132
134 The Base Definitions volume of POSIX.1‐2017, Chapter 8, Environment
135 Variables
136
138 Portions of this text are reprinted and reproduced in electronic form
139 from IEEE Std 1003.1-2017, Standard for Information Technology -- Por‐
140 table Operating System Interface (POSIX), The Open Group Base Specifi‐
141 cations Issue 7, 2018 Edition, Copyright (C) 2018 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 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 2017 TSORT(1P)