From charnier@xp11.frmug.org  Thu Aug  1 13:45:18 1996
Received: from frmug.org (frmug-gw.frmug.org [193.56.58.252])
          by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id NAA25510
          for <FreeBSD-gnats-submit@freebsd.org>; Thu, 1 Aug 1996 13:45:15 -0700 (PDT)
Received: (from uucp@localhost) by frmug.org (8.6.8/8.6.9) with UUCP id WAA06311 for FreeBSD-gnats-submit@freebsd.org; Thu, 1 Aug 1996 22:44:58 +0200
Received: (from charnier@localhost) by xp11.frmug.org (8.7.5/8.7.3/xp11-uucp-1.1) id UAA00592; Thu, 1 Aug 1996 20:54:25 +0200 (MET DST)
Message-Id: <199608011854.UAA00592@xp11.frmug.org>
Date: Thu, 1 Aug 1996 20:54:25 +0200 (MET DST)
From: "Ph. Charnier" <charnier@xp11.frmug.org>
Reply-To: charnier@xp11.frmug.org
To: FreeBSD-gnats-submit@freebsd.org
Subject: quiet option for tsort
X-Send-Pr-Version: 3.2

>Number:         1455
>Category:       bin
>Synopsis:       tsort does not support quiet (-q) option
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:
>Keywords:
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Aug  1 13:50:01 PDT 1996
>Closed-Date:    Thu Aug 1 21:52:51 PDT 1996
>Last-Modified:  Thu Aug  1 21:53:03 PDT 1996
>Originator:     Ph. Charnier
>Release:        FreeBSD 2.2-CURRENT i386
>Organization:
------                                                            ------ 
Philippe Charnier                               charnier@lirmm.fr (smtp)       
                                          charnier@xp11.frmug.org (uucp) 

    ``a PC not running FreeBSD is like a venusian with no tentacles'' 
------------------------------------------------------------------------
>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);
 }

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: jkh 
State-Changed-When: Thu Aug 1 21:52:51 PDT 1996 
State-Changed-Why:  
Fix applied, thanks! 
>Unformatted:
