#!/bin/ksh
#
# mkexps - make export list for aix running GNU g++
#
# Version: @(#)mkexps	1.1 04/24/95
# Copyright (c) 1990-1997 The Regents of the University of California.
# 	All Rights Reserved.
#
#	Author: Xavier Warzee (WARZEE@SCTF.thomson.fr)
#
# This program creates an export list by combining all the "." and
# normal names into one list.

#
if [[ "$#" -ne 1 ]]
then
    print "Usage: mkexps ArchiveFile"
    exit -2
fi
if [[ ! -f $1 ]]
then
    print "mkexps: Cannot open file \"$1\""
    exit -1
fi
dump -g $1 | awk '
BEGIN {
        top = 1
}
/^[ ]*[0-9][0-9]*/ {
    if ( (n = index( $2, "." )) > 0 ) {
        export_array[ top++ ] = substr( $2, n+1, length( $2 ))
    }
    else {
        export_array[ top++ ] = $2
    }
}

END {
    for ( i = 1; i < top; i++ )
    {
        print export_array[ i ]
    }

}' | sort | uniq
