From f23545d9d38b8102ec739e4deab6cd8f55fe495b Mon Sep 17 00:00:00 2001 From: Zach van Rijn Date: Tue, 20 Dec 2022 12:06:10 -0600 Subject: scripts/tsort.c: clean up some non-portable code. Many variants of this utility are floating around; there does not appear to be a canonical implementation. This one works for us. * removed non-portable '#include '; * replaced legacy 'bcopy' with 'memmove' as recommended The code is still C99 but could be ported to C89 trivially. --- scripts/tsort.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/tsort.c b/scripts/tsort.c index e307268da..51aba6a31 100644 --- a/scripts/tsort.c +++ b/scripts/tsort.c @@ -42,8 +42,6 @@ static const char copyright[] = static const char sccsid[] = "@(#)tsort.c 8.3 (Berkeley) 5/4/95"; #endif /* not lint */ -#include - #include #include @@ -55,6 +53,9 @@ static const char sccsid[] = "@(#)tsort.c 8.3 (Berkeley) 5/4/95"; #include #include +/* https://pubs.opengroup.org/onlinepubs/007904875/functions/bcopy.html */ +#define bcopy(b1,b2,len) (memmove((b2), (b1), (len)), (void) 0) + /* * Topological sort. Input is a list of pairs of strings separated by * white space (spaces, tabs, and/or newlines); strings are written to -- cgit v1.2.3-60-g2f50