DataMuseum.dk

Presents historical artifacts from the history of:

RC9000

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about RC9000

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download
Index: @ T e

⟦fa058172d⟧ TextFile

    Length: 1654 (0x676)
    Types: TextFile
    Notes: @(#)extra.sh 13.2 (RC International) 91/05/21
    Names: »extra«

Derivation

└─⟦50656ff4a⟧ Bits:30010538 TX 3.1 Coldstart
    └─⟦bbf173f5c⟧ »0004« 
        └─⟦this⟧ »./usr/pkg/extra« 

TextFile

#!/bin/sh
#
# @(#)extra.sh	13.2	(RC International)	91/05/21
#
# ---------------------------------------------------
# | Copyright (c) 1986 MIPS Computer Systems, Inc.  |
# | All Rights Reserved.                            |
# ---------------------------------------------------
#
# extra - Generate a list of files not listed in a set of BOM files.
#
# Usage: extra directory filename...
#
# This command takes a root directory name and a set of BOM files (or
# any files whose first 'awk' field is a set of filenames, and produces
# a list of files that exist in the directory but are not in the BOM files.
#
# The exit code is 0 unless a problem was found ("problem" does not
# mean extra files).
#

PATH=/bin:/usr/bin
export PATH

case $# in
0|1)	echo "$0: Missing arguments" 1>&2;
	echo "Usage: $0 directory filename ..." 1>&2;
	exit 1;;
esac

#
# Make sure that the root directory exists.
#

Root="$1"
if [ ! -d "$Root" ]
then
	echo "$0: Invalid directory name - $Root" 1>&2
	exit 1
fi
shift

#
# Make sure that all of the BOM files exist, and build the master list.
#

if [ $# -eq 0 ]; then
	echo "$0: No BOM files given" 1>&2
	exit 1
fi
for file in "$@"; do
	if [ ! -f "$file" ]; then
		echo "$0: Nonexistent BOM file - $file" 1>&2
		Exit=1
	fi
done
if [ "$Exit" ]; then
	exit 1
fi
Master=/tmp/comply.master.$$
cat "$*" | awk '{print $1}' | sort -u >> "$Master"

#
# Go over to the root directory and get a list of all files.
#

cd "$Root"
Exist=/tmp/comply.exist.$$
find . -xdev -print 2>/dev/null | sed 's/^\.\///' | sort > "$Exist"

#
# Generate the list of files not in Master.
#

comm -23 "$Exist" "$Master"

rm -f "$Exist" "$Master"

exit 0