home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-09-19 | 28.7 KB | 1,038 lines |
- Newsgroups: comp.sources.misc
- From: nyh@gauss.technion.ac.il (Nadav Har'El)
- Subject: v32i088: gaps - The Get and Put System v5.01, Part01/01
- Message-ID: <1992Sep20.235908.5182@sparky.imd.sterling.com>
- X-Md4-Signature: e6077f4476cf433f1830985e78b66f57
- Date: Sun, 20 Sep 1992 23:59:08 GMT
- Approved: kent@sparky.imd.sterling.com
-
- Submitted-by: nyh@gauss.technion.ac.il (Nadav Har'El)
- Posting-number: Volume 32, Issue 88
- Archive-name: gaps/part01
- Environment: UNIX
-
- GAPS - The Get and Put System - is a set of shell scripts for managing
- versions of programs, similar to the idea of RCS or SCCS. But, as opposed
- to those two, the usage of GAPS is very simple and straightforward. The
- shell scripts can be easily ported between unix systems without recompiling,
- and are easy to change if you want to.
-
- For those unfamiliar with the concept of a version history, a complete
- manual gaps.1 is included in this package, which also explains the usage
- of the programs included in this package.
-
- In addition to the basic shell script to put a new version in the history,
- GAPS includes shell scripts to list versions, Check difference between
- versions, change version information, and more.
-
- GAPS supports for each version a name (such as 4.23, 11R5, or any kind of
- format you choose) which is NOT updated automatically - when putting a new
- version in the history file you are told of the last version name, and
- asked to choose a new version name. This makes keeping track of version names
- much easier then with SCCS, with its cumbersome 'p.' files. It also includes
- the ability to write a summary of changes when putting a new version in the
- history file, and to change that summary later with the chver program
- included.
- -------------
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then feed it
- # into a shell via "sh file" or similar. To overwrite existing files,
- # type "sh file -c".
- # Contents: README VERSION chver gaps.1 get lastver put unput vcat
- # vdiff ver vls
- # Wrapped by kent@sparky on Sun Sep 20 18:51:32 1992
- PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin ; export PATH
- echo If this archive is complete, you will see the following message:
- echo ' "shar: End of archive 1 (of 1)."'
- if test -f 'README' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'README'\"
- else
- echo shar: Extracting \"'README'\" \(3011 characters\)
- sed "s/^X//" >'README' <<'END_OF_FILE'
- X GAPS Version 4r22 Readme
- X ------------------------
- X
- XGAPS - The Get and Put System - is a set of shell scripts for managing versions
- Xof programs, similar to the idea of RCS or SCCS. But, as opposed to those two,
- Xthe usage of GAPS is very simple and straightforward. The shell scripts can
- Xbe easily ported between unix systems without recompiling, and are easy to
- Xchange if you want to. For those unfamiliar with the concept of a version
- Xhistory, a complete manual gaps.1 is included in this package, which also
- Xexplains the usage of the programs included in this package.
- XIn addition to the basic shell script to put a new version in the history,
- XGAPS includes shell scripts to list versions, Check difference between
- Xversions, change version information, and more.
- XGAPS supports for each version a name (such as 4.23, 11R5, or any kind of
- Xformat you choose) which is NOT updated automatically - when putting a new
- Xversion in the history file you are told of the last version name, and
- Xasked to choose a new version name. This makes keeping track of version names
- Xmuch easier then with SCCS, with its cumbersome 'p.' files. It also includes
- Xthe ability to write a summary of changes when putting a new version in the
- Xhistory file, and to change that summary later with the chver program
- Xincluded.
- XFor more information, read the manual gaps.1 (which should be formatted by
- Xtroff -man).
- X
- XTo install GAPS, simply copy chver, get, lastver, put, unput, vcat, vdiff,
- Xver and vls to your favorite bin directory, and gaps.1 to a manual directory,
- Xand keep VERSION in if you want to remember what version of GAPS you have.
- X
- XFiles included in this package
- X------------------------------
- X
- XREADME - This file
- XVERSION - version information about all the programs included here
- Xchver - Shell script to change version information
- Xgaps.1 - GAPS manual
- Xget - Get a version from a history file to the working file
- Xlastver - Return the name of the last version saved in the history file
- Xput - Put a new version of the working file into the history file
- Xunput - Undo a put
- Xvcat - Get a version from a history file to standard output
- Xvdiff - Check differences between 2 version
- Xver - this is used by other shell scripts, and should be not be used
- X by the user
- Xvls - List versions in a history file
- X
- XGetting GAPS
- X------------
- X
- XIf you read this readme, you probably have already acquired GAPS. However,
- Xif you want to get the newest version of GAPS, the official annonymous ftp site
- Xis gauss.technion.ac.il: go to the directory /pub/gaps, and mget gaps*.shar.Z
- X
- X
- XIf you have any questions, comments, wishes for future releases, bug reports,
- Xor anything else about GAPS, send them to nyh@gauss.technion.ac.il.
- XPlease include in your message the content of your VERSION file, so I will
- Xknow exactly which version you have.
- X
- X
- X<<<<<<<<<<<<<INCLUDE SIGNATURE HERE sadlkj >>>>>>>>>>>>>>>>>>>>
- END_OF_FILE
- if test 3011 -ne `wc -c <'README'`; then
- echo shar: \"'README'\" unpacked with wrong size!
- fi
- # end of 'README'
- fi
- if test -f 'VERSION' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'VERSION'\"
- else
- echo shar: Extracting \"'VERSION'\" \(179 characters\)
- sed "s/^X//" >'VERSION' <<'END_OF_FILE'
- XGAPS Release 4 (Revision 22)
- XSunday, September 06, 1992
- X
- XSource files:
- X-------------
- Xget 4.1
- Xlastver 4.3
- Xput 4.3
- Xunput 4.2
- Xvcat 4.2
- Xvdiff 4.2
- Xver 4.3
- Xvls 4.3
- Xchver 4.3
- Xgaps.1 4.0
- END_OF_FILE
- if test 179 -ne `wc -c <'VERSION'`; then
- echo shar: \"'VERSION'\" unpacked with wrong size!
- fi
- # end of 'VERSION'
- fi
- if test -f 'chver' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'chver'\"
- else
- echo shar: Extracting \"'chver'\" \(3482 characters\)
- sed "s/^X//" >'chver' <<'END_OF_FILE'
- X#!/bin/sh
- X# GAPS version 4.0
- X# get and put system - by Nadav Har'El
- X# chver: change version name, and other info
- X
- XVERSION=0 # current version
- XUSAGE="Usage: $0 [-<number version> or -v<named version>] file"
- XINPUT=
- X
- Xwhile test "$1" != ""
- Xdo
- X case $1 in
- X -[0-9]|-[0-9][0-9]|-[0-9][0-9][0-9])
- X VERSION=$1;; # 1-999 versions
- X -v*) VERSION=$1;;
- X -*) echo "$USAGE" 2>&1; exit 1;;
- X *) INPUT=$1
- X case $INPUT in
- X *.H) ;;
- X *) INPUT=$INPUT.H ;;
- X esac ;;
- X esac
- X shift
- Xdone
- Xcase $INPUT in
- X"") echo $USAGE 1>&2; exit 1;;
- Xesac
- X
- Xtest -r $INPUT -a -f $INPUT || { echo "vcat: can't open $INPUT" 1>&2; exit 1; }
- X
- Xtrap 'rm -f /tmp/chver.[a-g]$$; exit 1' 1 2 3 15
- X
- Xcase $VERSION in
- X-v*) VERSION=`ver "\`expr \"$VERSION\" : '^-v\(.*\)'\`" $INPUT` || exit 1;;
- Xesac
- X
- Xawk < $INPUT '
- X /^@@\^/ {
- X count++
- X if((count-1)== - '$VERSION')
- X print $0 > "'/tmp/chver.c$$'"
- X else if (count > - '$VERSION')
- X print $0 > "'/tmp/chver.b$$'"
- X else print $0 > "'/tmp/chver.a$$'"
- X }
- X !/^@@\^/ {
- X if(count > - '$VERSION')
- X print $0 > "'/tmp/chver.b$$'"
- X else
- X print $0 > "'/tmp/chver.a$$'"
- X }
- X'
- X
- Xif test ! -f /tmp/chver.c$$
- Xthen
- X echo "Chver: no such version $VERSION." 1>&2
- X exit 1
- Xfi
- X
- X#a: first part to be copied to ouput
- X#c: line edited
- X#b: last part copied to output
- X#----------------------------------------
- X#d: version name
- X#e: owner
- X#f: date
- X#g: summary (^ changed to newlines)
- X
- Xawk -F\^ </tmp/chver.c$$ '
- X { print $2 > "'/tmp/chver.d$$'"
- X print $3 > "'/tmp/chver.e$$'"
- X print $4 > "'/tmp/chver.f$$'"
- X for(i=5; i<=NF; i++)
- X print $i > "'/tmp/chver.g$$'"
- X }
- X'
- Xecho "Editing version $VERSION in history file $INPUT."
- Xecho "Current version name: `cat /tmp/chver.d$$`"
- Xwhile :
- Xdo
- X echo -n "Do you want to change the version name (y/n)? "
- X read reply
- X case $reply in
- X y*|Y*)
- X while :
- X do
- X echo -n 'Version: '
- X read Version
- X case $Version in
- X "") echo "Chver: NULL version not allowed." 1>&2;;
- X *\^*) echo "Chver: '^' character not allowed in version." 1>&2;;
- X *) break;;
- X esac
- X done
- X echo "$Version" > /tmp/chver.d$$
- X break;;
- X n*|N*) break;;
- X *) echo "Please enter Yes or No."
- X esac
- Xdone
- Xecho "Current owner name: `cat /tmp/chver.e$$`"
- Xwhile :
- Xdo
- X echo -n "Do you want to change the owner name (y/n)? "
- X read reply
- X case $reply in
- X y*|Y*)
- X while :
- X do
- X echo -n 'Owner: '
- X read Owner
- X case $Owner in
- X *\^*) echo "Chver: '^' character not allowed in owner." 1>&2;;
- X *) break;;
- X esac
- X done
- X echo "$Owner" > /tmp/chver.e$$
- X break;;
- X n*|N*) break;;
- X *) echo "Please enter Yes or No."
- X esac
- Xdone
- Xecho "Current summary is:"
- Xcat /tmp/chver.g$$
- Xwhile :
- Xdo
- X echo -n "Do you want to change the summary (y/n)? "
- X read reply
- X case $reply in
- X y*|Y*)
- X while :
- X do
- X vi /tmp/chver.g$$
- X# note: I don't check here is the user removed or did other nasty things to the
- X# temporary file. maybe someday I will fix that.
- X if fgrep \^@@\^ /tmp/chver.g$$ >/dev/null
- X then
- X echo "Chver: The string ^@@^ must not appear in the summary."
- X echo "Press enter to edit again."
- X read reply
- X continue
- X fi
- X break
- X done
- X break;;
- X n*|N*) break;;
- X *) echo "Please enter Yes or No."
- X esac
- Xdone
- X
- Xtrap '' 1 2 3 15
- Xchmod u+w $INPUT
- Xcat /tmp/chver.a$$ > $INPUT
- Xawk '{printf "@@^%s^",$0}' </tmp/chver.d$$ >>$INPUT
- Xawk '{printf "%s^",$0}' </tmp/chver.e$$ >>$INPUT
- Xawk '{printf "%s",$0}' </tmp/chver.f$$ >>$INPUT
- Xawk '{printf "^%s",$0}' </tmp/chver.g$$ >>$INPUT
- Xecho >>$INPUT
- Xcat /tmp/chver.b$$ 2>/dev/null >>$INPUT
- Xecho Version $VERSION change complete.
- Xrm -f /tmp/chver.[a-g]$$
- END_OF_FILE
- if test 3482 -ne `wc -c <'chver'`; then
- echo shar: \"'chver'\" unpacked with wrong size!
- fi
- # end of 'chver'
- fi
- if test -f 'gaps.1' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'gaps.1'\"
- else
- echo shar: Extracting \"'gaps.1'\" \(7270 characters\)
- sed "s/^X//" >'gaps.1' <<'END_OF_FILE'
- X.TH "GAPS" 1 "version 4.0" "NYH"
- X.SH NAME
- XGAPS \- Get and put system version 4.0 by Nadav Har'El
- X
- X.SH SYNOPSIS
- X.B chver
- X[
- X.I version
- X]
- X.I file
- X.br
- X.B get
- X[
- X.I version
- X]
- X[
- X.B -o
- X.I outfile
- X]
- X.I file
- X.br
- X.B lastver
- X.I file
- X.br
- X.B put
- X.I file
- X.br
- X.B unput
- X.I file
- X.br
- X.B vcat
- X[
- X.I version
- X]
- X.I file
- X.br
- X.B vdiff
- X[
- X.I version1
- X.I version2
- X]
- X.I file
- X.br
- X.B vls
- X[
- X-a
- X|
- X.I version
- X] file
- X\&...
- X.SH DESCRIPTION
- X.\" .TP - indent, and the next line is a subject
- X.\" .P - stop TP, new paragraph
- X.\" .I - italic
- X.\" blank line - new paragraph (no indent)
- X.I GAPS
- Xis a package for saving a history of the changes to a source code
- Xof a program, or some other ascii file, similar to
- X.I SCCS
- Xor
- X.IR RCS .
- XGAPS allows you to
- X.I put
- Xa new version, therefore saving the changes from the last version,
- X.I get
- Xan older version from the history file, and much more. The revision
- Xhistory is saved in file.H, where file is the name of the source code
- Xor ascii file you are working on.
- X
- XThe history file has the following structure:
- XThe current (last put) version is copied to the beginning of the history
- Xfile, and after that follows a list of changes to make the current version
- Xinto older versions. Notice that here the current version doesn't necessarily
- Xmean the version in the source code file itself, but rather the the version
- Xlast put into the history file.
- X
- XGAPS programs which require a
- X.I version
- Xaccept two kinds of version specifications: The first way to specify a
- Xversion is by a
- X.I number
- Xversion. If -0 is used as a
- X.IR version ,
- Xit will mean the version last put
- Xinto the history file. -1 will mean the previous version, and so on.
- XThe second way, which is probably a lot more convenient is using a
- X.I named
- Xversion. When you use put to put a new version, put tells you the name
- Xof the previous version (unless the history file doesn't exist yet)
- Xand lets you choose a name for the new version. Typical names are
- X1, 1.0, 2.3.4, or such version numbers. Note, that while the
- Xversion name may contain spaces, it is recommended
- Xto use version names without spaces (although GAPS handles version
- Xnames with spaces just as well). When you want to get version 2.3
- Xfrom a file, for example, use
- X.B get
- X-v2.3 file. To see what versions are already saved in the history file,
- Xuse the
- X.B vls
- Xcommand to list the versions saved in the history file. Note that
- Xin all the GAPS commands, the file may be specified either by the
- Xthe source code's name or the history file (ending with .H) name.
- X.B Vls
- Xwill list the version history of all the files specified on the command
- Xline.
- X.BR Vls 's
- Xdefault is to list all the versions in the history. If a version (either
- X.I number
- Xor
- X.I named
- Xversion) is specified somewhere on the command line, then
- X.B vls
- Xwill only list versions newer and including the specified version for each
- Xof the files after that version option. The special option -a tells
- X.B vls
- Xto list all the versions in the next history files.
- XSome example uses of
- X.B vls
- Xare:
- X
- X vls *.H
- X
- XTo list all the versions in all history files in the current directory, and
- X
- X vls -v8.0 *.H
- X
- XTo list all versions newer and including version 8.0 for each history file
- Xin the current directory, and
- X
- X vls file1 -3 file2 file3 -v2.3 file4 -a file5 file6
- X
- Xto list all versions in file1.H, file2.5 and file6.H, list all versions
- Xnewer and including named version 2.3 in file4.H, and to list the newest 4
- Xversions
- X(all versions newer and including numeric version -3) in file2.H and file3.H.
- X
- XEvery version in the history file also has a summary, describing
- Xthe changes made in that version. When you
- X.B put
- Xa file, after being asked for the version name, you are asked you for
- Xthe version's summary. The summary may be null by simply pressing
- X.I ENTER
- Xon the prompt, or set to the wanted summary by entering it in.
- XNotice that the summary should be a single line. If you want to
- Xenter a multiple line summary, use the ^ character wherever you want the
- Xline break. For example, if you enter the summary:
- X
- X this summary^spans multiple^lines.
- X
- XThen vls will report the following summary:
- X
- X Summary: this summary
- X.br
- X spans multiple
- X.br
- X lines.
- X
- X
- XEach version also has an owner and a creation date.
- X.B Put
- Xgets the owner
- Xname from the variable LOGNAME, and if it is null or does not exist
- Xthen it calls logname and getuid in that order to find the user's login
- Xid. The login name must not contain the ^ character, and if it does,
- Xthe '?' login name is used instead. Also, the version name must not include
- Xthe ^ character.
- X
- XAll the information about a version, except the creation date can be
- Xchanged with the
- X.B chver
- Xprogram. It asks you if you want to change the
- Xversion name, summary, or owner name, and if you do, it reads new
- Xinformation in the version name or owner name case, and lets you to edit with
- Xthe
- X.I vi
- Xeditor the old summary in the summary case.
- X
- XThe
- X.B get
- Xprogram is used to get a version from the history file, and put
- Xit in the source code file. The version is specified like before - either
- X.RI - n
- Xwhere
- X.I n
- Xis a number, or
- X.RI -v name
- Xwhere
- X.I name
- Xis a name of a version.
- XAnother option to
- X.BR get ,
- Xwhich is sometimes needed, is the -o option. This option should be followed
- Xby a file name, and specifies the name of the output file, instead of
- Xthe file with the same name as the history file, but the .H removed from
- Xthe end (the working source file).
- XA similar program,
- X.BR vcat,
- Xis used to look at a version from an history file, but not to write it on
- Xa file. The version specified to
- X.BR vcat ,
- Xalong with the version forms previously described:
- X.RI - n
- Xand
- X.RI -v name ,
- Xcan be -c which tells
- X.B vcat
- Xto simply cat the version you are now working
- Xon, i.e. the version which is now in the source code file. This is not
- Xvery useful with vcat, but is very useful for
- X.BR vdiff .
- X.B vdiff
- Xis a program to find the difference between two versions in a history file.
- XIt uses
- X.B vcat
- Xso the -c version can be used. Some useful examples of using
- X.BR vdiff :
- X
- X vdiff -0 -c file
- X
- Xtells you the changes you have made to the source code file since the last
- Xput, and
- X
- X vdiff -v1.0 -v2.0 file
- X
- Xshows you the difference between version 1.0 and 2.0 of the file.
- XBecause the first example is so useful, doing simply 'vdiff file', is the
- Xsame as 'vdiff -0 -c file'.
- X
- XAnother useful program provided by GAPS is
- X.BR unput ,
- Xwhich is used to unput the last (maybe accidentally) put version.
- X.B unput
- Xcan only remove the last version, and cannot remove it if it is the only
- Xversion in the history file. The main use of
- X.B unput
- Xis after you accidentally use
- X.BR put ,
- Xand wish you haven't done the put.
- X
- XAnother program supplied by GAPS is
- X.BR lastver ,
- Xwhich is used to find the name of the last version in a history file.
- X
- XThe
- X.B GAPS
- Xprograms are written entirely as shell scripts, using awk, ed, diff,
- Xand other useful UNIX utilities. Therefore, they easily run on most
- XUNIX computers.
- X.SH "SEE ALSO"
- X
- Xsccs(1),
- Xrcs(1)
- X
- Xawk(1), cat(1), ed(1), diff(1), sed(1), expr(1), vi(1), sh(1), cp(1),
- Xchmod(1), rm(1), test(1), echo(1), grep(1), fgrep(1), logname(1) or
- Xgetuid(1)
- X
- X.SH BUGS
- XSummaries which are too long for grep to handle really make GAPS go mad.
- X
- X.SH COPYRIGHT
- XCopyright (C) 1991 by Nadav Har'El,
- X.br
- XE-mail: nyh@gauss.technion.ac.il
- X.br
- XAll Rights Reserved
- END_OF_FILE
- if test 7270 -ne `wc -c <'gaps.1'`; then
- echo shar: \"'gaps.1'\" unpacked with wrong size!
- fi
- # end of 'gaps.1'
- fi
- if test -f 'get' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'get'\"
- else
- echo shar: Extracting \"'get'\" \(1511 characters\)
- sed "s/^X//" >'get' <<'END_OF_FILE'
- X#!/bin/sh
- X# GAPS version 4.0
- X# get and put system - by Nadav Har'El
- X# get: extract file from history
- X
- XVERSION=0
- XINPUT=
- XOUTPUT=
- XFILEFLG=
- XUSAGE="Usage: get [-<number version> or -v<named version>] [-o outfile] file"
- X
- Xwhile test "$1" != ""
- Xdo
- X case "$1" in
- X -o) OUTPUT=$2; shift ;;
- X -[0-9]|-[0-9][0-9]|-[0-9][0-9][0-9]) VERSION=$1 ;; # 1-999 versions
- X -v*) VERSION=$1;;
- X -*) echo "get: unknown argument $i" 1>&2; exit 1 ;;
- X *.H) case "$FILEFLG" in
- X y) echo "$USAGE" 1>&2
- X exit 1;;
- X esac
- X FILEFLG=y
- X case "$OUTPUT" in
- X "") OUTPUT=`expr "$1" : '\(.*\)\.H'`
- X esac
- X INPUT=$1;;
- X *) case "$FILEFLG" in
- X y) echo "$USAGE" 1>&2
- X exit 1;;
- X esac
- X FILEFLG=y
- X case "$OUTPUT" in
- X "") OUTPUT=$1
- X esac
- X INPUT=$1.H
- X esac
- X shift
- Xdone
- Xcase $FILEFLG in
- X"") echo "$USAGE" 1>&2
- X exit 1;;
- Xesac
- Xtest -r $INPUT -a -f $INPUT ||
- X { echo "Get: Cannot open $INPUT for input" 1>&2; exit 1; }
- Xtest -w $OUTPUT -a ! -d $OUTPUT -o ! -f $OUTPUT -a ! -d $OUTPUT -a \
- X ! -c $OUTPUT -a ! -b $OUTPUT ||
- X { echo "Get: Cannot open $OUTPUT for writing" 1>&2; exit 1; }
- Xcase $VERSION in
- X-v*) VERSION=`ver "\`expr \"$VERSION\" : '^-v\(.*\)'\`" $INPUT` || exit 1;;
- Xesac
- Xtrap 'rm -f /tmp/get.[ab]$$;exit 1' 1 2 3 15
- X# split into current version and editing command
- Xsed <$INPUT '/^@@\^/q' >/tmp/get.a$$
- Xsed <$INPUT -n '/^@@\^/,$w /tmp/get.b'$$
- X# preform the edits
- Xawk </tmp/get.b$$ '
- X /^@@\^/ { count++ }
- X !/^@@\^/ && count > 0 && count <= - '$VERSION'
- X END { print "$d"; print "w", "'$OUTPUT'" }
- X' | ed - /tmp/get.a$$
- Xrm -f /tmp/get.[ab]$$
- END_OF_FILE
- if test 1511 -ne `wc -c <'get'`; then
- echo shar: \"'get'\" unpacked with wrong size!
- fi
- # end of 'get'
- fi
- if test -f 'lastver' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'lastver'\"
- else
- echo shar: Extracting \"'lastver'\" \(286 characters\)
- sed "s/^X//" >'lastver' <<'END_OF_FILE'
- X#!/bin/sh
- X# GAPS version 4.0
- X# get and put system - by Nadav Har'El
- X# lastver: find the name of the last version in history
- Xcase $# in
- X1) case $1 in
- X *.H) HIST=$1;;
- X *) HIST=$1.H
- X esac
- X awk -F\^ '/^@@\^/ {print $2; exit}' <$HIST;;
- X*) echo 'Usage: lastver file' 1>&2; exit 1 ;;
- Xesac
- END_OF_FILE
- if test 286 -ne `wc -c <'lastver'`; then
- echo shar: \"'lastver'\" unpacked with wrong size!
- fi
- # end of 'lastver'
- fi
- if test -f 'put' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'put'\"
- else
- echo shar: Extracting \"'put'\" \(1769 characters\)
- sed "s/^X//" >'put' <<'END_OF_FILE'
- X#!/bin/sh
- X# GAPS version 4.0
- X# get and put system - by Nadav Har'El
- X# put: install file into history
- Xtrap 'chmod -w $HIST' 1 2 3 15
- Xcase $# in
- X1) case $1 in
- X *.H) HIST=$1
- X set "`expr $HIST : '\(.*\)\.H'`";;
- X *) HIST=$1.H
- X esac
- X if test -f $HIST
- X then
- X chmod u+w $HIST
- X fi ;;
- X*) echo 'Usage: put file' 1>&2; exit 1 ;;
- Xesac
- Xif test ! -r $1 -o ! -f $1
- Xthen
- X echo "Put: can't open $1 for input" 1>&2
- X exit 1
- Xfi
- Xif grep "^@@\^" $1 >/dev/null
- Xthen
- X echo "file contains '@@^' in begining of line. can't save it." 1>&2
- X exit 1
- Xfi
- Xtrap 'rm -f /tmp/put.[ab]$$;chmod -w $HIST 2>/dev/null; exit 1' 1 2 3 15
- Xif test -r $HIST
- Xthen
- X echo "Last version of $HIST is \
- X`awk -F\^ '/^@@\^/ {print $2; exit}' <$HIST`"
- Xfi
- X
- Xwhile :
- Xdo
- X echo -n 'Version: '
- X read Version
- X case $Version in
- X "") echo "Put: NULL version not allowed." 1>&2;;
- X *\^*) echo "Put: '^' character not allowed in version." 1>&2;;
- X *) break;;
- X esac
- Xdone
- X
- Xwhile :
- Xdo
- X echo -n 'Summary: '
- X read Summary
- X case $Summary in
- X *\^@@\^*)
- X echo "Put: The string ^@@^ must not appear in the Summary" 1>&2;;
- X *)
- X break;
- X esac
- Xdone
- Xcase $LOGNAME in
- X"") LOGNAME=`logname 2>/dev/null || getuid 2>/dev/null`
- X case $LOGNAME in
- X *\^*) LOGNAME='?';;
- X esac;;
- X*\^*) LOGNAME='?';;
- Xesac
- X
- Xif get -o /tmp/put.a$$ $1 # previous versions
- Xthen # merge pieces
- X cp $1 /tmp/put.b$$ # current version
- X chmod +w /tmp/put.b$$
- X echo "@@^$Version^$LOGNAME^`date`^$Summary" >> /tmp/put.b$$
- X diff -e $1 /tmp/put.a$$ >> /tmp/put.b$$ # latest diffs
- X sed -n '/^@@\^/,$p' <$HIST >>/tmp/put.b$$ # old diffs
- X trap '' 1 2 3 15
- X cp /tmp/put.b$$ $HIST # put it back
- Xelse # make a new one
- X echo "put: creating $HIST"
- X cp $1 $HIST
- X chmod =rw $HIST
- X echo "@@^$Version^$LOGNAME^`date`^$Summary" >> $HIST
- Xfi
- Xrm -f /tmp/put.*$$
- Xchmod -w $HIST
- END_OF_FILE
- if test 1769 -ne `wc -c <'put'`; then
- echo shar: \"'put'\" unpacked with wrong size!
- fi
- # end of 'put'
- fi
- if test -f 'unput' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'unput'\"
- else
- echo shar: Extracting \"'unput'\" \(991 characters\)
- sed "s/^X//" >'unput' <<'END_OF_FILE'
- X#!/bin/sh
- X# GAPS version 4.0
- X# get and put system - by Nadav Har'El
- X# unput: unput the last version from history
- Xtrap 'chmod -w $HIST' 1 2 3 15
- Xcase $# in
- X1) case $1 in
- X *.H) HIST=$1;;
- X *) HIST=$1.H
- X esac
- X if test -f $HIST
- X then
- X chmod u+w $HIST
- X fi ;;
- X*) echo 'Usage: unput file' 1>&2; exit 1 ;;
- Xesac
- Xif test ! -r $HIST -o ! -f $HIST
- Xthen
- X echo "unput: can't open history file $HIST" 1>&2
- X exit 1
- Xfi
- Xif test `grep "^@@\^" $HIST 2>/dev/null | wc -l` -le 1
- Xthen
- X echo "$HIST has only one version or not an history file." 1>&2
- X echo "Unput failed." 1>&2
- X exit 1
- Xfi
- Xtrap 'rm -f /tmp/unput.[abc]$$;chmod -w $HIST 2>/dev/null; exit 1' 1 2 3 15
- Xget -1 -o /tmp/unput.a$$ $HIST # get previous version
- Xawk -F\^ <$HIST >/tmp/unput.b$$ ' # find all diffs but last
- X /^@@\^/ { count++
- X if(count==1)print "removed version", $2 >"/tmp/unput.c'$$'" }
- X count >= 2
- X'
- Xtrap '' 1 2 3 15 # ignore signals
- Xcat /tmp/unput.[ab]$$ >$HIST
- Xcat /tmp/unput.c$$ 1>&2
- Xrm -f /tmp/unput.[abc]$$
- Xchmod -w $HIST
- END_OF_FILE
- if test 991 -ne `wc -c <'unput'`; then
- echo shar: \"'unput'\" unpacked with wrong size!
- fi
- # end of 'unput'
- fi
- if test -f 'vcat' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'vcat'\"
- else
- echo shar: Extracting \"'vcat'\" \(1464 characters\)
- sed "s/^X//" >'vcat' <<'END_OF_FILE'
- X#!/bin/sh
- X# GAPS version 4.0
- X# get and put system - by Nadav Har'El
- X# vcat: look at one version
- X
- XVERSION=0 # current version
- XUSAGE="Usage: $0 [-<number version> or -v<named version> or -c] file"
- XINPUT=
- X
- Xwhile test "$1" != ""
- Xdo
- X case $1 in
- X -[0-9]|-[0-9][0-9]|-[0-9][0-9][0-9])
- X VERSION=$1;; # 1-999 versions
- X -v*) VERSION=$1;;
- X # print current version of file (the version that
- X # will be saved when calling put). useful for doing
- X # vdiff -c -0 file which prints the difference between
- X # file itself and the last saved version of file.
- X -c) VERSION=$1;;
- X -*) echo $USAGE 1>&2; exit 1;;
- X *) INPUT=$1
- X case $INPUT in
- X *.H) ;;
- X *) INPUT=$INPUT.H ;;
- X esac ;;
- X esac
- X shift
- Xdone
- Xcase $INPUT in
- X"") echo $USAGE 1>&2; exit 1;;
- Xesac
- X
- Xtest -r $INPUT -a -f $INPUT || { echo "vcat: can't open $INPUT" 1>&2; exit 1; }
- X
- Xcase $VERSION in
- X-c) cat `expr $INPUT : '\(.*\).H'`
- X exit 0;;
- X-v*) VERSION=`ver "\`expr \"$VERSION\" : '^-v\(.*\)'\`" $INPUT` || exit 1;;
- Xesac
- X
- Xtrap 'rm -f /tmp/vcat.[abc]$$;exit 0' 1 2 3 15
- X# split into current version and editing command
- X# the following doesn't work
- X# sed <$INPUT -n '1,/^@@\^/w /tmp/vcat.a'$$'
- X# /^@@\^/,$w /tmp/vcat.b'$$
- Xsed <$INPUT '/^@@\^/q' >/tmp/vcat.a$$
- Xsed <$INPUT -n '/^@@\^/,$w /tmp/vcat.b'$$
- X# preform the edits
- Xawk </tmp/vcat.b$$ '
- X /^@@\^/ { count++ }
- X !/^@@\^/ && count > 0 && count <= - '$VERSION'
- X END { print "$d"; print "w", "/tmp/vcat.c'$$'" }
- X' | ed - /tmp/vcat.a$$
- Xcat /tmp/vcat.c$$
- Xrm -f /tmp/vcat.[abc]$$
- END_OF_FILE
- if test 1464 -ne `wc -c <'vcat'`; then
- echo shar: \"'vcat'\" unpacked with wrong size!
- fi
- # end of 'vcat'
- fi
- if test -f 'vdiff' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'vdiff'\"
- else
- echo shar: Extracting \"'vdiff'\" \(558 characters\)
- sed "s/^X//" >'vdiff' <<'END_OF_FILE'
- X#!/bin/sh
- X# GAPS version 4.0
- X# get and put system - by Nadav Har'El
- X# vdiff: compare two versions in history
- Xtrap 'rm -f /tmp/vcat[12].$$; exit 1' 1 2 3 15
- Xcase $# in
- X3) case $3 in
- X *.H) file=$3;;
- X *) file=$3.H;;
- X esac;;
- X1) case $1 in
- X *.H) file=$1;;
- X *) file=$1.H;;
- X esac
- X set -- -0 -c;;
- X*) echo "Usage: vdiff version1 version2 file" 1>&2
- X rm -f /tmp/vcat[12].$$
- X exit 1;;
- Xesac
- Xvcat $1 $file >/tmp/vcat1.$$ || { rm -f /tmp/vcat[12].$$;exit 1; }
- Xvcat $2 $file >/tmp/vcat2.$$ || { rm -f /tmp/vcat[12].$$;exit 1; }
- Xdiff /tmp/vcat[12].$$
- Xrm -f /tmp/vcat[12].$$
- END_OF_FILE
- if test 558 -ne `wc -c <'vdiff'`; then
- echo shar: \"'vdiff'\" unpacked with wrong size!
- fi
- # end of 'vdiff'
- fi
- if test -f 'ver' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'ver'\"
- else
- echo shar: Extracting \"'ver'\" \(414 characters\)
- sed "s/^X//" >'ver' <<'END_OF_FILE'
- X#!/bin/sh
- X# GAPS version 4.0
- X# get and put system - by Nadav Har'El
- X# ver: used in gaps programs for -v<named version> option
- Xcase $2 in
- X*.H) file=$2;;
- X*) file=$2.H;;
- Xesac
- Xif test ! -r $file
- Xthen
- X echo "Can't open $file" 1>&2
- X exit 1
- Xfi
- Xi=`grep "^@@\^" $file 2>/dev/null |
- Xawk '{print NR-1 "^" $0}' | fgrep "^@@^$1^" | awk -F\^ '{print $1}'`
- Xcase $i in
- X"") echo "No Version $1" 1>&2
- X exit 1;;
- X*) echo -"$i";;
- Xesac
- END_OF_FILE
- if test 414 -ne `wc -c <'ver'`; then
- echo shar: \"'ver'\" unpacked with wrong size!
- fi
- # end of 'ver'
- fi
- if test -f 'vls' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'vls'\"
- else
- echo shar: Extracting \"'vls'\" \(986 characters\)
- sed "s/^X//" >'vls' <<'END_OF_FILE'
- X#!/bin/sh
- X# GAPS version 4.0
- X# get and put system - by Nadav Har'El
- X# vls: list versions in history
- X
- XVERSION=- # the version to stop on (- if to show all versions)
- XXVERSION=
- X
- Xfor i
- Xdo
- X case $i in
- X -[0-9]|-[0-9][0-9]|-[0-9][0-9][0-9])
- X XVERSION=; VERSION=$i; continue;; # 1-999 versions
- X -a) XVERSION=; VERSION=-; continue;;
- X -v*) XVERSION=$i; continue;;
- X *.H) ;;
- X *) i=$i.H;;
- X esac
- X if test -r $i
- X then
- X # for each file we recalculate the numeric version from the
- X # named version
- X case $XVERSION in
- X -v*) VERSION=`ver "\`expr \"$XVERSION\" : '^-v\(.*\)'\`" $i` || continue;;
- X esac
- X
- X echo
- X echo " $i:"
- X echo
- X if test x$VERSION = x-
- X then
- X grep "^@@\^" $i
- X else
- X grep "^@@\^" $i | awk "{ print; if(NR>(-($VERSION))) exit }"
- X fi |
- X awk -F\^ '
- X { printf "(-%d) Version: %s, Owner: %s, ",NR-1,$2,$3
- X printf "Date: %s",$4
- X printf "\nSummary: %s", $5
- X for(i=6;i<=NF;i++)
- X printf "\n %s",$i
- X print "\n"
- X }'
- X else
- X echo "can't open $i" 1>&2
- X fi
- Xdone
- END_OF_FILE
- if test 986 -ne `wc -c <'vls'`; then
- echo shar: \"'vls'\" unpacked with wrong size!
- fi
- # end of 'vls'
- fi
- echo shar: End of archive 1 \(of 1\).
- cp /dev/null ark1isdone
- MISSING=""
- for I in 1 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have the archive.
- rm -f ark[1-9]isdone
- else
- echo You still must unpack the following archives:
- echo " " ${MISSING}
- fi
- exit 0
- exit 0 # Just in case...
-