1#!/bin/sh
2
3#	$NetBSD: cvs.sh.sh,v 1.4 2017/05/09 23:26:49 kamil Exp $
4
5# ensure that HOME is set for pserver modes
6UID=`id -u`
7export HOME=`awk -F: '$3=='"$UID"'{print$6}' /etc/passwd`
8# supplement path to include ssh and cvs
9export PATH=/usr/pkg/bin:$PATH
10# use ssh instead of rsh for cvs connections
11export CVS_RSH=ssh
12
13case $1 in
14	netbsd)
15		export CVSROOT="anoncvs@anoncvs.NetBSD.org:/cvsroot"
16		shift
17		;;
18	openbsd)
19		export CVSROOT="anoncvs@anoncvs.usa.openbsd.org:/cvs"
20		shift
21		;;
22	*)
23		echo "configuration not supported"
24		exit 0
25esac
26
27for file; do
28	if ( echo $file | egrep -qi '(.*),(-r)?([0-9\.]+|[-_a-z0-9]+)$' ); then
29		rev="-r`expr "$file" : '.*,\(.*\)' | sed 's/^-r//'`"
30		file="`expr "$file" : '\(.*\),.*'`"
31	else
32		rev=""
33	fi
34	cvs co -p $rev $file
35done
36