OpenBSD CVS

CVS log for src/usr.bin/tsort/tsort.c


[BACK] Up to [local] / src / usr.bin / tsort

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.38 / (download) - annotate - [select for diffs], Thu Jan 18 15:34:29 2024 UTC (4 months ago) by espie
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, HEAD
Changes since 1.37: +2 -2 lines
Diff to previous 1.37 (colored)

fix macro to look more like a function, remove extraneous ;
(clang's -Weverything would correctly warn about the resulting empty
statement)

No generated code change

Revision 1.37 / (download) - annotate - [select for diffs], Thu Jul 11 17:28:32 2019 UTC (4 years, 10 months ago) by mestre
Branch: MAIN
CVS Tags: OPENBSD_7_4_BASE, OPENBSD_7_4, OPENBSD_7_3_BASE, OPENBSD_7_3, OPENBSD_7_2_BASE, OPENBSD_7_2, OPENBSD_7_1_BASE, OPENBSD_7_1, OPENBSD_7_0_BASE, OPENBSD_7_0, OPENBSD_6_9_BASE, OPENBSD_6_9, OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7, OPENBSD_6_6_BASE, OPENBSD_6_6
Changes since 1.36: +5 -8 lines
Diff to previous 1.36 (colored)

Remove duplicate pledge(2) and comment from another era. While here also place
the final pledge "stdio" within main() for better readability.

OK espie@

Revision 1.36 / (download) - annotate - [select for diffs], Sat May 20 09:31:19 2017 UTC (7 years ago) by espie
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5, OPENBSD_6_4_BASE, OPENBSD_6_4, OPENBSD_6_3_BASE, OPENBSD_6_3, OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.35: +6 -6 lines
Diff to previous 1.35 (colored)

reorg node struct so it's packed tighter (found by clang actually)
mark usage __dead
okay millert@

Revision 1.35 / (download) - annotate - [select for diffs], Tue Jan 5 16:10:57 2016 UTC (8 years, 4 months ago) by espie
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1, OPENBSD_6_0_BASE, OPENBSD_6_0, OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.34: +3 -2 lines
Diff to previous 1.34 (colored)

stuff may still change, disable whitelist for now.
ok semarie@

Revision 1.34 / (download) - annotate - [select for diffs], Thu Dec 31 18:00:41 2015 UTC (8 years, 4 months ago) by millert
Branch: MAIN
Changes since 1.33: +9 -10 lines
Diff to previous 1.33 (colored)

Remove use of sysexits.h; OK espie@

Revision 1.33 / (download) - annotate - [select for diffs], Fri Dec 4 17:58:05 2015 UTC (8 years, 5 months ago) by espie
Branch: MAIN
Changes since 1.32: +3 -1 lines
Diff to previous 1.32 (colored)

read_hints should also protect against ferror.
obvious commit

Revision 1.32 / (download) - annotate - [select for diffs], Sun Oct 11 23:01:32 2015 UTC (8 years, 7 months ago) by espie
Branch: MAIN
Changes since 1.31: +8 -2 lines
Diff to previous 1.31 (colored)

now that tsort has a clean structure, do more specific pledge() calls.
okay deraadt@

Revision 1.31 / (download) - annotate - [select for diffs], Sun Oct 11 17:39:50 2015 UTC (8 years, 7 months ago) by espie
Branch: MAIN
Changes since 1.30: +35 -21 lines
Diff to previous 1.30 (colored)

reorg code to have an array with all the files used apparent.
okay millert@

Revision 1.30 / (download) - annotate - [select for diffs], Sat Oct 10 15:47:22 2015 UTC (8 years, 7 months ago) by deraadt
Branch: MAIN
Changes since 1.29: +4 -1 lines
Diff to previous 1.29 (colored)

basic pledge "stdio rpath"
ok doug

Revision 1.29 / (download) - annotate - [select for diffs], Thu Sep 3 11:16:50 2015 UTC (8 years, 8 months ago) by espie
Branch: MAIN
Changes since 1.28: +89 -73 lines
Diff to previous 1.28 (colored)

reorg code, preliminary step to more cleanup
- split the two blobs in main into separate functions
- use return instead of exit

okay millert@

Revision 1.28 / (download) - annotate - [select for diffs], Mon Aug 31 09:36:02 2015 UTC (8 years, 8 months ago) by espie
Branch: MAIN
Changes since 1.27: +2 -2 lines
Diff to previous 1.27 (colored)

indent is 8 not 4

Revision 1.27 / (download) - annotate - [select for diffs], Mon Aug 31 09:33:43 2015 UTC (8 years, 8 months ago) by espie
Branch: MAIN
Changes since 1.26: +3 -3 lines
Diff to previous 1.26 (colored)

wrong index in error message

Revision 1.26 / (download) - annotate - [select for diffs], Wed Jul 29 10:42:37 2015 UTC (8 years, 9 months ago) by espie
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8
Changes since 1.25: +1 -2 lines
Diff to previous 1.25 (colored)

gc macro that's no longer used since the move to reallocarray

Revision 1.25 / (download) - annotate - [select for diffs], Tue Jul 21 07:13:59 2015 UTC (8 years, 10 months ago) by jasper
Branch: MAIN
Changes since 1.24: +10 -12 lines
Diff to previous 1.24 (colored)

whitespace cleanup

Revision 1.24 / (download) - annotate - [select for diffs], Sat Oct 11 03:57:13 2014 UTC (9 years, 7 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.23: +10 -8 lines
Diff to previous 1.23 (colored)

convert to use of reallocarray()
ok doug

Revision 1.23 / (download) - annotate - [select for diffs], Mon May 12 19:11:20 2014 UTC (10 years ago) by espie
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6
Changes since 1.22: +7 -7 lines
Diff to previous 1.22 (colored)

adjust to ohash being in libutil now, and to the interface changes.
fix potential integer overflows in memory allocation (mostly for pedagogical
purposes, these are unlikely to overflow in practice)
move the rest of lst.lib stuff into its own directory.

Revision 1.22 / (download) - annotate - [select for diffs], Wed Nov 27 00:13:24 2013 UTC (10 years, 5 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.21: +8 -5 lines
Diff to previous 1.21 (colored)

unsigned char for ctype
ok okan

Revision 1.21 / (download) - annotate - [select for diffs], Thu Mar 29 22:04:28 2012 UTC (12 years, 1 month ago) by jmc
Branch: MAIN
CVS Tags: OPENBSD_5_4_BASE, OPENBSD_5_4, OPENBSD_5_3_BASE, OPENBSD_5_3, OPENBSD_5_2_BASE, OPENBSD_5_2
Changes since 1.20: +2 -2 lines
Diff to previous 1.20 (colored)

there must be an even number of node names, not pairs;
from Jan Stary

Revision 1.20 / (download) - annotate - [select for diffs], Fri Jan 20 23:10:19 2006 UTC (18 years, 4 months ago) by espie
Branch: MAIN
CVS Tags: OPENBSD_5_1_BASE, OPENBSD_5_1, OPENBSD_5_0_BASE, OPENBSD_5_0, OPENBSD_4_9_BASE, OPENBSD_4_9, OPENBSD_4_8_BASE, OPENBSD_4_8, OPENBSD_4_7_BASE, OPENBSD_4_7, OPENBSD_4_6_BASE, OPENBSD_4_6, OPENBSD_4_5_BASE, OPENBSD_4_5, OPENBSD_4_4_BASE, OPENBSD_4_4, OPENBSD_4_3_BASE, OPENBSD_4_3, OPENBSD_4_2_BASE, OPENBSD_4_2, OPENBSD_4_1_BASE, OPENBSD_4_1, OPENBSD_4_0_BASE, OPENBSD_4_0, OPENBSD_3_9_BASE, OPENBSD_3_9
Changes since 1.19: +3 -3 lines
Diff to previous 1.19 (colored)

use stdint.h where appropriate. okay millert@

Revision 1.19 / (download) - annotate - [select for diffs], Thu Aug 5 10:59:42 2004 UTC (19 years, 9 months ago) by espie
Branch: MAIN
CVS Tags: OPENBSD_3_8_BASE, OPENBSD_3_8, OPENBSD_3_7_BASE, OPENBSD_3_7, OPENBSD_3_6_BASE, OPENBSD_3_6
Changes since 1.18: +13 -24 lines
Diff to previous 1.18 (colored)

simpler copyright, adjust date.

Revision 1.18 / (download) - annotate - [select for diffs], Wed Aug 4 15:30:06 2004 UTC (19 years, 9 months ago) by espie
Branch: MAIN
Changes since 1.17: +2 -2 lines
Diff to previous 1.17 (colored)

sort SYNOPSIS and usage(), format tweaks, by jmc@

Revision 1.17 / (download) - annotate - [select for diffs], Mon Sep 22 23:39:24 2003 UTC (20 years, 8 months ago) by drahn
Branch: MAIN
CVS Tags: OPENBSD_3_5_BASE, OPENBSD_3_5
Changes since 1.16: +5 -5 lines
Diff to previous 1.16 (colored)

Fix read beyond end of buffer, found by mallocguard. ok deraadt@ espie@

Revision 1.16 / (download) - annotate - [select for diffs], Tue Jun 10 22:20:53 2003 UTC (20 years, 11 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_3_4_BASE, OPENBSD_3_4
Changes since 1.15: +2 -2 lines
Diff to previous 1.15 (colored)

mostly ansi cleanup; pval ok

Revision 1.15 / (download) - annotate - [select for diffs], Wed Jul 17 11:21:43 2002 UTC (21 years, 10 months ago) by espie
Branch: MAIN
CVS Tags: OPENBSD_3_3_BASE, OPENBSD_3_3, OPENBSD_3_2_BASE, OPENBSD_3_2
Changes since 1.14: +53 -57 lines
Diff to previous 1.14 (colored)

spring clean-up: remove extra spaces at end of line,
and rescind 3rd licence clause.

Revision 1.14 / (download) - annotate - [select for diffs], Wed Feb 27 20:26:37 2002 UTC (22 years, 2 months ago) by espie
Branch: MAIN
CVS Tags: OPENBSD_3_1_BASE, OPENBSD_3_1
Changes since 1.13: +31 -84 lines
Diff to previous 1.13 (colored)

ANSI decls. okay millert@

Revision 1.13 / (download) - annotate - [select for diffs], Sun Feb 17 19:42:33 2002 UTC (22 years, 3 months ago) by millert
Branch: MAIN
Changes since 1.12: +5 -5 lines
Diff to previous 1.12 (colored)

Manual cleanup of remaining userland __P use (excluding packages maintained outside the tree)

Revision 1.12 / (download) - annotate - [select for diffs], Sat Feb 16 21:27:55 2002 UTC (22 years, 3 months ago) by millert
Branch: MAIN
Changes since 1.11: +29 -29 lines
Diff to previous 1.11 (colored)

Part one of userland __P removal.  Done with a simple regexp with some minor hand editing to make comments line up correctly.  Another pass is forthcoming that handles the cases that could not be done automatically.

Revision 1.11 / (download) - annotate - [select for diffs], Thu Feb 14 12:11:49 2002 UTC (22 years, 3 months ago) by espie
Branch: MAIN
Changes since 1.10: +2 -2 lines
Diff to previous 1.10 (colored)

lclint says this is an unsigned variable... and it's right !

Revision 1.10 / (download) - annotate - [select for diffs], Sat Jul 14 14:18:50 2001 UTC (22 years, 10 months ago) by espie
Branch: MAIN
CVS Tags: OPENBSD_3_0_BASE, OPENBSD_3_0
Changes since 1.9: +20 -16 lines
Diff to previous 1.9 (colored)

Fix cycle detection.
Under some circumstances, trying to find a cycle starting with a given
point can be very time-consuming (probably exponential, as an
implementation of an NP-complete problem), so we lower our expectations,
and just report the first cycle we find, irregardless of which point it
cuts, which is guaranteed to be much faster (quadratic behavior at the
worst--because we won't explore more than a tree out of the graph).

Always find that cycle, even if -q is specified, so that -q is only
`quiet', e.g., does not change the reported result.

Based on a testcase reported by Dragos Ruiu,  okay millert@

Revision 1.9 / (download) - annotate - [select for diffs], Tue May 1 20:36:57 2001 UTC (23 years ago) by espie
Branch: MAIN
Changes since 1.8: +3 -4 lines
Diff to previous 1.8 (colored)

Revert stupid buggy optimisation.
Another Murphy's law: complicated code always works right the first
time. Stupid dumb details, on the other hand.

Of course we can't share both arrays, as we don't know how they will
grow, duh !

Revision 1.8 / (download) - annotate - [select for diffs], Mon Apr 30 21:03:55 2001 UTC (23 years ago) by espie
Branch: MAIN
Changes since 1.7: +83 -16 lines
Diff to previous 1.7 (colored)

Better hints handling (used for sorting package lists):

- nodes without a hint should be fully transparent.  The make_transparent
procedure is potentially slow, but in reality, it's very fast.
- don't automatically add an order to un-hinted nodes, so that they are
truely transparent.

Better memory allocation: split the hash of nodes into a single array
instead of duplicating the memory requirements.

Okay Todd.

Revision 1.7 / (download) - annotate - [select for diffs], Wed Apr 18 17:57:28 2001 UTC (23 years, 1 month ago) by espie
Branch: MAIN
CVS Tags: OPENBSD_2_9_BASE, OPENBSD_2_9
Changes since 1.6: +28 -21 lines
Diff to previous 1.6 (colored)

Fix `hinted' options: set initial order to maximal, so that any hint
will be first. Also, keep order around between hints file and reading
normal pairt, so that this option actually is useful.

Revision 1.6 / (download) - annotate - [select for diffs], Sat Apr 7 14:17:38 2001 UTC (23 years, 1 month ago) by espie
Branch: MAIN
Changes since 1.5: +16 -10 lines
Diff to previous 1.5 (colored)

Small changes, user-friendly:
- just warn if hints file holds duplicates. So what ? We sure can't use
uniq to remove those.
- on the other hand, warn in verbose mode if main file holds nodes that
are not in hints file.
Ok millert@

Revision 1.5 / (download) - annotate - [select for diffs], Mon Mar 26 22:53:33 2001 UTC (23 years, 1 month ago) by espie
Branch: MAIN
Changes since 1.4: +879 -360 lines
Diff to previous 1.4 (colored)

Replacement for original tsort.

The old code suffers from a few defects:
- it does not even implement the standard optimal topological sort
algorithm. It's much slower.
- its longest cycle computation is completely bogus.

This is clean-slate code, that does implement the actual standard optimal
topological sort, together with a correct graph traversal to find longest
cycles.

It does also feature a `stable tsort' mode, where it uses a heap to yield
the least disturbed permutation of input nodes that satisfies the ordering
constraints (in particular, try tsort -f).

Thanks to the nature of the problem, the actual output won't exactly match
the old one, but it does pass the regression suite (and it is a topological
sorter).

Ok millert@

Revision 1.4 / (download) - annotate - [select for diffs], Wed Jan 15 23:43:26 1997 UTC (27 years, 4 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_2_8_BASE, OPENBSD_2_8, OPENBSD_2_7_BASE, OPENBSD_2_7, OPENBSD_2_6_BASE, OPENBSD_2_6, OPENBSD_2_5_BASE, OPENBSD_2_5, OPENBSD_2_4_BASE, OPENBSD_2_4, OPENBSD_2_3_BASE, OPENBSD_2_3, OPENBSD_2_2_BASE, OPENBSD_2_2, OPENBSD_2_1_BASE, OPENBSD_2_1
Changes since 1.3: +3 -3 lines
Diff to previous 1.3 (colored)

getopt(3) returns -1 when out of args, not EOF, whee!

Revision 1.3 / (download) - annotate - [select for diffs], Wed Jun 26 05:42:00 1996 UTC (27 years, 10 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_2_0_BASE, OPENBSD_2_0
Changes since 1.2: +2 -1 lines
Diff to previous 1.2 (colored)

rcsid

Revision 1.2 / (download) - annotate - [select for diffs], Mon Jan 29 01:02:19 1996 UTC (28 years, 3 months ago) by deraadt
Branch: MAIN
Changes since 1.1: +14 -9 lines
Diff to previous 1.1 (colored)

add -q option for silence; from mouse@collatz.mcrcim.mcgill.edu;
netbsd pr#1204

Revision 1.1.1.1 / (download) - annotate - [select for diffs] (vendor branch), Wed Oct 18 08:46:27 1995 UTC (28 years, 7 months ago) by deraadt
CVS Tags: netbsd_1_1
Changes since 1.1: +0 -0 lines
Diff to previous 1.1 (colored)

initial import of NetBSD tree

Revision 1.1 / (download) - annotate - [select for diffs], Wed Oct 18 08:46:27 1995 UTC (28 years, 7 months ago) by deraadt
Branch: MAIN

Initial revision

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.