#!/bin/sh # processing of a clickable map to set location MASTER_DIR=/web/cs/docs/people/staff/pjb EXPR=expr # we need the ucb version of expr to do the sting functions if test -f /usr/ucb/expr; then EXPR=/usr/ucb/expr fi # .. otherwise hope the normal expr does it # the scaling here is tied to a particular map, the eastukc map # do scaling: first extract X and Y COMMA=`$EXPR index $1 ","` if test $COMMA -lt 1; then # error case: can be caused by direct call with garbled input ./at_sesensor $1 exit 0 fi C=`expr $COMMA - 1` D=`expr $COMMA + 1` X=`$EXPR substr $1 1 $C` Y=`$EXPR substr $1 $D 999` # now do the scaling: scale factors, if any, will have been set in the launch params # X_SCALE is percentage difference betweeb map and notes, e.g. =50 if map is twice as big as notes X_SCALE=100 #default Y_SCALE=100 # default X_BASE=0 # default Y_BASE=0 #default . $MASTER_DIR/tmp/params # may over-ride defaults X1=`expr $X '*' $X_SCALE / 100 + $X_BASE` Y1=`expr $Y '*' $Y_SCALE / 100 + $Y_BASE` if test x$X1 != x; then X=$X1 # not an error in above calculation fi if test x$Y1 != x; then Y=$Y1 # not an error in above calculation fi ./at_sesensor $X,$Y