#!/bin/csh -f # #!/bin/csh -fx goto MAIN # HELP: more -d << doc_end ############################################################################ # SR USAGE: # sr - works on Current Development # ------------------------------------------------------------------- # # sr subcommands: # <> - required input # [] - optional input # - date format DD-MM-YY ie: 18-Jan-1990 # # Stable file management in ./RCS: # ci - check in file - (**) # co - check out file - (**) # diff - rcsdiff on file in RCS # rdiff - diff demeter_5_0 and demeter_5_1 # rlog - rlog on file in RCS # rcs - rcs commands to RCS files # - "sr srcs -u " breaks the lock ... # - If it is not yours mail is sent # # New file creation: # - all checked out LOCKED when done. # newsrc - create new src file from template # - places file under RCS and checks it out "-l" # newfile - create new file from nothing # - places file under RCS and checks it out "-l" # - No header : use for Imakefile, etc # # Existing file addition: # - all checked out UNLOCKED when done # addsrc - adds an existing src file to the RCS branch # - will add new header in the file if other than # - rev 1 header. # addfile - adds an existing file to the RCS branch # - No header # # Status : # status - RCS status for current directory # - # mystatus - RCS status for user # - what "you" have checked out, from . down # allstatus - RCS status for all users # - all checked out files, from . down # # Information : # mail [user] - Send mail to Sunrise Development (**) # - user - also sent to user # mailfrom [date] - get mail from a user # - [date] format MM-DD-YY # activity [date] - sci, sco, stab, rel, srcs, mail activity # - get activity for a particular user # - qualify it by date # - if [user] == all, get all activity # # tailact [switches] [user] # - Will give you the last 30 lines of your # - activity file, or any body elses. # - use -[#] to get # lines from end # - if [user] == all, tail all activity files # # grep [grep switches] <"pattern to find"> # - Will search for the pattern in the users # - file, "all" is an acceptable user # - For example: # - grep all -d4 "SENT MAIL" # This will find all the times # everybody sent mail. It will also # give you the 4 line above and bellow # each mail entry. # # mlist - More the graphics mail aliases # env - Your current environment # help - More this file # # (**) - All user actions on these commands are logged # - in the users activity file # ############################################################################ doc_end exit 0 MAIN: unalias * if ($1 == help) goto HELP # # Environment Variables # set DEF_EDITOR = /usr/bin/vi if ($?EDITOR) then set ED = $EDITOR else set ED = $DEF_EDITOR endif # # Local Variable Initialization # set SR_REV = 4.0 set path = (. /bin /usr/bin /usr/local/bin /usr/local /usr/ucb /bin/etc/usr/etc ) # # Switch SR_TOP when testing sr # # XXX Change this for testing set USER = `whoami` set TD = `date` set SR_DATE = "$TD[3]-$TD[2]-$TD[6] -- $TD[4]" set TPWD = `pwd` # # Set the appropriate branch # # The default should always be set to the current development branch. # As products go to beta just add a command pointer to sr for that branch # and add an entry for it here in the switch. # set STACK set command = $0 set command = $command:t switch ($command) # # # D E M E T E R D E V L O P M E N T # # case sr: default: set DEV_TOP = /proj/tools/demeter/master set ADM = $DEV_TOP/adm set SR_TOP = $ADM/bin set LOCKS = $ADM/locks set WHATS_OUT = $SR_TOP/sr_whats_locked set SR_TEMPLATES = $SR_TOP/templates set HEADER_TAG = "**+++" set STACK=(srt_cont $STACK) ; goto FIND_DEMETER_PROJ srt_cont: switch ($PROJ) case DEMETER: set PROJ_NAME = "DEMETER_5.5" set B_NAME = demeter_5_5 set FILE_INIT_REV = 5.5 set TOOL_NAME = "$PROJ_NAME : Development branch" set TKN = demeter breaksw case DEMETER_5_5: set PROJ_NAME = "DEMETER_5.5" set B_NAME = demeter_5_5 set FILE_INIT_REV = 5.5 set TOOL_NAME = "$PROJ_NAME : Development branch" set TKN = demeter breaksw case DEMETER_5_4: set PROJ_NAME = "DEMETER_5.4" set B_NAME = demeter_5_4 set FILE_INIT_REV = 5.4 set TOOL_NAME = "$PROJ_NAME : Development branch" set TKN = demeter breaksw case DEMETER_5_2: set PROJ_NAME = "DEMETER_5.2" set B_NAME = demeter_5_2 set FILE_INIT_REV = 5.2 set TOOL_NAME = "$PROJ_NAME : Development branch" set TKN = demeter breaksw case DEMETER_5_1: set PROJ_NAME = "DEMETER_5.1" set B_NAME = demeter_5_1 set FILE_INIT_REV = 5.1 set TOOL_NAME = "$PROJ_NAME : Development branch" set TKN = demeter breaksw case DEMETER_5_0: set PROJ_NAME = "DEMETER_5.0" set B_NAME = demeter_5_0 set FILE_INIT_REV = 5.0 set TOOL_NAME = "$PROJ_NAME : Development branch" set TKN = demeter breaksw default: breaksw echo " Can't determine the project you are on .. exiting" echo "$PROJ" exit 1 endsw switch ($SUB_DIR) default: breaksw endsw # # Set up ape mail files # set BRANCH = -r$B_NAME set SR_MAIL_LIST = "demeter" set SR_LOG = $ADM/logs/SR set SR_ACTIVITY_FILE = $SR_LOG/$TKN set SR_MAIL_ROOT = $SR_LOG/{$TKN}_mail set SR_MAIL_LOG = $SR_MAIL_ROOT.{$USER} set SR_TEMP_MAIL = $SR_LOG/.tmp_{$TKN}_mail.{$USER} breaksw endsw # # Print header # echo " " echo "$TOOL_NAME $SUB_DIR - Branch: $B_NAME" echo " " # # Defines based on command used # set SRC_TEMPLATE = $SR_TEMPLATES/c_header set SRCH_TEMPLATE = $SR_TEMPLATES/ch_header set JPL_TEMPLATE = $SR_TEMPLATES/jpl_header set PC_TEMPLATE = $SR_TEMPLATES/pc_header set FSRC_TEMPLATE = $SR_TEMPLATES/sr_fsrc.temp set ASMSRC_TEMPLATE = $SR_TEMPLATES/sr_asmsrc.temp set LEX_TEMPLATE = $SR_TEMPLATES/lex_header set YACC_TEMPLATE = $SR_TEMPLATES/yacc_header set DOC_TEMPLATE = $SR_TEMPLATES/sr_doc.temp set SR_ACTIVITY_LOG = {$SR_ACTIVITY_FILE}.{$USER} set CI = ci set CO = "co $BRANCH" set RCS = rcs set SW_COMMENT = "None" # XXX This needs to be set differently under test !! # set SR_MAIL_LIST = abel # # Sub_Command processing # set SUB_COMMAND = $1 switch ($SUB_COMMAND) case newsrc: # # Initialize variables # if ($2 == "") then echo -n " Enter new src file name : " set NEW_FILE = $< else set NEW_FILE = $2 endif set STACK=(newsrc_cont $STACK) ; goto SET_TEMPLATE newsrc_cont: set FILE_TEMPLATE = $SRC_TEMP # # Do the RCS stuff # set NEW_LOCK = -l goto SR_NEW_FILES breaksw case newfile: # # Initialize variables # if ($2 == "") then echo -n " Enter new src file name : " set NEW_FILE = $< else set NEW_FILE = $2 endif # # Do the RCS stuff -- same as add files # set NEW_LOCK = -l goto SR_NEW_FILES breaksw case addsrc: case addfile: if ($2 == "") then echo -n " Enter file to add : " set NEW_FILE = $< else set NEW_FILE = $2 endif if ( ! -e $NEW_FILE ) then echo " SR_ERROR: Can't find ->$NEW_FILE<-" exit 1 endif if ( -e RCS/$NEW_FILE,v ) then echo " SR_ERROR: ->$NEW_FILE<- already in RCS " exit 1 endif # # Do the RCS stuff # set NEW_LOCK = " " goto SR_ADD_FILES breaksw case mystatus: echo " " echo " --- $PROJ_NAME File Lock List for $USER ---" echo " " find . -name RCS -exec $WHATS_OUT {} $USER \; breaksw case status: echo " " echo " --- $PROJ_NAME File Lock List ---" echo " " $WHATS_OUT ./RCS breaksw case allstatus: echo " " echo " --- $PROJ_NAME File Lock List ---" echo " " find . -name RCS -exec $WHATS_OUT {} \; breaksw case env: case myenv: if ( $?BUILD_HOME ) then set BLDHM = $BUILD_HOME else set BLDHM = "Default: Not Set" endif if ( $?DISPLAY ) then set DISPV = $DISPLAY else set DISPV = "Not set" endif more << DOC_ENV_END --- $PROJ_NAME Environment --- EDITOR : $ED DISPLAY : $DISPV BUILD_HOME : $BLDHM DOC_ENV_END breaksw case mail: goto SR_MAIL breaksw case mailfrom: switch ($2) case all: echo " " if ($3 == "") then foreach user_mail (`ls $SR_MAIL_ROOT.*`) echo " " echo " $user_mail:e :" more $user_mail end breaksw else foreach user_mail (`ls $SR_MAIL_ROOT.*`) echo " " echo " $user_mail:e :" set TT = "/MAIL_BEGIN $3/,/MAIL___END $3/" awk "$TT" $user_mail end breaksw endif default: if ( ! -e $SR_MAIL_ROOT.$2) then echo " SR: No mail file for user ->$2<-" breaksw endif if ($3 == "") then more $SR_MAIL_ROOT.$2 else set TT = "/MAIL_BEGIN $3/,/MAIL___END $3/" awk "$TT" $SR_MAIL_ROOT.$2 endif breaksw endsw breaksw case mlist: breaksw case edact: $ED $SR_ACTIVITY_LOG breaksw case act: case activity: switch ($2) case "": more {$SR_ACTIVITY_FILE}.$USER breaksw case all: echo " " if ($3 == "") then foreach user_act (`ls {$SR_ACTIVITY_FILE}.*`) echo " " echo " $user_act:e :" more $user_act end else foreach user_act (`ls {$SR_ACTIVITY_FILE}.*`) echo " " echo " $user_act:e :" fgrep $3 $user_act end endif breaksw default: if ( ! -e {$SR_ACTIVITY_FILE}.$2) then echo " SR: No activity for user ->$2<-" breaksw endif if ($3 == "") then more {$SR_ACTIVITY_FILE}.$2 else fgrep $3 {$SR_ACTIVITY_FILE}.$2 endif breaksw endsw breaksw case tailact: if ($2 == "") then set SWITCHES = -30 set TUSER = "" else @ user_index = 2 while ( ("$argv[$user_index]" =~ -*) || \ ("$argv[$user_index]" =~ +*) ) @ user_index ++ if($user_index > $#argv) break end @ opt_index = $user_index - 1 if ($opt_index == 1) then # No switches set set SWITCHES = -30 else # # Now setup SWITCHES # set SWITCHES foreach switch ( $argv[2-$opt_index] ) set SWITCHES = ($SWITCHES $switch) end endif set TUSER = $argv[$user_index] endif switch ($TUSER) case "": tail $SWITCHES {$SR_ACTIVITY_FILE}.$USER breaksw case all: echo " " foreach user_act (`ls {$SR_ACTIVITY_FILE}.*`) echo " " echo " $user_act:e :" tail $SWITCHES $user_act end breaksw default: if ( ! -e {$SR_ACTIVITY_FILE}.$TUSER) then echo " SR: No activity for user ->$TUSER<-" breaksw endif echo "SR: Activity for $TUSER :" tail $SWITCHES {$SR_ACTIVITY_FILE}.$TUSER breaksw endsw breaksw case grep: if ($2 == "") then echo " SR: You must provide a user name " breaksw else set GUSER = $2 if ($2 != "all") then if ( ! -e {$SR_ACTIVITY_FILE}.$GUSER) then echo " SR: No activity for user ->$GUSER<-" breaksw endif endif @ grep_index = 3 while ("$argv[$grep_index]" =~ -*) @ grep_index ++ end @ opt_index = $grep_index - 1 if ($opt_index == 2) then # No switches set set SWITCHES else # # Now setup SWITCHES # set SWITCHES foreach switch ( $argv[3-$opt_index] ) set SWITCHES = ($SWITCHES $switch) end endif endif switch ($GUSER) case all: echo " " foreach user_act (`ls {$SR_ACTIVITY_FILE}.*`) echo " " echo " Grep in Activity for $user_act:e :" grep $SWITCHES "$argv[$grep_index]" $user_act end breaksw default: echo "SR: Grep in Activity for $GUSER :" grep $SWITCHES "$argv[$grep_index]" \ {$SR_ACTIVITY_FILE}.$GUSER breaksw endsw breaksw case lock: if ( -e $LOCKS/$PROJ_NAME ) then set t_who = `ls -l $LOCKS/$PROJ_NAME | awk ' {print $3}' ` echo " SR_ERROR: $PROJ_NAME is already locked by >>$t_who<< " echo " " cat $LOCKS/$PROJ_NAME echo " " exit 1 endif echo -n " Enter reason: " set REASON = $< echo " Reason: "$REASON > $LOCKS/$PROJ_NAME echo " LOCK : $PROJ_NAME : $REASON ... DONE" echo " LOCK : $SR_DATE : $PROJ_NAME : $REASON" \ >>$SR_ACTIVITY_LOG breaksw case unlock: if ( ! -e $LOCKS/$PROJ_NAME ) then echo " SR_ERROR: $PROJ_NAME is not locked" exit 1 endif set t_who = `ls -l $LOCKS/$PROJ_NAME | awk ' {print $3}' ` if ( `whoami` != $t_who ) then echo " SR_ERROR: $PROJ_NAME user >>$t_who<< owens the lock " echo " " exit 1 endif rm -rf $LOCKS/$PROJ_NAME echo " UNLOCK : $PROJ_NAME : ... DONE " echo " UNLOCK : $SR_DATE : $PROJ_NAME :" \ >>$SR_ACTIVITY_LOG breaksw case ci: case co: set temp_v = `pwd | grep {$DEV_TOP}` # if ($#temp_v) then # echo " SR_Warning: You are in the ARCHIVE area" # echo " ->$DEV_TOP<- in your path " # echo " " # endif goto CONTINUE_SUB_COMMANDS case stab: case rel: case diff: case rdiff: case rlog: case rcs: case mp1p2: goto CONTINUE_SUB_COMMANDS breaksw default: echo " " echo " SR_ERROR: Unknown Subcommand ->$SUB_COMMAND<- " echo ' : Type "'$command' help" for list of subcommands' exit 1 breaksw endsw exit 0 CONTINUE_SUB_COMMANDS: # # The next commands need further parsing of the command line # All commands from here on out require at least a file name # # # Make sure the project is not locked # if ( -e $LOCKS/$PROJ_NAME ) then set t_who = `ls -l $LOCKS/$PROJ_NAME | awk ' {print $3}' ` echo " SR_WARNING: $PROJ_NAME archive locked by user >> $t_who << " echo " " cat $LOCKS/$PROJ_NAME echo " " exit 1 endif if ($2 == "") then echo " SR_ERROR: Need a filename to continue" echo " : use ->$command help<- for help" exit 1 endif # # Parse the command line looking for switches # @ file_index = 2 while ( "$argv[$file_index]" =~ -* ) @ file_index ++ end @ opt_index = $file_index - 1 # # Now setup SWITCHES # set SWITCHES foreach switch ( $argv[2-$opt_index] ) set SWITCHES = ($SWITCHES $switch) end # # Now setup FILES set FILES foreach file ( $argv[$file_index-] ) set FILES = ($FILES $file) end # # Parse the rest of the sub_commands # switch ($SUB_COMMAND) case ci: # # Checkin all the files to stable environment # foreach file ($FILES) if ( ! -e $file) then echo " SR_ERROR:Cant find file ->$file, $file,v<-" continue else if ( ! -e ./RCS/${file},v) then echo " SR_ERROR: Cant find RCS file ->$file,v<-" echo " If $file is a NEW FILE for RCS. " echo " Use: '$command addsrc $file' " echo " or: '$command addfile $file' " echo " see $command help for details " exit 1 endif endif $CI -u $SWITCHES -sStab $file if ($status) exit $status echo " CI$SUB_DIR : $SR_DATE : $SWITCHES $file : " \ >>$SR_ACTIVITY_LOG # # Need to touch local files so that RCS # does not check it out again. Problem # with ci -l option. # if ( -w $file) touch $file chgrp demsys ./RCS/${file},v chmod o-rwx ./RCS/${file},v chgrp demsys $file chmod o-rwx $file end breaksw case co: # # Checkout all the files from stable environment # foreach file ( $FILES ) $CO $SWITCHES $file if ($status) exit $status if ( -w $file) then chgrp demsys ./RCS/${file},v chmod o-rwx ./RCS/${file},v endif chgrp demsys $file chmod o-rwx $file if ($SWITCHES != "") then echo " CO$SUB_DIR : $SR_DATE : $SWITCHES $file : " \ >>$SR_ACTIVITY_LOG endif end breaksw case stab: $RCS -sStab:$B_NAME $FILES if ($status) exit $status echo " stable : $SR_DATE : $FILES : " >>$SR_ACTIVITY_LOG breaksw case rel: $RCS -sRel:$B_NAME $FILES if ($status) exit $status echo " released : $SR_DATE : $FILES : " >>$SR_ACTIVITY_LOG breaksw case rcs: $RCS $SWITCHES $FILES set exit_stat = $status if ( $exit_stat ) exit $exit_stat echo " RCS$SUB_DIR : $SR_DATE : $SWITCHES $FILES : " \ >>$SR_ACTIVITY_LOG chmod 444 $FILES exit $exit_stat breaksw case mp1p2: if ( $B_NAME != demeter_5_0) then echo " You must be in ipride to make the merge " echo " " exit 1 endif set tfile = $FILES[1] set lock_count = `rlog -R -L $tfile` if ( $#lock_count != 0 ) then echo "Cannot merge files until locks on $tfile are removed" echo " " exit 1 endif co -ldemeter_5_1 $tfile if ( $status ) then echo "Cannot merge files until demeter_5_1 can be checked out" echo " " exit 1 endif set p1 = `rlog -rdemeter_5_0 $tfile | \ grep ^revision | awk '{print $2}' | head -1` set p2 = `rlog -rdemeter_5_0 $tfile | \ grep ^revision | awk '{print $2}' | head -1` rm -f $tfile.merge rcsmerge -p -rdemeter_5_1 -rdemeter_5_0 $tfile > $tfile.merge grep -q ">>>>" $tfile.merge if ( $status ) then echo "Merge was succesfull" mv $tfile.merge $tfile sr ci $tfile << EOF Auto Merge $p1 and $p2 revisions EOF echo " MR$SUB_DIR : $SR_DATE : OK $tfile : " \ >>$SR_ACTIVITY_LOG else echo " " echo " Merge had problems" echo " Please reconcile differences in $tfile.merge" echo " then run \"sr fixmerge $tfile\" " echo " " echo " MR$SUB_DIR : $SR_DATE : BAD $tfile : " \ >>$SR_ACTIVITY_LOG endif breaksw case fixmerge: if ( $B_NAME != demeter_5_0) then echo " You must be in ipride to fix the merge " echo " " exit 1 endif set tfile = $FILES[1] if ( -e $tfile.merge ) then echo "Cannot find $tfile.merge ... exiting" echo " " exit 1 endif set lock_count = `rlog -R -L $tfile` if ( $#lock_count == 0 ) then co -ldemeter_5_0 $tfile endif cp $tfile.merge $file ci -rdemeter_5_0 $file co -u -rdemeter_5_0 $file echo " MRF$SUB_DIR : $SR_DATE : FIX $tfile : " \ >>$SR_ACTIVITY_LOG breaksw case diff: rcsdiff $BRANCH $SWITCHES $FILES exit $status breaksw case rdiff: rcsdiff -rdemeter_5_0 -rdemeter_5_1 $FILES exit $status breaksw case rlog: rlog $BRANCH $SWITCHES $FILES exit $status breaksw default: echo " " echo " SR_ERROR: Unknown Subcommand ->$SUB_COMMAND<- " echo ' : Type "'$command' help" for list of subcommands' exit 1 endsw exit 0 # # --- SR_NEW_FILES --- # SR_NEW_FILES: if ( -e $NEW_FILE || -e ./RCS/$NEW_FILE,v ) then echo " SR_ERROR: file $NEW_FILE already exists" exit 1 endif if ( $FILE_TEMPLATE == "None" ) then echo " SR_ERROR: Unknown src file type" exit 1 endif echo " Using $FILE_TEMPLATE:t as the template for $NEW_FILE" # # Prepare to replace filename and autor in heading # newsrc $NEW_FILE if ( $status ) exit $status # # Intentional fall through # SR_ADD_FILES: if ( ! -d ./RCS ) then mkdir RCS chgrp demsys RCS chmod 0770 RCS endif if ( "$SW_COMMENT" != "None") then $RCS -i "$SW_COMMENT " $NEW_FILE << EOF_NEW_FILES New Rcs File EOF_NEW_FILES else $RCS -i $NEW_FILE << EOF_NEW_FILES New Rcs File EOF_NEW_FILES endif $CI -f{$FILE_INIT_REV} -m"Initial file" $NEW_FILE << EOF_NEW_FILES Original file before moving to branch EOF_NEW_FILES if ($status) then echo " SR_ERROR: Can't check in the file ... cleaning up" exit 1 endif # # Create the new branch # co $NEW_FILE ci -f{$FILE_INIT_REV}.1 -m"spin for the --$B_NAME-- branch" $NEW_FILE rcs -N{$B_NAME}:{$FILE_INIT_REV}.1 $NEW_FILE # # Now checkout on the branch -locked $CO $NEW_LOCK $NEW_FILE if ($status) then echo " SR_ERROR: Can't check out $NEW_FILE on branch $B_NAME " exit 1 endif chgrp demsys ./RCS/${NEW_FILE},v chmod o-rwx ./RCS/${NEW_FILE},v chgrp demsys $NEW_FILE chmod o-rwx $NEW_FILE echo " NewFile$SUB_DIR : $SR_DATE : $2 : " >>$SR_ACTIVITY_LOG exit 0 # # --- SR_MAIL --- # SR_MAIL: # # Initialize variables # echo -n " Mail subject: " set SUBJECT = $< echo "MAIL_BEGIN $SR_DATE" >> $SR_MAIL_LOG echo " " echo " " echo " $TOOL_NAME" Mail echo " ---------------------------------------" echo " Please enter your mail message in the following editing" echo " session and terminate normally with the regular editor exit" echo " " echo "" sleep 1 $ED $SR_TEMP_MAIL set ans = junk while ($ans == junk ) echo " " echo " send (s) : send now " echo " preserve (p) : do not send, preserve till next $command mail" echo " abort (a) : abort send, remove mail file" echo " " echo "" echo -n " (s/p/a) ? " set ans = $< switch ($ans ) case s: case S: case send: breaksw case p: case P: case preserve: echo " mail preserved" exit 1 breaksw case a: case A: case abort: echo " mail aborted" rm -f $SR_TEMP_MAIL exit 1 breaksw default: set ans = junk endsw end cat $SR_TEMP_MAIL >> $SR_MAIL_LOG echo "MAIL___END $SR_DATE" >> $SR_MAIL_LOG # Now send the mail mailx $SR_MAIL_LIST << END_MAIL ~s $PROJ_NAME : $SUBJECT ~r $SR_TEMP_MAIL END_MAIL echo " SENT MAIL: $SR_DATE" >> $SR_ACTIVITY_LOG rm -f $SR_TEMP_MAIL exit 0 # # FIND_DEMETER_PROJ # FIND_DEMETER_PROJ: set PROJ = DEMETER switch ($TPWD) case */adm*: set SUB_DIR = _ADM ; breaksw case */doc*: set SUB_DIR = _DOC ; breaksw case */config*: set SUB_DIR = _CFG ; breaksw case */config/Demeter*: set SUB_DIR = _CFD ; breaksw case */include*: set SUB_DIR = _INC ; breaksw case */man*: set SUB_DIR = _MAN ; breaksw case */fixed*: set SUB_DIR = _FIX ; breaksw case */lib-SI*: set SUB_DIR = _LSI ; breaksw case */lib-MI*: set SUB_DIR = _LMI ; breaksw case */bin*: set SUB_DIR = _BIN ; breaksw case */src: set SUB_DIR = _SRC ; breaksw case */src/build: set SUB_DIR = _BLD ; breaksw case */src/sem-check: set SUB_DIR = _SEM ; breaksw case */src/generate: set SUB_DIR = _GEN ; breaksw case */src/headers: set SUB_DIR = _HDR ; breaksw case */src/comp-pp: set SUB_DIR = _CMP ; breaksw case */src/gen-hash: set SUB_DIR = _HSH ; breaksw case */src/xref: set SUB_DIR = _XRF ; breaksw case */src/cd-learn: set SUB_DIR = _LRN ; breaksw case */cd-abstract: set SUB_DIR = _CAB ; breaksw case */cd-english: set SUB_DIR = _CEN ; breaksw case */gen-imakefile: set SUB_DIR = _GMK ; breaksw case */gen-include: set SUB_DIR = _GIN ; breaksw case */generic: set SUB_DIR = _GRC ; breaksw case */xcddraw: set SUB_DIR = _XCD ; breaksw case */xdemeter: set SUB_DIR = _XDR ; breaksw case */tree-prop: set SUB_DIR = _TRE ; breaksw case */propagate: set SUB_DIR = _PRO ; breaksw case */pp-abs: set SUB_DIR = _PAB ; breaksw case */generic/dh: set SUB_DIR = _GDH ; breaksw case */genric/env: set SUB_DIR = _ENV ; breaksw case */genric/exec: set SUB_DIR = _EXE ; breaksw case */genric/hash: set SUB_DIR = _GHS ; breaksw case */genric/input: set SUB_DIR = _INP ; breaksw case */genric/output: set SUB_DIR = _OUT ; breaksw case */genric/terminals: set SUB_DIR = _TER ; breaksw case */genric/top: set SUB_DIR = _TOP ; breaksw case */genric/version: set SUB_DIR = _VER ; breaksw case */genric/trace: set SUB_DIR = _GTR ; breaksw case */cd-abstract: set SUB_DIR = _CAB ; breaksw case */util: set SUB_DIR = _UTL ; breaksw default: set SUB_DIR = "____" ; breaksw endsw goto RETURN SET_TEMPLATE: set file_ext = $NEW_FILE:e switch ($file_ext) case s: set SRC_TEMP = $ASMSRC_TEMPLATE set SW_COMMENT = -c"// *" breaksw case c: set SRC_TEMP = $SRC_TEMPLATE set SW_COMMENT = -c"** " breaksw case l: set SRC_TEMP = $LEX_TEMPLATE set SW_COMMENT = -c" ** " breaksw case y: set SRC_TEMP = $YACC_TEMPLATE set SW_COMMENT = -c"** " breaksw case h: set SRC_TEMP = $SRCH_TEMPLATE set SW_COMMENT = -c"** " breaksw case pc: set SRC_TEMP = $PC_TEMPLATE set SW_COMMENT = -c"** " breaksw case jpl: set SRC_TEMP = $JPL_TEMPLATE set SW_COMMENT = -c": " breaksw default: echo " SR: Don't recognise extension" echo " No header added " set SRC_TEMP = "None" set SW_COMMENT = "None" endsw goto RETURN RETURN: set temp=$STACK[1] set STACK=$STACK[2-] goto $temp # # #