3875N/A#!/bin/sh
3875N/A#
4477N/A# Copyright 2002 Sun Microsystems, Inc. All rights reserved.
3875N/A# Use is subject to license terms.
3875N/A#
3875N/A
4477N/AF_A=/tmp/services.add.$$
4477N/AF_M=/tmp/s.merged.$$
3875N/A
3875N/Awhile read src dest
3875N/Ado
4477N/A if [ ! -f ${dest} ]
4477N/A then
4477N/A cp -p ${src} ${dest}
3875N/A else
4477N/A rm -f ${F_A}
4477N/A cat ${src} |
4477N/A while read service port rest_of_line
4477N/A do
4477N/A grep "^${service}[ ]*${port}[ ]*" ${dest} \
4477N/A > /dev/null
4477N/A if [ $? != 0 ]
4477N/A then
4477N/A grep "^${service}[ ]*${port}[ ]*" \
4477N/A ${src} >> ${F_A}
3875N/A fi
3875N/A done
4477N/A if [ -s ${F_A} ]
4477N/A then
4477N/A cat ${dest} ${F_A} > ${F_M}
4477N/A cp ${F_M} ${dest}
4477N/A rm -f ${F_M}
3875N/A fi
4477N/A rm -f ${F_A}
3875N/A fi
3875N/Adone
3875N/A
3875N/Aexit 0