#!/bin/sh # # This is a shell archive. To extract its contents, # execute this file with /bin/sh to create the file(s): # # Makefile.I4GL qmake sdelta sidprt # Makefile.ISQL qmake4gl sdifflast sinfo # README remake sdiffs sls # clean4gl remake4gl sedit sprt # make4gl save sget sprtlast # makehere sclean sgetall stell # mf_sample1 scleanbk sgetprev sunedit # mf_sample2 screate showdbe trymake # obj4gl sdelget sidchk visit # # This shell archive created: Tue Sep 17 14:38:31 EDT 2002 # echo "Extracting file Makefile.I4GL" sed -e 's/^X//' <<\SHAR_EOF > Makefile.I4GL X# Makefile.I4GL X# X# X# (c) Copyright 1987 - 2002 X# X# All Rights Reserved. X# X# X# This Makefile contains suffix and general creation rules common to files X# related to Informix-4GL. It is meant to be "included" by the Makefile X# used in your application. X# X# If you need to add arguments to the c4gl command line, set the variable X# MAKE4GLFLAGS in your application's Makefile. X# X# Typical lines in your Makefile might look like: X# X# # X# # Set c4gl compiler flags X# # X# X# MAKE4GLFLAGS=-lspc1 -lspc2 X# X# # X# # Include general Informix Makefile X# # X# X# include $(INFORMIXDIR)/Makefile.I4GL X# X# Note that there are no quotation marks used to set MAKE4GLFLAGS. If you do X# put quotation marks to the right of the "=", they will be included on the X# command line used when you run make. X# X# Suffixes and rules are also included to compile Ace reports into their X# associated report control files. While Ace is not strictly a part of X# I4GL, Ace rules are included in this file as a convience for applications X# that are primarily I4GL-based, but that also contain Ace reports. X# X# Since I4GL screen files and ISQL sperform files have the same source and X# object suffixes, there is no simple general way distinguish between the X# two types of files. This must be done within the application's Makefile. X# X X X# X# Informix-4GL suffix rules X# X# .4ge standard I4GL executable binary file X# .4gl I4GL source file X# .ace Ace report source file X# .arc compiled Ace report control file X# .frm compiled screen form file X# .hlp help source file X# .hx compiled help file X# .msg compiled help file X# .per screen from source file X# .x executable binary file X# X X.SUFFIXES : .4ge .4gl .ace .arc .frm .hlp .hx .msg .per .x X X X# X# Use GNU C compiler X# X XCC=gcc X X X# X# Create progname.4ge from progname.4gl X# X X%.4ge : %.4gl X c4gl $< $(MAKE4GLFLAGS) -o $@ X X# X# Create progname.o from progname.4gl - if progname.c is present, X# it will take precedence X# X X%.o : %.4gl X c4gl -c $< $(MAKE4GLFLAGS) X X# X# Create progname.x from progname.4gl X# X X%.x : %.4gl X c4gl $< $(MAKE4GLFLAGS) -o $@ X X# X# Create progname from progname.4gl X# X X% : %.4gl X c4gl $< $(MAKE4GLFLAGS) -o $@ X X# X# Create formname.frm from formname.per X# X X%.frm : %.per X form4gl $* X X# X# Create helpfile.hx from helpfile.hlp X# X X%.hx : %.hlp X mkmessage $< $@ X X# X# Create helpfile.msg from helpfile.hlp X# X X%.msg : %.hlp X mkmessage $< $@ X X# X# Create reportname.arc from reportname.ace X# X X%.arc : %.ace X saceprep $* SHAR_EOF if [ `wc -c < Makefile.I4GL` -ne 2658 ] then echo "Lengths do not match -- Bad Copy of Makefile.I4GL" fi echo "Extracting file Makefile.ISQL" sed -e 's/^X//' <<\SHAR_EOF > Makefile.ISQL X# Makefile.ISQL X# X# X# (c) Copyright 1987 - 2002 X# X# All Rights Reserved. X# X# X# This Makefile contains suffix and general creation rules common to files X# related to Informix-SQL. It is meant to be "included" by the Makefile X# used in your application. X# X# Typical lines in your Makefile might look like: X# X# # X# # Include general Informix Makefile X# # X# X# include $(INFORMIXDIR)/Makefile.ISQL X# X X X# X# Informix-SQL suffix rules X# X# .ace Ace report source file X# .arc compiled Ace report control file X# .frm compiled screen form file X# .per screen from source file X# X X.SUFFIXES : .ace .arc .frm .per X X X# X# Use GNU C compiler X# X XCC=gcc X X X# X# Create reportname.arc from reportname.ace X# X X%.arc : %.ace X saceprep $* X X# X# Create formname.frm from formname.per X# X X%.frm : %.per X sformbld $* SHAR_EOF if [ `wc -c < Makefile.ISQL` -ne 900 ] then echo "Lengths do not match -- Bad Copy of Makefile.ISQL" fi echo "Extracting file README" sed -e 's/^X//' <<\SHAR_EOF > README XREADME for make_sccs package X X XSummary: Example Makefiles and SCCS utilities for I4GL X XEnvironment: SunOS/Solaris, Informix-4GL, Informix-SQL X XAuthor: Walt Hultgren, walt@iiug.org X X XThese files are a collections of sample Makefiles and utilities for use with XSCCS for Informix-4GL and Informix-SQL development. X XThese tools are designed to be used in an environment for the following Xcharacteristics: X X o Informix source file are edited from the command line with vi or some X other text editor. X X o The "make" command is used to build files rather than the i4gl program X development environment supplied with IBM Informix. X X o SCCS is used as a source repository. X X o If multiple developers work from the same SCCS repository, each user works X in their own directory. The source repository is accessed by placing a X symbolic link named "SCCS" in each user's working directory that point to X the central SCCS directory that holds the SCCS delta files. X X o The alternate method of setting the environment variable $PROJECTDIR to X the pathname of the central SCCS directory is not supported. X X o All SCCS delta files that begin with "s." reside in the repository X directory. Thus, command line arguments that start with "s." will be X passed to the scripts as-is without being expanded even if they contain X wildcard characters (e. g., "sls s.*.4gl"). The scripts recognize this X construct as an indication that the SCCS directory should be searched X for matching files. X X o If a development directory contains subdirectories, the Makefile in that X directory does not necessarily have to be constructed so that a make in X that directory causes a make in all lower emanating subdirectories. The X "visit" command provides that functionality for those occasions when a X cascading make is needed. X X XThe following sample Makefiles are included: X XMakefile.I4GL general Makefile for I4GL meant to be included in others XMakefile.ISQL general Makefile for ISQL meant to be included in others Xmf_sample1 sample Makefile showing 4GL development Xmf_sample2 sample Makefile showing conditional operations X X XThe following utilities and scripts are included: X Xmake4gl version of make allowing 4GL-related source file names Xqmake run make "quietly" (in background) Xqmake4gl run make4gl "quietly" (in background) Xremake force make of specified files Xremake4gl force make4gl of specified files Xmakehere detect presence of [Mm]akefile Xtrymake do a make if [Mm]akefile is present Xobj4gl list 4GL-related object files names of specified source files X Xsclean sccs clean - remove safely checked in files Xscleanbk sccs clean, remove .BK files if originals checked into SCCS Xscreate sccs create - check a newly created files into SCCS Xsdelget sccs delget - check in delta and check read-only copy back out Xsdelta sccs delta - check in delta of files Xsdifflast sccs sccsdiff on most recent delta Xsdiffs sccs diffs - diff files against SCCS copies Xsedit sccs edit - check out files for editing Xsget sccs get - check out files read-only Xsgetall sccs get - check out all deltas of files Xsgetprev sccs get - check out files read-only as before last delta Xsidchk check files for SCCS ID Xsidprt generate standard SCCS ID Xsinfo sccs info - report files currently checked out for editing Xsls do an ls on SCCS directory Xsprt sccs prt - print delta history Xsprtlast print delta info for most recent delta Xstell list names only of files currently checked out for editing Xsunedit sccs unedit - release edit check-out without changing SCCS file X Xclean4gl clean up 4GL temporary files Xsave save a timestamped version of a file Xshowdbe show database-related environment variables Xvisit recursively visit sub-directories and execute a command X X XAll information and files are provided as-is. SHAR_EOF if [ `wc -c < README` -ne 4086 ] then echo "Lengths do not match -- Bad Copy of README" fi echo "Extracting file clean4gl" sed -e 's/^X//' <<\SHAR_EOF > clean4gl X#!/bin/sh X# X# clean4gl Clean up Informix-4GL temporary files X# X# X# SCCS ID: @(#) clean4gl 1.3 11/19/01 X# @(#) (c) Copyright 2001. All rights reserved. X# X# X X Xif [ $# -le 0 ] Xthen X echo "usage: clean4gl file1.4gl [file2.4gl ...]" X exit 1 Xfi X X Xfor ARG in $* Xdo X case $ARG in X X *.4gl ) X X BASE=`basename $ARG .4gl` X X for SUFFIX in ec c X do X FILE=$BASE.$SUFFIX X X if [ -f $FILE ] X then X echo rm $FILE X rm $FILE X fi X done X ;; X X * ) X X echo "clean4gl: '$ARG' ignored" X ;; X X esac X Xdone SHAR_EOF if [ `wc -c < clean4gl` -ne 642 ] then echo "Lengths do not match -- Bad Copy of clean4gl" fi echo "Extracting file make4gl" sed -e 's/^X//' <<\SHAR_EOF > make4gl X#!/bin/sh X# X# make4gl Make Informix-4GL executables and control files X# X# X# Note: The (-f) make option will confuse this script. X# X# X# SCCS ID: @(#) make4gl 1.6 11/19/01 22:19:02 X# @(#) (c) Copyright 2001. All rights reserved. X# X# X X XUSAGE='usage: make4gl [-iL] [some make opts] files' X X Xif [ $# -eq 0 ] Xthen X echo "$USAGE" 1>&2 X exit 1 Xfi X X X# X# Scan command line to build option and file lists X# X XINST_OPTS='' XMAKE_OPTS='' XFILE_LIST='' XN_OPT='' X Xfor ARG in $* Xdo X case "$ARG" in X X -i ) X INST_OPTS="$INST_OPTS -r" X ;; X X -L ) X INST_OPTS="$INST_OPTS -L" X ;; X X -n ) X MAKE_OPTS="$MAKE_OPTS -n" X N_OPT="-n" X ;; X X -* ) X MAKE_OPTS="$MAKE_OPTS $ARG" X ;; X X s.* ) X for FILE in `cd SCCS ; ls $ARG | sed 's/^s\.//'` X do X FILE_LIST="$FILE_LIST $FILE" X done X ;; X X * ) X FILE_LIST="$FILE_LIST $ARG" X ;; X esac Xdone X X Xif [ -z "$FILE_LIST" ] Xthen X echo "make4gl: at least one file or make target required" 1>&2 X echo "$USAGE" 1>&2 X exit 1 Xfi X X Xif [ -n "$INST_OPTS" -a -n "$N_OPT" ] Xthen X INST_OPTS="$INST_OPTS $N_OPT" Xfi X X X# X# Look for Makefile.I4GL X# X XMAKEFILE_GEN='' X Xfor DIR1 in . $HOME $INFORMIXDIR Xdo X for DIR2 in . bin etc lib X do X if [ -r "$DIR1/$DIR2/Makefile.I4GL" ] X then X MAKEFILE_GEN="$DIR1/$DIR2/Makefile.I4GL" X break 2 X fi X done Xdone X X X# X# Process each file X# X Xfor FILE in $FILE_LIST Xdo X X # X # Set source and/or binary file suffixes if the specified file is X # one this script can process. X # X X case $FILE in X X *.4gl ) SRC_SUF='4gl' ; OBJ_SUF='4ge' ; BASE=`basename $FILE .4gl` ;; X *.ace ) SRC_SUF='ace' ; OBJ_SUF='arc' ; BASE=`basename $FILE .ace` ;; X *.hlp ) SRC_SUF='hlp' ; OBJ_SUF='hx' ; BASE=`basename $FILE .hlp` ;; X *.per ) SRC_SUF='per' ; OBJ_SUF='frm' ; BASE=`basename $FILE .per` ;; X X *.4ge ) SRC_SUF='NONE' ; OBJ_SUF='' ;; X *.arc ) SRC_SUF='NONE' ; OBJ_SUF='' ;; X *.frm ) SRC_SUF='NONE' ; OBJ_SUF='' ;; X *.msg ) SRC_SUF='NONE' ; OBJ_SUF='' ;; X *.hx ) SRC_SUF='NONE' ; OBJ_SUF='' ;; X *.o ) SRC_SUF='NONE' ; OBJ_SUF='' ;; X *.x ) SRC_SUF='NONE' ; OBJ_SUF='' ;; X X * ) SRC_SUF='' ;; # indicate file should be skipped X X esac X X X # X # If file is a valid I4GL source or object file, make the target; else X # skip it. X # X X if [ -n "$SRC_SUF" ] X then X X # X # Generate target file name if necessary X # X X if [ -n "$OBJ_SUF" ] X then X DIR=`dirname $FILE` X X if [ "$DIR" != "." ] X then X OBJECT="$DIR/$BASE.$OBJ_SUF" X else X OBJECT="$BASE.$OBJ_SUF" X fi X else X OBJECT="$FILE" X fi X X X # X # Make target file X # X X if makehere X then X echo make $MAKE_OPTS $OBJECT X make $MAKE_OPTS $OBJECT X else X if [ -n "$MAKEFILE_GEN" ] X then X echo make -f $MAKEFILE_GEN $MAKE_OPTS $OBJECT X make -f $MAKEFILE_GEN $MAKE_OPTS $OBJECT X else X echo "make4gl: cannot find any makefile" 1>&2 X echo "$USAGE" 1>&2 X exit 1 X fi X fi X X X # X # Install and remove target file if requested X # X X if [ -n "$INST_OPTS" ] X then X echo finstall $INST_OPTS $OBJECT X finstall $INST_OPTS $OBJECT X fi X fi Xdone SHAR_EOF if [ `wc -c < make4gl` -ne 3732 ] then echo "Lengths do not match -- Bad Copy of make4gl" fi echo "Extracting file makehere" sed -e 's/^X//' <<\SHAR_EOF > makehere X#!/bin/sh X# X# makehere See if a Makefile exists X# X# X# Usage: if makehere X# then X# ... process with make command X# else X# ... process without make command X# fi X# X# X# SCCS ID: @(#) makehere 1.3 11/19/01 09:32:23 X# @(#) (c) Copyright 2001. All rights reserved. X# X X Xfor NAME in Makefile makefile Xdo X if [ -f $NAME -o -f SCCS/s.$NAME ] X then X exit 0 X fi Xdone X Xexit 1 SHAR_EOF if [ `wc -c < makehere` -ne 459 ] then echo "Lengths do not match -- Bad Copy of makehere" fi echo "Extracting file mf_sample1" sed -e 's/^X//' <<\SHAR_EOF > mf_sample1 X# Sample Makefile X# X# X X X# X# Set library for generic c4gl commands X# X XMAKE4GLFLAGS = -L$$HOME/test/lib -ltest X X X# X# Include general I4GL Makefile X# X Xinclude $(INFORMIXDIR)/Makefile.I4GL X X XFORMS = testprog1.frm \ X testprog2.frm X XHELP = testprog.hx X XPROGS = testprog1 \ X testprog2.4ge \ X testprog3.4ge X XALL = $(FORMS) $(HELP) $(PROGS) X XBIN_DIR = /usr/local/bin X X Xall : $(ALL) X Xforms : $(FORMS) X Xprograms : $(PROGS) X X Xtestprog2.4ge : testprog2.o testsubs.o X c4gl testprog2.o testsubs.o $(MAKE4GLFLAGS) -o $@ X Xinstall : $(ALL) X for FILE in $(ALL) ; \ X do \ X install $$FILE $$BIN_DIR ; \ X done X Xclean : X rm -f $(ALL) *.o SHAR_EOF if [ `wc -c < mf_sample1` -ne 651 ] then echo "Lengths do not match -- Bad Copy of mf_sample1" fi echo "Extracting file mf_sample2" sed -e 's/^X//' <<\SHAR_EOF > mf_sample2 X# Sample Makefile X# X# X X XARCH_DIR = /public/ftp/pub/informix/list X XINDEX_OLD = index.dat.old XINDEX_DAT = $(ARCH_DIR)/index.dat XINDEX_SUB = $(ARCH_DIR)/index.sub X X Xall : new index X Xindex : $(INDEX_SUB) X X Xnew : X @COUNT=`ls list.* newsgate.* 2>/dev/null | wc -l` ; \ X if [ "$$COUNT" -gt 0 ] ; \ X then \ X echo cp $(INDEX_DAT) $(INDEX_OLD) ; \ X cp $(INDEX_DAT) $(INDEX_OLD) ; \ X fi X @for FILE in `ls list.* newsgate.* 2>/dev/null` ; \ X do \ X echo addarch $$FILE ; \ X addarch $$FILE ; \ X done X X$(INDEX_SUB) : $(INDEX_DAT) X mkindex $(INDEX_DAT) > $(INDEX_SUB) X chmod 644 $(INDEX_SUB) SHAR_EOF if [ `wc -c < mf_sample2` -ne 587 ] then echo "Lengths do not match -- Bad Copy of mf_sample2" fi echo "Extracting file obj4gl" sed -e 's/^X//' <<\SHAR_EOF > obj4gl X#!/bin/sh X# X# obj4gl List object counterparts of Informix-4GL source files X# X# X# Usual usage: make `obj4gl source_file(s)` X# X# X# SCCS ID: @(#) obj4gl 1.2 11/13/01 10:51:23 X# @(#) (c) Copyright 2001. All rights reserved. X# X# X X X# X# Insure there is at least one file name. X# X Xif [ $# -eq 0 ] Xthen X echo "usage: obj4gl source_file(s)" X exit 1 Xfi X X Xfor SOURCE in $* Xdo X case $SOURCE in X X *.4gl ) SRC_SUF="4gl" ; OBJ_SUF="4ge" ;; X *.ace ) SRC_SUF="ace" ; OBJ_SUF="arc" ;; X *.hlp ) SRC_SUF="hlp" ; OBJ_SUF="hx" ;; X *.per ) SRC_SUF="per" ; OBJ_SUF="frm" ;; X * ) SRC_SUF="" ;; X X esac X X X if [ -n "$SRC_SUF" ] X then X echo $SOURCE | sed "s/\.${SRC_SUF}$/.${OBJ_SUF}/" X fi Xdone SHAR_EOF if [ `wc -c < obj4gl` -ne 760 ] then echo "Lengths do not match -- Bad Copy of obj4gl" fi echo "Extracting file qmake" sed -e 's/^X//' <<\SHAR_EOF > qmake X#!/bin/sh X# X# qmake Quiet make X# X# X# SCCS ID: @(#) qmake 1.2 11/13/01 10:51:23 X# @(#) (c) Copyright 2001. All rights reserved. X# X# X X#if [ $# -le 0 ] X#then X# echo "usage: qmake make_args" X# exit 1 X#fi X X XPROC=$$ XOUT_FILE="Qmake.$PROC" X X Xecho "make $* > $OUT_FILE" X Xecho make $* > $OUT_FILE Xdate >> $OUT_FILE Xecho >> $OUT_FILE X X Xnohup /usr/bin/time make $* >> $OUT_FILE 2>&1 & X Xecho $! SHAR_EOF if [ `wc -c < qmake` -ne 410 ] then echo "Lengths do not match -- Bad Copy of qmake" fi echo "Extracting file qmake4gl" sed -e 's/^X//' <<\SHAR_EOF > qmake4gl X#!/bin/sh X# X# qmake4gl Quiet make4gl X# X# X# SCCS ID: @(#) qmake4gl 1.2 11/13/01 10:51:23 X# @(#) (c) Copyright 2001. All rights reserved. X# X# X X Xif [ $# -le 0 ] Xthen X echo "usage: qmake4gl [-i] source_files" X exit 1 Xfi X X XPROC=$$ XOUT_FILE="Qmake4gl.$PROC" X X Xecho "make4gl $* > $OUT_FILE" X Xecho make4gl $* > $OUT_FILE Xdate >> $OUT_FILE Xecho >> $OUT_FILE X Xnohup /usr/bin/time make4gl $* >> $OUT_FILE 2>&1 & X Xecho $! SHAR_EOF if [ `wc -c < qmake4gl` -ne 437 ] then echo "Lengths do not match -- Bad Copy of qmake4gl" fi echo "Extracting file remake" sed -e 's/^X//' <<\SHAR_EOF > remake X#!/bin/sh X# X# remake Remake files using make X# X# X# SCCS ID: @(#) remake 1.3 11/13/01 10:51:24 X# @(#) (c) Copyright 2001. All rights reserved. X# X# X X X# X# Check file name(s) X# X Xfor FILE in $* Xdo X case $FILE in X *.4ge | *.arc | *.frm | *.hx | *.muo | *.mus | *.o | *.x ) ;; X X * ) X echo "remake: only .4ge, .arc, .frm, .hx and .x files allowed" 1>&2 X exit 1 X ;; X esac Xdone X X X# X# Process file argument(s) X# X Xfor FILE in $* Xdo X X # X # Remove file X # X X rm $FILE X X STATUS=$? X X if [ $STATUS -ne 0 ] X then X exit $STATUS X fi X X X # X # Make file X # X X make $FILE X Xdone SHAR_EOF if [ `wc -c < remake` -ne 658 ] then echo "Lengths do not match -- Bad Copy of remake" fi echo "Extracting file remake4gl" sed -e 's/^X//' <<\SHAR_EOF > remake4gl X#!/bin/sh X# X# remake4gl Make Informix-4GL executables and control files X# X# X# SCCS ID: @(#) remake4gl 1.2 11/13/01 10:51:24 X# @(#) (c) Copyright 2001. All rights reserved. X# X# X X XMAKEFILE_GEN="$INFORMIXDIR/Makefile.I4GL" X X Xif [ $# -eq 0 ] Xthen X echo "usage: remake4gl [-i] file(s)" X exit 1 Xfi X X X# X# Scan command line to build option and file lists X# X XINSTALL='' XMAKE_OPT='' XFILE_LIST='' X Xfor ARG in $* Xdo X case "$ARG" in X X -i ) X INSTALL='Y' X shift X ;; X X -* ) X MAKE_OPT="$MAKE_OPT $ARG" X shift X ;; X X s.* ) X for FILE in `cd SCCS ; ls $ARG | sed 's/^s\.//'` X do X FILE_LIST="$FILE_LIST $FILE" X done X X shift X ;; X X * ) X FILE_LIST="$FILE_LIST $ARG" X shift X ;; X esac Xdone X X X# X# Process each file X# X Xfor FILE in $FILE_LIST Xdo X case $FILE in X X *.4gl ) SRC_SUF='4gl' ; OBJ_SUF='4ge' ; BASE=`basename $FILE .4gl` ;; X *.ace ) SRC_SUF='ace' ; OBJ_SUF='arc' ; BASE=`basename $FILE .ace` ;; X *.hlp ) SRC_SUF='hlp' ; OBJ_SUF='hx' ; BASE=`basename $FILE .hlp` ;; X *.per ) SRC_SUF='per' ; OBJ_SUF='frm' ; BASE=`basename $FILE .per` ;; X X *.4ge ) SRC_SUF='NONE' ; OBJ_SUF='' ;; X *.arc ) SRC_SUF='NONE' ; OBJ_SUF='' ;; X *.frm ) SRC_SUF='NONE' ; OBJ_SUF='' ;; X *.msg ) SRC_SUF='NONE' ; OBJ_SUF='' ;; X *.hx ) SRC_SUF='NONE' ; OBJ_SUF='' ;; X X * ) SRC_SUF='' ;; X X esac X X X # X # If file is a valid I4GL source or object file, make the target; else X # skip it. X # X X if [ -n "$SRC_SUF" ] X then X X # X # Generate target file name if necessary X # X X if [ -n "$OBJ_SUF" ] X then X DIR=`dirname $FILE` X X if [ "$DIR" != "." ] X then X OBJECT="$DIR/$BASE.$OBJ_SUF" X else X OBJECT="$BASE.$OBJ_SUF" X fi X else X OBJECT="$FILE" X fi X X X # X # Remove the existing target file if necessary X # X X if [ -f "$OBJECT" ] X then X echo rm $OBJECT X rm $OBJECT X fi X X X # X # Make target file X # X X if makehere X then X echo make $MAKE_OPT $OBJECT X make $MAKE_OPT $OBJECT X else X echo make -f $MAKEFILE_GEN $MAKE_OPT $OBJECT X make -f $MAKEFILE_GEN $MAKE_OPT $OBJECT X fi X X X # X # Install and remove target file if requested X # X X if [ -n "$INSTALL" ] X then X echo finstall -r $OBJECT X finstall -r $OBJECT X fi X fi Xdone SHAR_EOF if [ `wc -c < remake4gl` -ne 2764 ] then echo "Lengths do not match -- Bad Copy of remake4gl" fi echo "Extracting file save" sed -e 's/^X//' <<\SHAR_EOF > save X#!/bin/sh X# X# save Save a timestamped version of a file X# X# X# Usage: save {-lls_args | [-enst] [-m mode] files | -r days | -k copies} X# X# X# Options: X# X# -e list files already in Save directory with expanded pathnames X# -k keep (copies) most recent copies of each file and remove the rest X# -l list files already in Save directory X# -m set mode of saved file X# -n list commands only without executing them X# -r remove files from Save directory older than (days) old X# -s operate silently X# -t do not timestamp files X# X# X# Notes: X# X# This command provides a simple way of saving timestamped copies of files X# without having to implement SCCS or RCS. It can also be used as part of X# a local "rm" command that saves a copy of the removed file for back-up. X# X# If the first argument starts with "-l", the command will cd to the Save X# directory and perform an "ls" command using the save arguments as the X# arguments on the "ls" command line. X# X# The initial "l" will be stripped out of the initial option argument. X# Thus, "save -l" will do an "ls" on the Save directory, while "save -ll" X# or "save -l -l" will do an "ls -l". X# X# Note that the shell will attempt to expand any command line wild cards X# in the current directory when invoking the "save" command, so any such X# "ls" file name or wild card arguments should be enclosed in quotes. X# X# X# SCCS ID: @(#) save 1.19 09/17/02 14:38:13 X# X# @(#) (c) Copyright 1996-2002 by Walt Hultgren. All rights reserved. X# X# X X XUSAGE='usage: save {-lls_args | [-enst] [-m mode] files | -r days | -k copies}' X X Xif [ $# -le 0 ] Xthen X echo X echo "$USAGE" X echo ' X -e list files already in Save directory with expanded pathnames X -k keep (copies) most recent copies of each file and remove the rest X -l list files already in Save directory X -m set mode of saved file X -n list commands only without executing them X -r remove files from Save directory older than (days) old X -s operate silently X -t do not timestamp files X' X exit 1 Xfi X X X# X# Check Save directory X# X Xif [ -n "$SAVEDIR" ] Xthen X if [ ! -d "$SAVEDIR" ] X then X echo "save: Cannot find Save directory $SAVEDIR" 1>&2 X exit 1 X fi Xelse X if [ -d "$HOME/priv/Save" ] X then X SAVEDIR="$HOME/priv/Save" X else X echo 'save: Save directory not defined' 1>&2 X exit 1 X fi Xfi X X X# X# If an explicit pathname stripping sed file is set, make sure it X# exists. X# X# If no explicit pathname stripping command or sed file is set, X# default to the name of the Save directory with ".sed" appended X# if that file exists. X# X Xif [ -n "$SAVESTRIP" ] Xthen X case "$SAVESTRIP" in X */* ) X if [ ! -r "$SAVESTRIP" ] X then X echo "save: cannot open sed file '$SAVESTRIP'" 2>&1 X exit 1 X fi X ;; X esac X Xelif [ -r "${SAVEDIR}.sed" ] Xthen X SAVESTRIP="${SAVEDIR}.sed" Xfi X X X# X# Check first for directory listing request X# X Xcase "$1" in X X -e ) X shift X cd $SAVEDIR X for FILE in `ls $*` X do X echo $SAVEDIR/$FILE X done X exit X ;; X X -e* ) X echo "$USAGE" 1>&2 X exit 1 X ;; X X -l* ) X OPTS=`echo "$1" | sed 's/l//'` X if [ "$OPTS" = "-" ] X then X OPTS='' X fi X shift X cd $SAVEDIR X ls $OPTS $* X exit X ;; Xesac X X X# X# Not a listing request - Get arguments X# X Xset -- `getopt 'k:m:nr:st' $*` X Xif [ $? -ne 0 ] Xthen X echo "$USAGE" 1>&2 X exit 1 Xfi X XKEEP="" # (-k) XMODE="400" # (-m) XDO_IT="Y" # (-n) XREMOVE="" # (-r) XSILENT="" # (-s) XTIME="Y" # (-t) XFILES="" X Xfor ARG in "$@" Xdo X case $ARG in X -k ) KEEP="$2" ; shift 2 ;; X -m ) MODE="$2" ; shift 2 ;; X -n ) DO_IT="N" ; shift ;; X -r ) REMOVE="$2" ; shift 2 ;; X -s ) SILENT="Y" ; shift ;; X -t ) TIME="N" ; shift ;; X -- ) shift ; break ;; X esac Xdone X X X# X# Keep n most recent copies of timestamped files in Save directory X# X Xif [ -n "$KEEP" ] Xthen X case "$KEEP" in X [1-9] | [1-9][0-9] ) ;; X * ) X echo "save: 'keep' (-k) copies must 1-99" 1>&2 X echo "$USAGE" 1>&2 X exit 1 X ;; X esac X X cd $SAVEDIR X X # might need to add "2>/dev/null" to end of ls command X X NAMES=`ls *.[0-9][0-9][0-9][0-9][0-9][0-9]_* | X nawk -F. '{for (i=1;i&2 X exit 1 Xfi X X# X# Check files X# X Xfor FILE in $* Xdo X if [ ! -f "$FILE" -o ! -r "$FILE" ] X then X echo "save: cannot read '$FILE'" 1>&2 X exit 1 X else X if [ -d "$FILE" ] X then X echo "save: '$FILE' is a directory" 1>&2 X echo "$USAGE" 1>&2 X exit 1 X fi X fi Xdone X X X# X# Set timestamp X# X# Use an argument to the date command that SCCS won't expand. X# X Xif [ "$TIME" = "Y" ] Xthen X TIMESTAMP=`date +.\%\y\%\m\%\d_\%\H\%\M\%\S` Xelse X TIMESTAMP='' Xfi X X X# X# Attempt to copy file(s) X# X Xfor FILE in $* Xdo X X case "$FILE" in X /* ) SRC_PATH="$FILE" ;; X * ) SRC_PATH=`pwd` ; SRC_PATH="$SRC_PATH/$FILE" ;; X esac X X SRC_PATH=`echo $SRC_PATH | sed 's/\/\.\//\//g'` X DEST_FILE=`echo $SRC_PATH | sed 's/\//_/g'` X X if [ -n "$SAVESTRIP" ] X then X case "$SAVESTRIP" in X */* ) DEST_FILE=`echo $DEST_FILE | sed -f $SAVESTRIP` ;; X * ) DEST_FILE=`echo $DEST_FILE | sed "s/$SAVESTRIP//"` ;; X esac X fi X X if [ -z "$SILENT" ] X then X echo cp $FILE $SAVEDIR/${DEST_FILE}${TIMESTAMP} X echo chmod $MODE $SAVEDIR/${DEST_FILE}${TIMESTAMP} X fi X X if [ "$DO_IT" = "Y" ] X then X cp $FILE $SAVEDIR/${DEST_FILE}${TIMESTAMP} X STATUS="$?" X X if [ "$STATUS" -ne 0 ] X then X exit $STATUS X fi X X chmod $MODE $SAVEDIR/${DEST_FILE}${TIMESTAMP} X STATUS="$?" X X if [ "$STATUS" -ne 0 ] X then X exit $STATUS X fi X fi Xdone SHAR_EOF if [ `wc -c < save` -ne 7296 ] then echo "Lengths do not match -- Bad Copy of save" fi echo "Extracting file sclean" sed -e 's/^X//' <<\SHAR_EOF > sclean X#!/bin/sh X# X# sclean Perform an sccs clean X# X# X# SCCS ID: @(#) sclean 1.6 11/13/01 10:51:24 X# @(#) (c) Copyright 2001. All rights reserved. X# X# X X X# X# Make sure $PROJECTDIR is not set X# X Xif [ -n "$PROJECTDIR" ] Xthen X echo 'sclean: this command does not support the use of $PROJECTDIR' 1>&2 X exit 1 Xfi X X X# X# Insure there is an SCCS directory or a symbolic link to one X# X Xif [ ! -d SCCS ] Xthen X echo "sclean: no SCCS directory" 1>&2 X exit 1 Xfi X X X# X# Execute sccs clean X# X Xsccs clean "$@" SHAR_EOF if [ `wc -c < sclean` -ne 523 ] then echo "Lengths do not match -- Bad Copy of sclean" fi echo "Extracting file scleanbk" sed -e 's/^X//' <<\SHAR_EOF > scleanbk X#!/bin/sh X# X# scleanbk Perform an sccs clean and remove *.BK X# X# X# This shell script does an "sccs clean", then removes all *.BK files from X# the current directory if their corresponding production files are not X# present in the current directory but are present in the SCCS repository, X# and are not checked out for editing. X# X# X# SCCS ID: @(#) scleanbk 1.6 11/13/01 10:51:24 X# @(#) (c) Copyright 2001. All rights reserved. X# X# X X X# X# Make sure $PROJECTDIR is not set X# X Xif [ -n "$PROJECTDIR" ] Xthen X echo 'scleanbk: this command does not support the use of $PROJECTDIR' 1>&2 X exit 1 Xfi X X X# X# Insure there is an SCCS directory or a symbolic link to one X# X Xif [ ! -d SCCS ] Xthen X echo "scleanbk: no SCCS directory" 1>&2 X exit 1 Xfi X X X# X# Execute sccs clean X# X Xsccs clean "$@" X X X# X# Remove *.BK files if appropriate X# X Xfor BK_FILE in *.BK Xdo X GOOD_FILE=`echo $BK_FILE | sed -e 's/\.BK$//'` X X if [ -f "$GOOD_FILE" ] X then X echo "scleanbk: $BK_FILE skipped - $GOOD_FILE exists" 1>&2 X continue X fi X X if [ ! -f "SCCS/s.$GOOD_FILE" ] X then X echo "scleanbk: $BK_FILE skipped - $GOOD_FILE not in SCCS" 1>&2 X continue X fi X X if [ -f "SCCS/p.$GOOD_FILE" ] X then X echo "scleanbk: $BK_FILE skipped - $GOOD_FILE being edited" 1>&2 X continue X fi X X echo rm $BK_FILE X rm $BK_FILE X X STATUS=$? X X if [ $STATUS -ne 0 ] X then X exit $STATUS X fi Xdone SHAR_EOF if [ `wc -c < scleanbk` -ne 1473 ] then echo "Lengths do not match -- Bad Copy of scleanbk" fi echo "Extracting file screate" sed -e 's/^X//' <<\SHAR_EOF > screate X#!/bin/sh X# X# screate Perform an sccs create X# X# X# SCCS ID: @(#) screate 1.6 11/13/01 10:51:25 X# @(#) (c) Copyright 2001. All rights reserved. X# X# X X X# X# Make sure $PROJECTDIR is not set X# X Xif [ -n "$PROJECTDIR" ] Xthen X echo 'screate: this command does not support the use of $PROJECTDIR' 1>&2 X exit 1 Xfi X X X# X# Insure there is an SCCS directory or a symbolic link to one X# X Xif [ ! -d SCCS ] Xthen X echo "screate: no SCCS directory" 1>&2 X exit 1 Xfi X X X# X# Make sure each file has a valid unexpanded SCCS ID X# X XERRORS='' X Xfor FILE in "$@" Xdo X sidchk $FILE X X if [ $? -ne 0 ] X then X ERRORS='Y' X fi Xdone X Xif [ -n "$ERRORS" ] Xthen X echo "screate: no action taken" 1>&2 X exit 1 Xfi X X X# X# Check file(s) into SCCS X# X Xsccs create "$@" X X X# X# Set flag to prevent check-in of deltas without unexpanded ID keywords X# X Xsccs admin -fi "$@" SHAR_EOF if [ `wc -c < screate` -ne 888 ] then echo "Lengths do not match -- Bad Copy of screate" fi echo "Extracting file sdelget" sed -e 's/^X//' <<\SHAR_EOF > sdelget X#!/bin/sh X# X# sdelget Perform "sccs delget" commands X# X# X# SCCS ID: @(#) sdelget 1.6 11/13/01 10:51:25 X# @(#) (c) Copyright 2001. All rights reserved. X# X# X X X X# X# Make sure $PROJECTDIR is not set X# X Xif [ -n "$PROJECTDIR" ] Xthen X echo 'sdelget: this command does not support the use of $PROJECTDIR' 1>&2 X exit 1 Xfi X X# X# Insure there is an SCCS directory or a symbolic link to one X# X Xif [ ! -d SCCS ] Xthen X echo "sdelget: no SCCS directory" 1>&2 X exit 1 Xfi X X X# X# Scan command line to build arg list for sccs delget command X# X XFILE_LIST="" XVERBOSE="" X Xfor ARG in $* Xdo X case "$ARG" in X X -v ) X VERBOSE="Y" X shift X ;; X X s.* ) X for FILE in `cd SCCS ; ls $ARG | sed 's/^s\.//'` X do X FILE_LIST="$FILE_LIST $FILE" X done X X shift X ;; X X * ) X FILE_LIST="$FILE_LIST $ARG" X shift X ;; X esac Xdone X X X# X# Make sure some files were specified X# X Xif [ -z "$FILE_LIST" ] Xthen X echo "sdelget: no files specified" 1>&2 X exit 1 Xfi X X X# X# Perform sccs delget command X# X Xif [ -n "$VERBOSE" ] Xthen X echo "sccs delget $FILE_LIST" Xfi X Xsccs delget $FILE_LIST SHAR_EOF if [ `wc -c < sdelget` -ne 1240 ] then echo "Lengths do not match -- Bad Copy of sdelget" fi echo "Extracting file sdelta" sed -e 's/^X//' <<\SHAR_EOF > sdelta X#!/bin/sh X# X# sdelta Perform "sccs delta" commands X# X# X# SCCS ID: @(#) sdelta 1.7 11/13/01 10:51:25 X# @(#) (c) Copyright 2001. All rights reserved. X# X# X X X# X# Make sure $PROJECTDIR is not set X# X Xif [ -n "$PROJECTDIR" ] Xthen X echo 'sdelta: this command does not support the use of $PROJECTDIR' 1>&2 X exit 1 Xfi X X X# X# Insure there is an SCCS directory or a symbolic link to one X# X Xif [ ! -d SCCS ] Xthen X echo "sdelta: no SCCS directory" 1>&2 X exit 1 Xfi X X X# X# Scan command line to build arg list for sccs delta command X# X XFILE_LIST="" XVERBOSE="" X Xfor ARG in $* Xdo X case "$ARG" in X X -v ) X VERBOSE="Y" X shift X ;; X X s.* ) X for FILE in `cd SCCS ; ls $ARG | sed 's/^s\.//'` X do X FILE_LIST="$FILE_LIST $FILE" X done X X shift X ;; X X * ) X FILE_LIST="$FILE_LIST $ARG" X shift X ;; X esac Xdone X X X# X# Make sure some files were specified X# X Xif [ -z "$FILE_LIST" ] Xthen X echo "sdelta: no files specified" 1>&2 X exit 1 Xfi X X X# X# Perform sccs delta command X# X Xif [ -n "$VERBOSE" ] Xthen X echo "sccs delta $FILE_LIST" Xfi X Xsccs delta $FILE_LIST SHAR_EOF if [ `wc -c < sdelta` -ne 1230 ] then echo "Lengths do not match -- Bad Copy of sdelta" fi echo "Extracting file sdifflast" sed -e 's/^X//' <<\SHAR_EOF > sdifflast X#!/bin/sh X# X# sdifflast Perform "sccs sccsdiff" commands X# X# X# SCCS ID: @(#) sdifflast 1.7 11/13/01 10:51:25 X# @(#) (c) Copyright 2001. All rights reserved. X# X# X X X# X# Make sure $PROJECTDIR is not set X# X Xif [ -n "$PROJECTDIR" ] Xthen X echo 'sdifflast: this command does not support the use of $PROJECTDIR' 1>&2 X exit 1 Xfi X X X# X# Insure there is an SCCS directory or a symbolic link to one X# X Xif [ ! -d SCCS ] Xthen X echo "sdifflast: no SCCS directory" 1>&2 X exit 1 Xfi X X X# X# Scan command line to build arg list for sccs sccsdiff command(s) X# X XFILE_LIST="" XDOIT='Y' XVERBOSE="" X Xfor ARG in $* Xdo X case "$ARG" in X X -n ) X DOIT='' X shift X ;; X X -v ) X VERBOSE="Y" X shift X ;; X X s.* ) X for FILE in `cd SCCS ; ls $ARG | sed 's/^s\.//'` X do X FILE_LIST="$FILE_LIST $FILE" X done X X shift X ;; X X * ) X FILE_LIST="$FILE_LIST $ARG" X shift X ;; X esac Xdone X X X# X# Make sure some files were specified X# X Xif [ -z "$FILE_LIST" ] Xthen X echo "sdifflast: no files specified" 1>&2 X exit 1 Xfi X X X# X# Perform sccs sccsdiff command(s) X# X Xfor FILE in $FILE_LIST Xdo X X LAST_VER=`sccs prt $FILE | head -4 | tail -1 | nawk '{ print $2 }'` X X if [ "$LAST_VER" = "1.1" ] X then X echo "sdifflast: most recent version of '$FILE' is 1.1" 1>&2 X continue X fi X X RELEASE=`echo $LAST_VER | cut -f1 -d.` X CUR=`echo $LAST_VER | cut -f2 -d.` X PREV=`expr $CUR - 1` X X if [ -n "$VERBOSE" ] X then X echo "sccs sccsdiff -r${RELEASE}.${PREV} -r${RELEASE}.${CUR} $FILE" X fi X X if [ -n "$DOIT" ] X then X sccs sccsdiff -r${RELEASE}.${PREV} -r${RELEASE}.${CUR} $FILE X fi X Xdone SHAR_EOF if [ `wc -c < sdifflast` -ne 1824 ] then echo "Lengths do not match -- Bad Copy of sdifflast" fi echo "Extracting file sdiffs" sed -e 's/^X//' <<\SHAR_EOF > sdiffs X#!/bin/sh X# X# sdiffs Perform an sccs diffs X# X# X# This script will perform an "sccs diffs" on the specified file(s). X# X# Note that the name of this command is very similar to the standard X# command "sdiff" which performs a side-by-side diff on two files. X# X# X# SCCS ID: @(#) sdiffs 1.7 11/13/01 10:51:25 X# @(#) (c) Copyright 2001. All rights reserved. X# X# X X X# X# Make sure $PROJECTDIR is not set X# X Xif [ -n "$PROJECTDIR" ] Xthen X echo 'sdiffs: this command does not support the use of $PROJECTDIR' 1>&2 X exit 1 Xfi X X X# X# Insure there is an SCCS directory or a symbolic link to one X# X Xif [ ! -d SCCS ] Xthen X echo "sdiffs: no SCCS directory" 1>&2 X exit 1 Xfi X X X# X# Scan command line to build arg list for sccs diffs command X# X XFILE_LIST="" XVERBOSE="" X Xfor ARG in $* Xdo X case "$ARG" in X X -v ) X VERBOSE="Y" X shift X ;; X X s.* ) X for FILE in `cd SCCS ; ls $ARG | sed 's/^s\.//'` X do X FILE_LIST="$FILE_LIST $FILE" X done X X shift X ;; X X * ) X FILE_LIST="$FILE_LIST $ARG" X shift X ;; X esac Xdone X X X# X# Make sure some files were specified X# X Xif [ -z "$FILE_LIST" ] Xthen X echo "sdiffs: no files specified" 1>&2 X exit 1 Xfi X X X# X# Perform sccs diffs command X# X Xif [ -n "$VERBOSE" ] Xthen X echo "sccs diffs $FILE_LIST" Xfi X Xsccs diffs $FILE_LIST SHAR_EOF if [ `wc -c < sdiffs` -ne 1439 ] then echo "Lengths do not match -- Bad Copy of sdiffs" fi echo "Extracting file sedit" sed -e 's/^X//' <<\SHAR_EOF > sedit X#!/bin/sh X# X# sedit Perform "sccs edit" commands X# X# X# SCCS ID: @(#) sedit 1.2 11/13/01 10:51:25 X# @(#) (c) Copyright 2001. All rights reserved. X# X# X X X# X# Make sure $PROJECTDIR is not set X# X Xif [ -n "$PROJECTDIR" ] Xthen X echo 'sedit: this command does not support the use of $PROJECTDIR' 1>&2 X exit 1 Xfi X X X# X# Insure there is an SCCS directory or a symbolic link to one X# X Xif [ ! -d SCCS ] Xthen X echo "sedit: no SCCS directory" 1>&2 X exit 1 Xfi X X X# X# Scan command line to build arg list for sccs edit command X# X XFILE_LIST="" XVERBOSE="" X Xfor ARG in $* Xdo X case "$ARG" in X X -v ) X VERBOSE="Y" X shift X ;; X X s.* ) X for FILE in `cd SCCS ; ls $ARG | sed 's/^s\.//'` X do X FILE_LIST="$FILE_LIST $FILE" X done X X shift X ;; X X * ) X FILE_LIST="$FILE_LIST $ARG" X shift X ;; X esac Xdone X X X# X# Make sure some files were specified X# X Xif [ -z "$FILE_LIST" ] Xthen X echo "sedit: no files specified" 1>&2 X exit 1 Xfi X X X# X# Perform sccs edit command X# X Xif [ -n "$VERBOSE" ] Xthen X echo "sccs edit $FILE_LIST" Xfi X Xsccs edit $FILE_LIST SHAR_EOF if [ `wc -c < sedit` -ne 1220 ] then echo "Lengths do not match -- Bad Copy of sedit" fi echo "Extracting file sget" sed -e 's/^X//' <<\SHAR_EOF > sget X#!/bin/sh X# X# sget Perform "sccs get" commands X# X# X# SCCS ID: @(#) sget 1.7 11/13/01 10:51:26 X# @(#) (c) Copyright 2001. All rights reserved. X# X# X X X# X# Make sure $PROJECTDIR is not set X# X Xif [ -n "$PROJECTDIR" ] Xthen X echo 'sget: this command does not support the use of $PROJECTDIR' 1>&2 X exit 1 Xfi X X X# X# Insure there is an SCCS directory or a symbolic link to one X# X Xif [ ! -d SCCS ] Xthen X echo "sget: no SCCS directory" 1>&2 X exit 1 Xfi X X X# X# Scan command line to build arg list for sccs get command X# X XFILE_LIST="" XVERBOSE="" X Xfor ARG in $* Xdo X case "$ARG" in X X -v ) X VERBOSE="Y" X shift X ;; X X s.* ) X for FILE in `cd SCCS ; ls $ARG | sed 's/^s\.//'` X do X FILE_LIST="$FILE_LIST $FILE" X done X X shift X ;; X X * ) X FILE_LIST="$FILE_LIST $ARG" X shift X ;; X esac Xdone X X X# X# Make sure some files were specified X# X Xif [ -z "$FILE_LIST" ] Xthen X echo "sget: no files specified" 1>&2 X exit 1 Xfi X X X# X# Perform sccs get command X# X Xif [ -n "$VERBOSE" ] Xthen X echo "sccs get $FILE_LIST" Xfi X Xsccs get $FILE_LIST SHAR_EOF if [ `wc -c < sget` -ne 1210 ] then echo "Lengths do not match -- Bad Copy of sget" fi echo "Extracting file sgetall" sed -e 's/^X//' <<\SHAR_EOF > sgetall X#!/bin/sh X# X# sgetall Perform "sccs get" on all deltas X# X# X# Usage: sgetall [-kn] [-l del] [-h del] files X# X# where: X# X# -k does an "sget -k" so SCCS keywords are not expanded X# -n displays but does not execute necessary sget commands X# -l del specifies optional lowest delta number to be checked out X# -h del specifies optional highest delta number to be checked out X# X# X# Delta numbers given with the (-l) and (-h) options should be of the X# usual SCCS form "M.N" where "M" is the major release number and "N" X# is the minor release or version number. If only a single integer "N" X# is given, it will be assumed to specify the delta "1.N". Delta numbers X# of more than two parts (e. g., "1.2.3" ) are not supported. X# X# If no low limit is specified, deltas starting with 1.1 will be checked X# out. If no high limit is specified, deltas through the most recent will X# be checked out. X# X# Direct SCCS options other than (-k) are not supported. X# X# X# SCCS ID: @(#) sgetall 1.8 11/14/01 15:24:36 X# @(#) (c) Copyright 2001. All rights reserved. X# X# X X X# X# Make sure $PROJECTDIR is not set X# X Xif [ -n "$PROJECTDIR" ] Xthen X echo 'sgetall: this command does not support the use of $PROJECTDIR' 1>&2 X exit 1 Xfi X X X# X# Insure there is an SCCS directory or a symbolic link to one X# X Xif [ ! -d SCCS ] Xthen X echo "sgetall: no SCCS directory" 1>&2 X exit 1 Xfi X X X# X# Parse command line X# X Xset -- `getopt 'h:kl:n' $*` X Xif [ $? -ne 0 ] Xthen X echo "$USAGE" 1>&2 X exit 1 Xfi X X XHI_DEL='999.999' # (-h) XK_OPT='' # (-k) XLO_DEL='0.0' # (-l) XDO_IT='Y' # (-n) X Xfor ARG in "$@" Xdo X case $ARG in X -h ) HI_DEL="$2" ; shift 2 ;; X -k ) K_OPT="-k" ; shift ;; X -l ) LO_DEL="$2" ; shift 2 ;; X -n ) DO_IT="" ; shift ;; X -- ) shift ; break ;; X esac Xdone X X X# X# Check delta numbers X# X Xcase "$LO_DEL" in X X *[!.0-9]* | *.*.* ) X echo "sgetall: low delta number must be of form major.minor" 1>&2 X exit 1 X ;; X X *.* ) ;; X X * ) LO_DEL="1.$LO_DEL" X ;; Xesac X Xcase "$HI_DEL" in X X *[!.0-9]* | *.*.* ) X echo "sgetall: high delta number must be of form major.minor" 1>&2 X exit 1 X ;; X X *.* ) ;; X X * ) HI_DEL="1.$HI_DEL" X ;; Xesac X X X# X# Build file list X# X XFILE_LIST="" X Xfor ARG in "$@" Xdo X case $ARG in X X s.* ) X for FILE in `cd SCCS ; ls $ARG | sed 's/^s\.//'` X do X FILE_LIST="$FILE_LIST $FILE" X done X X shift X ;; X X * ) X if [ ! -r "SCCS/s.$ARG" ] X then X echo "sgetall: cannot find '$ARG' in SCCS" 1>&2 X exit 1 X fi X X FILE_LIST="$FILE_LIST $ARG" X shift X ;; X esac Xdone X X X# X# Make sure some files were specified X# X Xif [ -z "$FILE_LIST" ] Xthen X echo "sgetall: no files specified" 1>&2 X exit 1 Xfi X X X# X# Perform sccs get command(s) X# X Xfor FILE in $FILE_LIST Xdo X X DELS=`sccs prt $FILE | nawk -v lodel="$LO_DEL" -v hidel="$HI_DEL" ' X BEGIN { split( lodel, lo, "." ) ; split( hidel, hi, "." ) } X /^D/ { split( $2, v, "." ) X if ( lo[1] < v[1] || lo[1] == v[1] && lo[2] <= v[2] ) X if ( hi[1] > v[1] || hi[1] == v[1] && hi[2] >= v[2] ) X print $2}'` X X if [ -z "$DELS" ] X then X echo "sgetall: no delta of '$FILE' within specified limits" 1>&2 X continue X fi X X #if [ "$DELS" = "1.1" ] X #then X # echo "sgetall: most recent delta of '$FILE' is 1.1" 1>&2 X # continue X #fi X X X # X # Check for existing files X # X X for DELTA in $DELS X do X if [ -f "$FILE.$DELTA" ] X then X echo "sgetall: file '$FILE.$DELTA' already exists" 1>&2 X exit 1 X fi X done X X X # X # Check out all delta of this file X # X X for DELTA in $DELS X do X echo "sccs get -p $K_OPT -r${DELTA} $FILE > $FILE.$DELTA" X X if [ -n "$DO_IT" ] X then X sccs get -p $K_OPT -r${DELTA} $FILE > $FILE.$DELTA X fi X done X Xdone SHAR_EOF if [ `wc -c < sgetall` -ne 4187 ] then echo "Lengths do not match -- Bad Copy of sgetall" fi echo "Extracting file sgetprev" sed -e 's/^X//' <<\SHAR_EOF > sgetprev X#!/bin/sh X# X# sgetprev Perform "sccs get" on previous release X# X# X# SCCS ID: @(#) sgetprev 1.9 11/13/01 10:51:26 X# @(#) (c) Copyright 2001. All rights reserved. X# X# X X X# X# Make sure $PROJECTDIR is not set X# X Xif [ -n "$PROJECTDIR" ] Xthen X echo 'sgetprev: this command does not support the use of $PROJECTDIR' 1>&2 X exit 1 Xfi X X X# X# Insure there is an SCCS directory or a symbolic link to one X# X Xif [ ! -d SCCS ] Xthen X echo "sgetprev: no SCCS directory" 1>&2 X exit 1 Xfi X X X# X# Scan command line to build arg list for sccs sccsdiff command(s) X# X XFILE_LIST="" XOPT_LIST="" XDOIT='Y' XVERBOSE="" X Xfor ARG in $* Xdo X case "$ARG" in X X -n ) X DOIT='' X shift X ;; X X -v ) X VERBOSE="Y" X shift X ;; X X -r ) X echo 'sgetprev: explicit (-r) not allowed' 1>&2 X exit 1 X ;; X X -* ) X OPT_LIST="$OPT_LIST $ARG" X shift X ;; X X s.* ) X for FILE in `cd SCCS ; ls $ARG | sed 's/^s\.//'` X do X FILE_LIST="$FILE_LIST $FILE" X done X X shift X ;; X X * ) X FILE_LIST="$FILE_LIST $ARG" X shift X ;; X esac Xdone X X X# X# Make sure some files were specified X# X Xif [ -z "$FILE_LIST" ] Xthen X echo "sgetprev: no files specified" 1>&2 X exit 1 Xfi X X X# X# Perform sccs get command(s) X# X Xfor FILE in $FILE_LIST Xdo X X LAST_VER=`sccs prt $FILE | head -4 | tail -1 | nawk '{ print $2 }'` X X if [ "$LAST_VER" = "1.1" ] X then X echo "sgetprev: most recent version of '$FILE' is 1.1" 1>&2 X continue X fi X X RELEASE=`echo $LAST_VER | cut -f1 -d.` X CUR=`echo $LAST_VER | cut -f2 -d.` X PREV=`expr $CUR - 1` X X if [ -n "$VERBOSE" ] X then X echo "sccs get $OPT_LIST -r${RELEASE}.${PREV} $FILE" X fi X X if [ -n "$DOIT" ] X then X sccs get $OPT_LIST -r${RELEASE}.${PREV} $FILE X fi X Xdone SHAR_EOF if [ `wc -c < sgetprev` -ne 1995 ] then echo "Lengths do not match -- Bad Copy of sgetprev" fi echo "Extracting file showdbe" sed -e 's/^X//' <<\SHAR_EOF > showdbe X#!/bin/sh X# X# showdbe Show database environment X# X# X# Usage: showdbe [-bcls] X# X# where: -b brief listing format X# -c compact listing format X# -l long listing format X# -s output shell statements to set environment variables X# X# X# SCCS ID: @(#) showdbe 1.7 09/17/02 14:25:03 X# @(#) (c) Copyright 2002. All rights reserved. X# X# X X XUSAGE='usage: showdbe [-bcls]' X X X# X# Check to see if $PROJECTDIR is set X# X Xif [ -n "$PROJECTDIR" ] Xthen X echo 'showdbe: WARNING - $PROJECTDIR is set' 1>&2 Xfi X X X# X# Parse command line X# X Xset -- `getopt 'bclvs' $*` X Xif [ $? -ne 0 ] Xthen X echo "$USAGE" 1>&2 X exit 1 Xfi X XTYPE='B' X Xfor ARG in "$@" Xdo X case $ARG in X -b ) TYPE='B' ; shift ;; X -c ) TYPE='C' ; shift ;; X -l ) TYPE='L' ; shift ;; X -s ) TYPE='S' ; shift ;; X -v ) TYPE='L' ; shift ;; X -- ) shift ; break ;; X esac Xdone X X X# X# Generate type of listing requested X# X Xif [ "$TYPE" = "B" ] Xthen X echo "SRCDIR: $SRCDIR" X echo "BINDIR: $BINDIR" X echo "DBDIR: $DBDIR" X exit Xfi X X Xif [ "$TYPE" = "C" ] Xthen X echo SRCDIR=$SRCDIR X echo LIBDIR=$LIBDIR X echo BINDIR=$BINDIR X echo FIDATA=$FIDATA X echo FIBASE=$FIBASE X echo FIRM=$FIRM X echo DBDIR=$DBDIR X echo DBPATH=$DBPATH X echo DBDATE=$DBDATE X echo DBCENTURY=$DBCENTURY X echo DBPRINT=$DBPRINT X X echo INFORMIXDIR=$INFORMIXDIR X X if [ "$MACH" = "rmys5" ] X then X echo INFORMIXSERVER=$INFORMIXSERVER X echo INFORMIXC=$INFORMIXC X echo C4GLFLAGS=$C4GLFLAGS X echo LD_LIBRARY_PATH=$LD_LIBRARY_PATH X fi X X echo PATH=$PATH X X exit Xfi X X Xif [ "$TYPE" = "S" ] Xthen X echo "SRCDIR=\"$SRCDIR\"" X echo "LIBDIR=\"$LIBDIR\"" X echo "BINDIR=\"$BINDIR\"" X echo "FIDATA=\"$FIDATA\"" X echo "FIBASE=\"$FIBASE\"" X echo "FIRM=\"$FIRM\"" X echo "DBDIR=\"$DBDIR\"" X echo "DBDATE=\"$DBDATE\"" X echo "DBCENTURY=\"$DBCENTURY\"" X echo "DBPRINT=\"$DBPRINT\"" X X echo X VARNAME='' X for DIR in `echo "$DBPATH" | X sed -e 's/^:/.:/' -e 's/::/:.:/g' -e 's/:$/:./' -e 's/:/ /g'` X do X echo "DBPATH=\"${VARNAME}${DIR}\"" X VARNAME='$DBPATH:' X done X X echo X VARNAME='' X for DIR in `echo "$PATH" | X sed -e 's/^:/.:/' -e 's/::/:.:/g' -e 's/:$/:./' -e 's/:/ /g'` X do X echo "PATH=\"${VARNAME}${DIR}\"" X VARNAME='$PATH:' X done X X exit Xfi X X XTAB=`/usr/5bin/echo '\t\c'` X Xecho X ( X echo "SRCDIR:$TAB'$SRCDIR'" X echo "LIBDIR:$TAB'$LIBDIR'" X echo X echo "BINDIR:$TAB'$BINDIR'" X echo "FIDATA:$TAB'$FIDATA'" X echo "FIBASE:$TAB'$FIBASE'" X echo "FIRM:$TAB'$FIRM'" X X echo X echo "DBDIR:$TAB'$DBDIR'" X X echo X VARNAME='DBPATH:' X for DIR in `echo "$DBPATH" | X sed -e 's/^:/.:/' -e 's/::/:.:/g' -e 's/:$/:./' -e 's/:/ /g'` X do X echo "${VARNAME}${TAB}'${DIR}'" X VARNAME='' X done X X echo X echo "DBDATE:$TAB'$DBDATE'" X echo "DBCENTURY:$TAB'$DBCENTURY'" X echo "DBPRINT:$TAB'$DBPRINT'" X X echo X echo "INFORMIXDIR:$TAB'$INFORMIXDIR'" X X if [ "$MACH" = "rmys5" ] X then X echo X echo "INFORMIXSERVER:$TAB'$INFORMIXSERVER'" X echo "INFORMIXC:$TAB'$INFORMIXC'" X echo "C4GLFLAGS:$TAB'$C4GLFLAGS'" X echo "LD_LIBRARY_PATH:$TAB'$LD_LIBRARY_PATH'" X fi X X echo X VARNAME='PATH:' X for DIR in `echo "$PATH" | X sed -e 's/^:/.:/' -e 's/::/:.:/g' -e 's/:$/:./' -e 's/:/ /g'` X do X echo "${VARNAME}${TAB}'${DIR}'" X VARNAME='' X done X ) | expand -17 Xecho SHAR_EOF if [ `wc -c < showdbe` -ne 3596 ] then echo "Lengths do not match -- Bad Copy of showdbe" fi echo "Extracting file sidchk" sed -e 's/^X//' <<\SHAR_EOF > sidchk X#!/bin/sh X# X# sidchk Check for presence of a valid unexpanded SCCS ID X# X# X# Usage: sidchk [files] X# X# X# This script will check for the presence of a valid unexpanded SCCS ID. X# To do this, the awk script looks for a line that contains the string X# consisting of the characters "%", "Z" and "%", followed by a string X# of the form "% capital-letter %". X# X# Note that an awk "exit" statement in a non-END section causes the END X# section to be executed immediately. X# X# X# SCCS ID: @(#) sidchk 1.4 11/13/01 10:51:27 X# @(#) (c) Copyright 2001. All rights reserved. X# X# X X XUSAGE='usage: sidchk [files]' X X Xif [ $# -gt 0 ] Xthen X ARGS="$*" Xelse X ARGS="-" Xfi X X XERRORS='' X Xfor FILE in $ARGS Xdo X if [ "$FILE" != "-" ] X then X if [ ! -f "$FILE" -o ! -r "$FILE" ] X then X echo "sidchk: cannot read file '$FILE'" 1>&2 X ERRORS='Y' X fi X fi X X nawk ' X BEGIN { exit_status = 1 } X X /\%\Z\%/ { X if ( match( substr( $0, index( $0, "@(#)" ) + 3 ), "%[A-Z]%" ) ) X { X exit_status = 0 X exit # go immediately to END processing X } X } X X END { exit exit_status } X X ' $FILE X X if [ $? -ne 0 ] X then X if [ "$FILE" = "-" ] X then X echo "sidchk: no unexpanded SCCS-ID in standard input" 1>&2 X else X echo "sidchk: no unexpanded SCCS-ID in '$FILE'" 1>&2 X fi X X ERRORS='Y' X fi Xdone X Xif [ -n "$ERRORS" ] Xthen X exit 1 Xelse X exit 0 Xfi SHAR_EOF if [ `wc -c < sidchk` -ne 1578 ] then echo "Lengths do not match -- Bad Copy of sidchk" fi echo "Extracting file sidprt" sed -e 's/^X//' <<\SHAR_EOF > sidprt X#!/bin/sh X# X# sidprt Print appropriate unexpanded SCCS ID X# X# X# SCCS ID: @(#) sidprt 1.3 11/19/01 09:32:24 X# @(#) (c) Copyright 2001. All rights reserved. X# X# X X XG=\%G\% XI=\%I\% XM=\%M\% XU=\%U\% XZ=\%Z\% X X Xecho "SCCS ID: $Z $M $I $G $U" SHAR_EOF if [ `wc -c < sidprt` -ne 254 ] then echo "Lengths do not match -- Bad Copy of sidprt" fi echo "Extracting file sinfo" sed -e 's/^X//' <<\SHAR_EOF > sinfo X#!/bin/sh X# X# sinfo Perform an sccs info X# X# X# SCCS ID: @(#) sinfo 1.5 11/13/01 10:51:27 X# @(#) (c) Copyright 2001. All rights reserved. X# X# X X X# X# Make sure $PROJECTDIR is not set X# X Xif [ -n "$PROJECTDIR" ] Xthen X echo 'sinfo: this command does not support the use of $PROJECTDIR' 1>&2 X exit 1 Xfi X X Xif [ $# -le 0 ] Xthen X X if [ ! -d SCCS ] X then X echo "sinfo: no SCCS directory" 1>&2 X exit 1 X fi X X sccs info X exit X Xelse X X for DIR in $* X do X if [ -d "$DIR" ] X then X if [ -d "$DIR/SCCS" ] X then X echo $DIR: X ( cd $DIR ; sccs info ) X else X echo "sinfo: no SCCS directory in $DIR" 1>&2 X fi X else X echo "sinfo: $DIR is not a directory" 1>&2 X fi X done Xfi SHAR_EOF if [ `wc -c < sinfo` -ne 843 ] then echo "Lengths do not match -- Bad Copy of sinfo" fi echo "Extracting file sls" sed -e 's/^X//' <<\SHAR_EOF > sls X#!/bin/sh X# X# sls Perform an ls in the SCCS directory X# X# X# SCCS ID: @(#) sls 1.3 11/13/01 10:51:27 X# @(#) (c) Copyright 2001. All rights reserved. X# X# X X X# X# Make sure $PROJECTDIR is not set X# X Xif [ -n "$PROJECTDIR" ] Xthen X echo 'sls: this command does not support the use of $PROJECTDIR' 1>&2 X exit 1 Xfi X X Xif [ ! -d SCCS ] Xthen X echo "sls: no directory ./SCCS" 1>&2 X exit 1 Xfi X Xcd SCCS X Xls $* SHAR_EOF if [ `wc -c < sls` -ne 428 ] then echo "Lengths do not match -- Bad Copy of sls" fi echo "Extracting file sprt" sed -e 's/^X//' <<\SHAR_EOF > sprt X#!/bin/sh X# X# sprt Perform "sccs prt" commands X# X# X# SCCS ID: @(#) sprt 1.7 11/13/01 10:51:28 X# @(#) (c) Copyright 2001. All rights reserved. X# X# X X X# X# Make sure $PROJECTDIR is not set X# X Xif [ -n "$PROJECTDIR" ] Xthen X echo 'sprt: this command does not support the use of $PROJECTDIR' 1>&2 X exit 1 Xfi X X X# X# Insure there is an SCCS directory or a symbolic link to one X# X Xif [ ! -d SCCS ] Xthen X echo "sprt: no SCCS directory" 1>&2 X exit 1 Xfi X X X# X# Scan command line to build arg list for sccs prt command X# X XFILE_LIST="" XVERBOSE="" X Xfor ARG in $* Xdo X case "$ARG" in X X -v ) X VERBOSE="Y" X shift X ;; X X s.* ) X for FILE in `cd SCCS ; ls $ARG | sed 's/^s\.//'` X do X FILE_LIST="$FILE_LIST $FILE" X done X X shift X ;; X X * ) X FILE_LIST="$FILE_LIST $ARG" X shift X ;; X esac Xdone X X X# X# Make sure some files were specified X# X Xif [ -z "$FILE_LIST" ] Xthen X echo "sprt: no files specified" 1>&2 X exit 1 Xfi X X X# X# Perform sccs prt command X# X Xif [ -n "$VERBOSE" ] Xthen X echo "sccs prt $FILE_LIST" Xfi X Xsccs prt $FILE_LIST SHAR_EOF if [ `wc -c < sprt` -ne 1210 ] then echo "Lengths do not match -- Bad Copy of sprt" fi echo "Extracting file sprtlast" sed -e 's/^X//' <<\SHAR_EOF > sprtlast X#!/bin/sh X# X# sprtlast Perform "sccs prt" commands X# X# X# Usage: sprtlast {files|SCCS} X# X# X# A filename of the form "s.*" will be interpreted as "SCCS/s.*". X# X# X# SCCS ID: @(#) sprtlast 1.7 11/13/01 10:51:28 X# @(#) (c) Copyright 2001. All rights reserved. X# X# X X X# X# Make sure $PROJECTDIR is not set X# X Xif [ -n "$PROJECTDIR" ] Xthen X echo 'sprtlast: this command does not support the use of $PROJECTDIR' 1>&2 X exit 1 Xfi X X X# X# Insure there is an SCCS directory or a symbolic link to one X# X Xif [ ! -d SCCS ] Xthen X echo "sprtlast: no SCCS directory" 1>&2 X exit 1 Xfi X X X# X# Scan command line to build arg list for sccs sccsprt command(s) X# X XFILE_LIST="" X Xfor ARG in $* Xdo X case "$ARG" in X X s.* ) X for FILE in `cd SCCS ; ls $ARG | sed 's/^s\.//'` X do X FILE_LIST="$FILE_LIST $FILE" X done X X shift X ;; X X SCCS ) X for FILE in `cd SCCS ; ls s.* | sed 's/^s\.//'` X do X FILE_LIST="$FILE_LIST $FILE" X done X X shift X ;; X X * ) X FILE_LIST="$FILE_LIST $ARG" X shift X ;; X esac Xdone X X X# X# Make sure some files were specified X# X Xif [ -z "$FILE_LIST" ] Xthen X echo "sprtlast: no files specified" 1>&2 X exit 1 Xfi X X X# X# Perform sccs prt command(s) X# X Xfor FILE in $FILE_LIST Xdo X X sccs prt $FILE | nawk '{print $0} ; NR > 4 && $0 ~ "^$" { exit } ' X Xdone SHAR_EOF if [ `wc -c < sprtlast` -ne 1478 ] then echo "Lengths do not match -- Bad Copy of sprtlast" fi echo "Extracting file stell" sed -e 's/^X//' <<\SHAR_EOF > stell X#!/bin/sh X# X# stell Perform an sccs tell X# X# X# SCCS ID: @(#) stell 1.5 11/13/01 10:51:28 X# @(#) (c) Copyright 2001. All rights reserved. X# X# X X X# X# Make sure $PROJECTDIR is not set X# X Xif [ -n "$PROJECTDIR" ] Xthen X echo 'stell: this command does not support the use of $PROJECTDIR' 1>&2 X exit 1 Xfi X X Xif [ $# -le 0 ] Xthen X X if [ ! -d SCCS ] X then X echo "stell: no SCCS directory" 1>&2 X exit 1 X fi X X sccs tell X exit X Xelse X X for DIR in $* X do X if [ -d "$DIR" ] X then X if [ -d "$DIR/SCCS" ] X then X echo $DIR: X ( cd $DIR ; sccs tell ) X else X echo "stell: no SCCS directory in $DIR" 1>&2 X fi X else X echo "stell: $DIR is not a directory" 1>&2 X fi X done Xfi SHAR_EOF if [ `wc -c < stell` -ne 843 ] then echo "Lengths do not match -- Bad Copy of stell" fi echo "Extracting file sunedit" sed -e 's/^X//' <<\SHAR_EOF > sunedit X#!/bin/sh X# X# sunedit Perform "sccs unedit" commands X# X# X# SCCS ID: @(#) sunedit 1.7 11/13/01 10:51:28 X# @(#) (c) Copyright 2001. All rights reserved. X# X# X X X# X# Make sure $PROJECTDIR is not set X# X Xif [ -n "$PROJECTDIR" ] Xthen X echo 'sunedit: this command does not support the use of $PROJECTDIR' 1>&2 X exit 1 Xfi X X X# X# Insure there is an SCCS directory or a symbolic link to one X# X Xif [ ! -d SCCS ] Xthen X echo "sunedit: no SCCS directory" 1>&2 X exit 1 Xfi X X X# X# Scan command line to build arg list for sccs unedit command X# X XFILE_LIST="" XVERBOSE="" X Xfor ARG in $* Xdo X case "$ARG" in X X -v ) X VERBOSE="Y" X shift X ;; X X s.* ) X for FILE in `cd SCCS ; ls $ARG | sed 's/^s\.//'` X do X FILE_LIST="$FILE_LIST $FILE" X done X X shift X ;; X X * ) X FILE_LIST="$FILE_LIST $ARG" X shift X ;; X esac Xdone X X X# X# Make sure some files were specified X# X Xif [ -z "$FILE_LIST" ] Xthen X echo "sunedit: no files specified" 1>&2 X exit 1 Xfi X X X# X# Perform sccs unedit command X# X Xif [ -n "$VERBOSE" ] Xthen X echo "sccs unedit $FILE_LIST" Xfi X Xsccs unedit $FILE_LIST SHAR_EOF if [ `wc -c < sunedit` -ne 1240 ] then echo "Lengths do not match -- Bad Copy of sunedit" fi echo "Extracting file trymake" sed -e 's/^X//' <<\SHAR_EOF > trymake X#!/bin/sh X# X# trymake Do a make if a Makefile exists X# X# X# Usage: trymake [-v] [make_args] X# X# X# This script will perform a make if there is a Makefile in the current X# directory or its SCCS sub-directory. This script is often used in X# conjunction with the "visit" command to allow making all files from a X# specified point down in an application directory tree. A command to X# do this might look something like: X# X# visit -v dir 'trymake -v all' X# X# X# SCCS ID: @(#) trymake 1.4 11/19/01 09:32:25 X# @(#) (c) Copyright 2001. All rights reserved. X# X X Xif [ "$1" = "-v" ] Xthen X V_FLAG="Y" X shift Xfi X X Xfor NAME in Makefile makefile Xdo X if [ -f $NAME -o -f SCCS/s.$NAME ] X then X if [ -n "$V_FLAG" ] X then X echo make "$*" X fi X X make $* X exit $? X fi Xdone SHAR_EOF if [ `wc -c < trymake` -ne 849 ] then echo "Lengths do not match -- Bad Copy of trymake" fi echo "Extracting file visit" sed -e 's/^X//' <<\SHAR_EOF > visit X#!/bin/sh X# X# visit Visit a directory and its sub-directories and perform a command X# X# X# Usage: visit [-mnqs] 'dirs' [command arg1 arg2 ... argN] X# X# -m visit only directories with makefiles X# -n no action - only list directories visited and command(s) X# -q quiet mode - don't list directories visited and command(s) X# -s visit only directories with SCCS directories X# X# X# This script will "visit" each of the directories located with the "find" X# command using the first non-option argument to this command as the X# starting point. In each visited directory, the rest of the arguments X# will be executed using the "eval" command. X# X# The way in which the base directory is specified will affect the way X# that the find command works. If you want the base directory itself to X# be visited, then simply supply its name as the first argument, such as: X# X# visit srcdir 'make all' X# X# If you want the visiting to start with the sub-directories in the base X# directory and not the base itself, use a command such as: X# X# visit 'srcdir/*' 'make all' X# X# Notice that the first argument has been single-quoted to prevent its X# being escaped by the shell. X# X# You may also visit only selected directories by specifying them in the X# first argument to this command, as in: X# X# visit 'dir1 dir2 dir3' 'sccs clean' X# X# Since "visit" uses the command "find -type d" to locate the directories X# to be visited, non-directory pathnames supplied as part of the first X# non-option argument will be silently skipped. X# X# X# SCCS ID: @(#) visit 1.13 11/19/01 09:32:26 X# @(#) (c) Copyright 2001. All rights reserved. X# X X XUSAGE="usage: visit [-mnqs] 'dirs' [command arg1 arg2 ... argN]" X X X# X# Check number of arguments. X# X Xif [ $# -le 0 ] Xthen X echo $USAGE X exit 1 Xfi X X X# X# Parse command line to collect options, base directory(ies) and command(s) X# without using getopt during this first pass. This allows the user to X# specify multiple directories as a single argument without having to use X# several levels of enclosing quotes. X# X XOPT_ARGS='' X Xfor ARG in $* Xdo X case "$ARG" in X X -* ) if [ $# -gt 1 ] X then X OPT_ARGS="$OPT_ARGS $ARG" X shift X else X echo "$USAGE" X exit 1 X fi X ;; X X *) break ;; X esac Xdone X X X# X# Get base directory(ies) X# X XBASE="$1" Xshift X Xif [ -z "$BASE" ] Xthen X echo $USAGE X exit 1 Xfi X X X# X# Take rest of arguments as command to execute X# X XCOMMAND="$*" X X X# X# Now parse options using getopt X# X Xset -- `getopt mnqs $OPT_ARGS` X Xfor ARG in $* Xdo X case "$ARG" in X -m ) MAKE_ONLY="Y" ; shift ;; X -n ) NO_ACTION="Y" ; shift ;; X -q ) QUIET="Y" ; shift ;; X -s ) SCCS_ONLY="Y" ; shift ;; X -- ) break ;; X * ) echo "$USAGE" ; exit 1 ;; X esac Xdone X X X# X# Visit specified base directories and their sub-directories X# X Xfor DIR in `find $BASE -type d -print | sort` Xdo X ( X cd $DIR X X X # X # Check for makefile if (-m) X # X X if [ -n "$MAKE_ONLY" ] X then X MAKE_HERE="" X X for NAME in Makefile makefile X do X if [ -f $NAME -o -f SCCS/s.$NAME ] X then X MAKE_HERE="Y" X fi X done X X if [ -z "$MAKE_HERE" ] X then X exit X fi X fi X X X # X # Check for SCCS directory if (-s) X # X X if [ -n "$SCCS_ONLY" ] X then X if [ ! -d SCCS ] X then X exit X fi X fi X X X # X # Display directory name and/or execute command X # X X if [ -z "$QUIET" ] X then X echo cd `pwd` X fi X X if [ -n "$COMMAND" ] X then X if [ -z "$QUIET" ] X then X echo "$COMMAND" X fi X X if [ -z "$NO_ACTION" ] X then X eval $COMMAND X fi X fi X ) X Xdone SHAR_EOF if [ `wc -c < visit` -ne 3961 ] then echo "Lengths do not match -- Bad Copy of visit" fi echo "Done." exit 0