Commit | Line | Data |
---|---|---|
d8875586 MBT |
1 | ?RCS: $Id: cf_name.U 1 2006-08-24 12:32:52Z rmanfredi $ |
2 | ?RCS: | |
3 | ?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi | |
4 | ?RCS: | |
5 | ?RCS: You may redistribute only under the terms of the Artistic Licence, | |
6 | ?RCS: as specified in the README file that comes with the distribution. | |
7 | ?RCS: You may reuse parts of this distribution only within the terms of | |
8 | ?RCS: that same Artistic Licence; a copy of which may be found at the root | |
9 | ?RCS: of the source tree for dist 4.0. | |
10 | ?RCS: | |
11 | ?RCS: Original Author: Graham Stoney <greyham@research.canon.oz.au> | |
12 | ?RCS: | |
13 | ?RCS: $Log: cf_name.U,v $ | |
14 | ?RCS: Revision 3.0.1.2 1994/05/06 14:29:36 ram | |
15 | ?RCS: patch23: fixed user name computation from /etc/passwd in bsd systems | |
16 | ?RCS: | |
17 | ?RCS: Revision 3.0.1.1 1994/01/24 14:05:11 ram | |
18 | ?RCS: patch16: created | |
19 | ?RCS: | |
20 | ?RCS: | |
21 | ?MAKE:+cf_name: cf_by passcat Filexp nametype cat test | |
22 | ?MAKE: -pick add $@ %< | |
23 | ?S:cf_name: | |
24 | ?S: Full name of the person who ran the Configure script and answered the | |
25 | ?S: questions. This can be used by units that require the user's full name. | |
26 | ?S: This variable is for internal use only. | |
27 | ?S:. | |
28 | ?T:xxx fn NAME | |
29 | : figure out their full name | |
30 | case "$NAME" in | |
31 | '') case "$nametype" in | |
32 | other) | |
33 | fn=`./filexp ~/.fullname` | |
34 | xxx=usg | |
35 | $test -f $fn && xxx=other | |
36 | ;; | |
37 | *) | |
38 | xxx="$nametype" | |
39 | ;; | |
40 | esac | |
41 | ||
42 | case "$xxx" in | |
43 | bsd) | |
44 | cf_name=`$passcat | grep "^$cf_by:" | \ | |
45 | sed -e 's/^[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\):.*/\1/' \ | |
46 | -e 's/,.*//'` | |
47 | ;; | |
48 | usg) | |
49 | cf_name=`$passcat | grep "^$cf_by:" | \ | |
50 | sed -e 's/^[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\):.*/\1/' \ | |
51 | -e 's/[^-]*-\(.*\)(.*)/\1/'` | |
52 | ;; | |
53 | *) | |
54 | cf_name=`$cat $fn` | |
55 | ;; | |
56 | esac | |
57 | ;; | |
58 | *) | |
59 | cf_name="$NAME" | |
60 | ;; | |
61 | esac | |
62 | ?X: | |
63 | ?X: In the original unit, Graham asked for the user name, in case the above | |
64 | ?X: code was unable to figure it out correctly. Since now cf_name has been | |
65 | ?X: made an internal variable only (i.e. it is not saved in config.sh), letting | |
66 | ?X: the user override the computed default each time would be a pain. | |
67 | ?X: Therefore, I have decided to trust the above code to get it right, and for | |
68 | ?X: those rare cases where it will fail, too bad :-) --RAM. | |
69 | ?X: | |
70 | echo " " | |
71 | echo "Pleased to meet you, $cf_name." | |
72 |