Systemd/src/basic/generate-af-list.sh
Will Dietz 203690537b generate-af-list.sh: slightly generalize pattern, fix w/musl (#8629)
Accept definitions to other AF_ constants, not just PF_ ones,
such as:

  #define AF_LINUX AF_LOCAL

It may not be necessary to impose any restriction on the
definitions of the macros extracted, but for now
keep most of that requirement but match AF_* as well.
2018-03-31 12:55:45 +02:00

7 lines
181 B
Bash
Executable file

#!/bin/sh
set -eu
$1 -E -dM -include sys/socket.h - </dev/null | \
grep -Ev 'AF_UNSPEC|AF_MAX' | \
awk '/^#define[ \t]+AF_[^ \t]+[ \t]+[AP]F_[^ \t]/ { print $2; }'