Date: Thu, 1 Aug 1996 20:54:25 +0200 (MET DST) From: "Ph. Charnier" <charnier@xp11.frmug.org> To: FreeBSD-gnats-submit@freebsd.org Subject: bin/1455: quiet option for tsort Message-ID: <199608011854.UAA00592@xp11.frmug.org> Resent-Message-ID: <199608012050.NAA27913@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 1455 >Category: bin >Synopsis: tsort does not support quiet (-q) option >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Class: change-request >Submitter-Id: current-users >Arrival-Date: Thu Aug 1 13:50:01 PDT 1996 >Last-Modified: >Originator: Ph. Charnier >Organization: ------ ------ Philippe Charnier charnier@lirmm.fr (smtp) charnier@xp11.frmug.org (uucp) ``a PC not running FreeBSD is like a venusian with no tentacles'' ------------------------------------------------------------------------ >Release: FreeBSD 2.2-CURRENT i386 >Environment: >Description: Here is the story: some times ago, I sent diffs to Sam Leffler to add dynamic linking for Tiff library under FreeBSD. As our tsort doesn't support -q, I made a separate entry. Sam merged FreeBSD and NetBSD entries, so this patch also update our version to NetBSD (and probably Lite2 because of the new sccsid) level. I also added a () to silent gcc -Wall. >How-To-Repeat: >Fix: cvs diff: Diffing . Index: tsort.1 =================================================================== RCS file: /home2h/FreeBSD.cvsroot/src/usr.bin/tsort/tsort.1,v retrieving revision 1.2 diff -u -r1.2 tsort.1 --- tsort.1 1996/06/10 16:12:42 1.2 +++ tsort.1 1996/08/01 18:21:52 @@ -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 @@ .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 Index: tsort.c =================================================================== RCS file: /home2h/FreeBSD.cvsroot/src/usr.bin/tsort/tsort.c,v retrieving revision 1.3 diff -u -r1.3 tsort.c --- tsort.c 1996/06/10 16:12:43 1.3 +++ tsort.c 1996/08/01 18:39:14 @@ -43,7 +43,7 @@ #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 @@ * 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 @@ 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 @@ 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 @@ case 'l': longest = 1; break; + case 'q': + quiet = 1; + break; case '?': default: usage(); @@ -337,11 +340,13 @@ } 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 @@ void usage() { - (void)fprintf(stderr, "usage: tsort [-dl] [file]\n"); + (void)fprintf(stderr, "usage: tsort [-dlq] [file]\n"); exit(1); } >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199608011854.UAA00592>