#!/bin/sh

export LC_ALL=C

wget -q -O- http://pubs.opengroup.org/onlinepubs/9699919799/idx/functions.html |awk '
/<li>/ {
	sub(/.*<i>/,"")
	sub(/<\/i>.*/,"")
	print
}' |sort >posix.api

# run from musl root
MUSL=.
nm -P "$MUSL/lib/libc.a" |awk '$2 ~ /[TW]/{print $1}' |sort |uniq >musl.api


find "$MUSL/include" -exec grep '^[ \t#]*define' {} \; |awk '
{
	sub(/^[ \t#]*define[ \t]*/, "")
	sub(/[ \t(].*/, "")
	print
}' |sort |uniq >musl.defs

sort musl.defs musl.api |uniq >musl.all

comm -23 posix.api musl.all >posix-musl
