diff options
author | Zach van Rijn <me@zv.io> | 2022-12-20 12:06:10 -0600 |
---|---|---|
committer | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2022-12-23 07:50:17 +0000 |
commit | f23545d9d38b8102ec739e4deab6cd8f55fe495b (patch) | |
tree | 00175d0a4a29d6649716953cfa30fbdbb55523e3 /scripts | |
parent | 0bab8d7ad886dcdcc217a17c08dc1a50327d0d2a (diff) | |
download | packages-f23545d9d38b8102ec739e4deab6cd8f55fe495b.tar.gz packages-f23545d9d38b8102ec739e4deab6cd8f55fe495b.tar.bz2 packages-f23545d9d38b8102ec739e4deab6cd8f55fe495b.tar.xz packages-f23545d9d38b8102ec739e4deab6cd8f55fe495b.zip |
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 <sys/cdefs.h>';
* replaced legacy 'bcopy' with 'memmove' as recommended
The code is still C99 but could be ported to C89 trivially.
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/tsort.c | 5 |
1 files changed, 3 insertions, 2 deletions
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 <sys/cdefs.h> - #include <sys/types.h> #include <ctype.h> @@ -55,6 +53,9 @@ static const char sccsid[] = "@(#)tsort.c 8.3 (Berkeley) 5/4/95"; #include <string.h> #include <unistd.h> +/* 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 |