2 ################################################################################
5 # RCS: $Header: add_sharedx,v 1.1 97/05/27 15:35:33 defaria Exp $
6 # Description: This script adds a new person to the SharedX addressbook
7 # Author: Andrew DeFaria, California Language Labs
8 # Created: Mon May 19 15:56:06 PDT 1997
10 # Language: Korn Shell
12 # (c) Copyright 2001, Andrew@DeFaria.com, all rights reserved
14 ################################################################################
15 # Set me to command name
19 adm_base=${adm_base:-$HOME/adm}
22 adm_fpath=${adm_fpath:-$adm_base/functions}
28 print -u2 "Usage: $me -username <username> -fullname <fullname>"
29 print -u2 "\t-phone <phonenumber> -hostname <hostname>"
30 print -u2 "\t-displayname <displayname>"
34 function add_to_sharedx {
36 check_out_file=$sharedx_addressbook
37 co -q -l $check_out_file
40 error "Unable to checkout $check_out_file"
44 trap cancel_checkout INT ERR
46 if [ "$xterm" = "T" ]; then
47 print "$displayname:0\t$fullname\t$phonenumber $username\t$hostname" >>
50 print "$displayname:0\t$fullname\t$phonenumber $username" >>
55 error "Unable to add entry to $check_out_file"
59 ci -u -q -m"Added $fullname" $check_out_file
61 error "Unable to check in $check_out_file!"
70 function cancel_checkout {
71 info "Canceling checkout"
72 rcs -q -u $check_out_file
73 chmod -w $check_out_file
78 # Find AppServer's data directory
79 if [ -d /net/bismol/app/data ]; then
80 appserver_data=/net/bismol/app/data
81 elif [ -d /net/hpclbis/app/data ]; then
82 appserver_data=/net/hpclbis/app/data
83 elif [ -d /nfs/bismol/app/data ]; then
84 appserver_data=/nfs/bismol/app/data
85 elif [ -d /nfs/hpclbis/app/data ]; then
86 appserver_data=/nfs/hpclbis/app/data
87 elif [ -d /nfs/hpclbis/root/app/data ]; then
88 appserver_data=/nfs/hpclbis/root/app/data
90 error "Internal error: Unable to ascertain appserver_data!"
94 sharedx_dir=$appserver_data/SharedX/address_books
95 sharedx_addressbook=$sharedx_dir/CLL
104 while [ $# -ge 1 ]; do
111 if [ $# -le 1 ]; then
112 error "Username not specified!"
120 if [ $# -le 1 ]; then
121 error "Full name not specified!"
128 if [ $# -le 1 ]; then
129 error "Phone not specified!"
137 if [ $# -le 1 ]; then
138 error "Hostname not specified!"
146 if [ $# -le 1 ]; then
147 error "Displayname not specified!"
155 error "Unknown parameter encounter: \"$1\""
162 if [ "_$username" = "_" -o \
163 "_$fullname" = "_" -o \
164 "_$displayname" = "_" ]; then
165 error "Missing parameter"
169 if [ "_$hostname" = "_" ]; then
170 hostname=$displayname
171 elif [ "$displayname" != "$hostname" ]; then
179 if [ $? -eq 0 ]; then
180 info "$fullname has been added to Shared/X addressbook"
181 if [ "$xterm" = "T" ]; then
182 info "X Terminal Server: $hostname; X Terminal Display Name:
186 error "Problems encountered trying to create Shared/X entry for $fullname"