$! CHANGEALL.COM $! 16-JUN-1994 $! David Mathog, biology division, Caltech $! $! this routine searches through all specified files and $! replaces every instance of P1 with P2. Also, it $! outputs the list of files affected so that they can $! be recompiled later. $! P3, a slash delimited list of file types to act on, $! like "*.for,*.c,*.h" $! P4, if supplied, is the directory it works in $ $ if("''P1" .nes. "" .and. "''P2" .nes. "") $then $ write sys$output "Globally changing all <''P1'> to <''P2'>" $ write sys$output " The list of files changed will be in CHANGED.TXT" $ write sys$output " Changes will also be sent to sys$output" $ $else $ write sys$output "Either P1, P2, or both, not specified" $endif $ if("''P3'" .eqs. "") $then $ write sys$Output "Errro: You must specify a , delimited set of filenames" $ write sys$Output "which specify the files to work on, for instance:" $ write sys$Output " *.for,*.c,*.h,some*.pas " $ exit $endif $ if("''P4'" .nes. "")then set default "''P4'" $! $ open/write tfil: changekill.kill $ write tfil: "$ edit/edt/nocommand zip" $ write tfil: "subs /''P1'/''P2'/W" $ write tfil: "exit" $ close tfil: $! $ define/user sys$output nla0: $ edit/edt/nocomma changekill.kill subs /zip/'P1'/W exit $ purge changekill.kill $! $ open/write tfil: changed.txt $ NUM = 0 $EXTEND: $ PATTERN = F$ELEMENT(NUM,",",P3) $ if PATTERN .eqs. "," then goto BYEBYE $ write sys$output "Now processing files matching ''PATTERN'" $ NUM = NUM + 1 $TOP: $ FILE = F$SEARCH(PATTERN) $ if(FILE .eqs. "")then goto EXTEND $ define/user sys$output nla0: $ define/user sys$error nla0: $ search 'FILE' 'P1' $ if ($STATUS .eqs. "%X00000001") $then $ write TFIL: FILE $ write sys$output "changes to: ''FILE'" $ @changekill.kill "''FILE'" $endif $ goto TOP $ BYEBYE: $ close tfil: $ delete/nolog changekill.kill.* $ write sys$output "All done"