summaryrefslogtreecommitdiff
path: root/mcon/U/cf_name.U
blob: c1ea6508a3321b6cbce28ff8283935c1cb38974e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
?RCS: $Id$
?RCS:
?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi
?RCS: 
?RCS: You may redistribute only under the terms of the Artistic Licence,
?RCS: as specified in the README file that comes with the distribution.
?RCS: You may reuse parts of this distribution only within the terms of
?RCS: that same Artistic Licence; a copy of which may be found at the root
?RCS: of the source tree for dist 4.0.
?RCS: 
?RCS: Original Author: Graham Stoney <greyham@research.canon.oz.au>
?RCS:
?RCS: $Log: cf_name.U,v $
?RCS: Revision 3.0.1.2  1994/05/06  14:29:36  ram
?RCS: patch23: fixed user name computation from /etc/passwd in bsd systems
?RCS:
?RCS: Revision 3.0.1.1  1994/01/24  14:05:11  ram
?RCS: patch16: created
?RCS:
?RCS:
?MAKE:+cf_name: cf_by passcat Filexp nametype cat test
?MAKE:	-pick add $@ %<
?S:cf_name:
?S:	Full name of the person who ran the Configure script and answered the
?S:	questions. This can be used by units that require the user's full name.
?S:	This variable is for internal use only.
?S:.
?T:xxx fn NAME
: figure out their full name
case "$NAME" in
'') case "$nametype" in
	other)
		fn=`./filexp ~/.fullname`
		xxx=usg
		$test -f $fn && xxx=other
		;;
	*)
		xxx="$nametype"
		;;
	esac

	case "$xxx" in
	bsd)
		cf_name=`$passcat | grep "^$cf_by:" | \
			sed -e 's/^[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\):.*/\1/' \
			-e 's/,.*//'`
		;;
    usg)
		cf_name=`$passcat | grep "^$cf_by:" | \
			sed -e 's/^[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\):.*/\1/' \
			-e 's/[^-]*-\(.*\)(.*)/\1/'`
		;;
	*)
		cf_name=`$cat $fn`
		;;
	esac
	;;
*)
	cf_name="$NAME"
	;;
esac
?X:
?X: In the original unit, Graham asked for the user name, in case the above
?X: code was unable to figure it out correctly. Since now cf_name has been
?X: made an internal variable only (i.e. it is not saved in config.sh), letting
?X: the user override the computed default each time would be a pain.
?X: Therefore, I have decided to trust the above code to get it right, and for
?X: those rare cases where it will fail, too bad :-) --RAM.
?X:
echo " "
echo "Pleased to meet you, $cf_name."