#!/bin/sh

# Copyright (c) 1999 Madge Networks Ltd.
#
# TEG 14/09/1999
#
#/********************************************************************
#*	THE USE BY YOU OF THIS SOFTWARE IS GOVERNED IN ALL
#*	RESPECTS BY THE MADGE NETWORKS LTD OPEN SOURCE LICENSE.		
#*	WE ADVISE YOU TO READ THE TERMS OF THE OPEN SOURCE LICENSE
#*	WHICH CAN BE FOUND WITHIN THE LICENSE.TXT FILE WHICH IS PART OF
#*	THE SOFTWARE OR BY VISITING THE URL
#*	http://www.madge.com/Connect/Downloads/Software/.		
#*	MADGE NETWORKS LTD RESERVES THE RIGHT TO SEEK REDRESS FOR
#*	ANY VIOLATION OF THE LICENSE'S TERMS					
#*********************************************************************/


#
# All the UDT files required to support the adapters we support in the
# Linux driver.
#

NEEDED_FILES="pcibm2i.c       \
             pcmciai.c       \
             piotest.c       \
             knossosi.c      \
             hebei.c         \
             smarti.c        \
             opcitmsi.c      \
             opcmciai.c      \
             decomp.c        \
             knoscode.c      \
             fmplus.c        \
             hebeimg.c       \
             at24.c          \
             at24hebe.c      \
             config.c        \
             hc46.c          \
             pcibm2r.c       \
             pcmciar.c       \
             pio.c           \
             knossosr.c      \
             heber.c         \
             opcitmsr.c      \
             opcmciar.c      \
             knos2r.c        \
             knos3r.c        \
             smartr.c        \
             udmi.c          \
             util.c          \
             udt.upd         \
             common.h        \
             defs.h          \
             errors.h        \
             hebe.h          \
             image.h         \
             knossos.h       \
             macros.h        \
             pci.h           \
             poke.h          \
             return.h        \
             smart.h         \
             ssi.h           \
             types.h         \
             udi.h           \
             udmi.h          \
             udt.h           \
             udti.h          \
             upcall.h"

#
# Program to strip comments
#

STRIP=~/strip/ustrip

#
# Convert a filename to lower case letters and 
# change to UNIX line endings and remove ^Z
#
for i in $@ ; do
    NEWF=$(echo $i | tr [:upper:] [:lower:])
    
    echo $NEWF $i
    chmod 644 $i

    if [ $NEWF != $i ] ; then
        tr -d "\032\r" < $i | $STRIP > $NEWF && rm $i
    else
        tr -d "\032\r" < $i | $STRIP > $i.u && mv $i.u $i
    fi

    chmod a-x $NEWF

	found=0

#	Search for the file in the list of needed files 

	for j in $NEEDED_FILES ; do
		if [ "$j" = "$(basename $NEWF)" ] ; then
			found=1;
			break;
		fi
	done

#	If the file is not needed then delete it.

	if [ $found -eq 0 ] ; then
		echo Removing $NEWF
		rm -f $NEWF
	fi
done

