2 ################################################################################
5 # RCS: $Header: add_postnote,v 1.1 97/05/27 15:35:32 defaria Exp $
6 # Description: This script adds a new person to the postnote 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_postnote {
36 check_out_file=$postnote_addressbook
37 co -q -l $check_out_file
40 error "Unable to checkout $check_out_file"
44 trap cancel_checkout INT ERR
46 print "S:$fullname = Phone: $phonenumber =
47 ($hostname,$displayname:0,$username@cup.hp.com,F,$xterm)" >> $check_out_file
50 error "Unable to add entry to $check_out_file"
54 ci -u -q -m"Added $fullname" $check_out_file
56 error "Unable to check in $check_out_file!"
65 function cancel_checkout {
66 info "Canceling checkout"
67 rcs -q -u $check_out_file
68 chmod -w $check_out_file
73 # Find AppServer's data directory
74 if [ -d /net/bismol/app/data ]; then
75 appserver_data=/net/bismol/app/data
76 elif [ -d /net/hpclbis/app/data ]; then
77 appserver_data=/net/hpclbis/app/data
78 elif [ -d /nfs/bismol/app/data ]; then
79 appserver_data=/nfs/bismol/app/data
80 elif [ -d /nfs/hpclbis/app/data ]; then
81 appserver_data=/nfs/hpclbis/app/data
82 elif [ -d /nfs/hpclbis/root/app/data ]; then
83 appserver_data=/nfs/hpclbis/root/app/data
85 error "Internal error: Unable to ascertain appserver_data!"
89 postnote_dir=$appserver_data
90 postnote_addressbook=$postnote_dir/pn_addressbook
99 while [ $# -ge 1 ]; do
106 if [ $# -le 1 ]; then
107 error "Username not specified!"
115 if [ $# -le 1 ]; then
116 error "Full name not specified!"
123 if [ $# -le 1 ]; then
124 error "Phone not specified!"
132 if [ $# -le 1 ]; then
133 error "Hostname not specified!"
141 if [ $# -le 1 ]; then
142 error "Displayname not specified!"
150 error "Unknown parameter encounter: \"$1\""
157 if [ "_$username" = "_" -o \
158 "_$fullname" = "_" -o \
159 "_$hostname" = "_" ]; then
160 error "Missing parameter"
164 if [ "_$displayname" = "_" ]; then
165 displayname=$hostname:0.0
166 elif [ "$displayname" != "$hostname" ]; then
174 if [ $? -eq 0 ]; then
175 info "$fullname has been added to PostNote addressbook"
176 if [ "$xterm" = "T" ]; then
177 info "X Terminal Server: $hostname; X Terminal Display Name:
181 error "Problems encountered trying to create PostNote entry for $fullname"