diff options
author | jkh <jkh@FreeBSD.org> | 1996-08-02 04:50:44 +0000 |
---|---|---|
committer | jkh <jkh@FreeBSD.org> | 1996-08-02 04:50:44 +0000 |
commit | 6d6a5bd8e18385ece6b7f53423e560479bc9b796 (patch) | |
tree | e427e9ed61cf946d3661078ba3e2cea69726c63b /usr.bin | |
parent | ed8692f3773d3a8caf2bca3b31b3fd619cf4e836 (diff) | |
download | FreeBSD-src-6d6a5bd8e18385ece6b7f53423e560479bc9b796.zip FreeBSD-src-6d6a5bd8e18385ece6b7f53423e560479bc9b796.tar.gz |
Close PR#1455. In a couple of weeks, I'll change bsd.lib.mk to use
tsort -q as well - I don't feel like adding tsort as Yet Another Item to the
bootstrap target.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/tsort/tsort.1 | 5 | ||||
-rw-r--r-- | usr.bin/tsort/tsort.c | 27 |
2 files changed, 21 insertions, 11 deletions
diff --git a/usr.bin/tsort/tsort.1 b/usr.bin/tsort/tsort.1 index fb6fa32..3b57da5b 100644 --- a/usr.bin/tsort/tsort.1 +++ b/usr.bin/tsort/tsort.1 @@ -44,6 +44,7 @@ .Nm tsort .Op Fl d .Op Fl l +.Op Fl q .Op Ar file .Sh DESCRIPTION .Nm Tsort @@ -72,6 +73,10 @@ Turn on debugging. .It Fl l Search for and display the longest cycle. Can take a very long time. +.It Fl q +Do not display informational messages about cycles. This is primarily +intended for building libraries, where optimal ordering is not critical, +and cycles occur often. .El .Sh SEE ALSO .Xr ar 1 diff --git a/usr.bin/tsort/tsort.c b/usr.bin/tsort/tsort.c index 0ad452c..37ce856 100644 --- a/usr.bin/tsort/tsort.c +++ b/usr.bin/tsort/tsort.c @@ -33,7 +33,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id$ + * $Id: tsort.c,v 1.3 1996/06/10 16:12:43 phk Exp $ */ #ifndef lint @@ -43,7 +43,7 @@ static char copyright[] = #endif /* not lint */ #ifndef lint -static char sccsid[] = "@(#)tsort.c 8.2 (Berkeley) 3/30/94"; +static char sccsid[] = "@(#)tsort.c 8.3 (Berkeley) 5/4/95"; #endif /* not lint */ #include <sys/types.h> @@ -63,7 +63,7 @@ static char sccsid[] = "@(#)tsort.c 8.2 (Berkeley) 3/30/94"; * standard output in sorted order, one per line. * * usage: - * tsort [-l] [inputfile] + * tsort [-dlq] [inputfile] * If no input file is specified, standard input is read. * * Should be compatable with AT&T tsort HOWEVER the output is not identical @@ -100,7 +100,7 @@ typedef struct _buf { DB *db; NODE *graph, **cycle_buf, **longest_cycle; -int debug, longest; +int debug, longest, quiet; void add_arc __P((char *, char *)); int find_cycle __P((NODE *, NODE *, int, int)); @@ -121,7 +121,7 @@ main(argc, argv) int bsize, ch, nused; BUF bufs[2]; - while ((ch = getopt(argc, argv, "dl")) != EOF) + while ((ch = getopt(argc, argv, "dlq")) != EOF) switch (ch) { case 'd': debug = 1; @@ -129,6 +129,9 @@ main(argc, argv) case 'l': longest = 1; break; + case 'q': + quiet = 1; + break; case '?': default: usage(); @@ -337,11 +340,13 @@ tsort() } for (n = graph; n != NULL; n = n->n_next) if (!(n->n_flags & NF_ACYCLIC)) - if (cnt = find_cycle(n, n, 0, 0)) { - warnx("cycle in data"); - for (i = 0; i < cnt; i++) - warnx("%s", - longest_cycle[i]->n_name); + if ((cnt = find_cycle(n, n, 0, 0))) { + if (!quiet) { + warnx("cycle in data"); + for (i = 0; i < cnt; i++) + warnx("%s", + longest_cycle[i]->n_name); + } remove_node(n); clear_cycle(); break; @@ -426,6 +431,6 @@ find_cycle(from, to, longest_len, depth) void usage() { - (void)fprintf(stderr, "usage: tsort [-dl] [file]\n"); + (void)fprintf(stderr, "usage: tsort [-dlq] [file]\n"); exit(1); } |