Annotation of src/usr.bin/tsort/tsort.1, Revision 1.6
1.6 ! aaron 1: .\" $OpenBSD: tsort.1,v 1.5 2000/03/04 22:19:27 aaron Exp $
1.2 deraadt 2: .\" $NetBSD: tsort.1,v 1.6 1996/01/17 20:37:49 mycroft Exp $
1.1 deraadt 3: .\"
4: .\" Copyright (c) 1990, 1993, 1994
5: .\" The Regents of the University of California. All rights reserved.
6: .\"
7: .\" This manual is derived from one contributed to Berkeley by
8: .\" Michael Rendell of Memorial University of Newfoundland.
9: .\"
10: .\" Redistribution and use in source and binary forms, with or without
11: .\" modification, are permitted provided that the following conditions
12: .\" are met:
13: .\" 1. Redistributions of source code must retain the above copyright
14: .\" notice, this list of conditions and the following disclaimer.
15: .\" 2. Redistributions in binary form must reproduce the above copyright
16: .\" notice, this list of conditions and the following disclaimer in the
17: .\" documentation and/or other materials provided with the distribution.
18: .\" 3. All advertising materials mentioning features or use of this software
19: .\" must display the following acknowledgement:
20: .\" This product includes software developed by the University of
21: .\" California, Berkeley and its contributors.
22: .\" 4. Neither the name of the University nor the names of its contributors
23: .\" may be used to endorse or promote products derived from this software
24: .\" without specific prior written permission.
25: .\"
26: .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27: .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28: .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29: .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30: .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31: .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32: .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33: .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34: .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35: .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36: .\" SUCH DAMAGE.
37: .\"
38: .\" @(#)tsort.1 8.3 (Berkeley) 4/1/94
39: .\"
40: .Dd April 1, 1994
41: .Dt TSORT 1
42: .Os
43: .Sh NAME
44: .Nm tsort
45: .Nd topological sort of a directed graph
46: .Sh SYNOPSIS
47: .Nm tsort
48: .Op Fl l
1.2 deraadt 49: .Op Fl q
1.1 deraadt 50: .Op Ar file
51: .Sh DESCRIPTION
1.6 ! aaron 52: .Nm
1.1 deraadt 53: takes a list of pairs of node names representing directed arcs in
54: a graph and prints the nodes in topological order on standard output.
55: Input is taken from the named
56: .Ar file ,
57: or from standard input if no file
58: is given.
59: .Pp
1.5 aaron 60: Node names in the input are separated by whitespace and there must
1.1 deraadt 61: be an even number of node pairs.
62: .Pp
63: Presence of a node in a graph can be represented by an arc from the node
64: to itself.
65: This is useful when a node is not connected to any other nodes.
66: .Pp
67: If the graph contains a cycle (and therefore cannot be properly sorted),
68: one of the arcs in the cycle is ignored and the sort continues.
69: Cycles are reported on standard error.
70: .Pp
71: The options are as follows:
72: .Bl -tag -width Ds
1.2 deraadt 73: .It Fl l
1.1 deraadt 74: Search for and display the longest cycle.
75: Can take a very long time.
1.2 deraadt 76: .It Fl q
1.6 ! aaron 77: Do not display informational messages about cycles.
! 78: This is primarily
1.2 deraadt 79: intended for building libraries, where optimal ordering is not critical,
80: and cycles occur often.
1.1 deraadt 81: .El
82: .Sh SEE ALSO
83: .Xr ar 1
84: .Sh HISTORY
85: A
86: .Nm
87: command appeared in
88: .At v7 .
89: This
1.6 ! aaron 90: .Nm
1.1 deraadt 91: command and manual page are derived from sources contributed to Berkeley by
92: Michael Rendell of Memorial University of Newfoundland.