From: dfk@wildcat.dartmouth.edu (David Kotz)
Newsgroups: comp.text.tex
Subject: some handy bibtex tools
Summary: searching, printing, and exporting bibtex files
Keywords: bibtex, shell script, printing bib files
Date: 3 Sep 92 13:24:14 GMT
Organization: Dartmouth College, Hanover, NH
Originator: dfk@wildcat.dartmouth.edu

September 3, 1992

This is a collection of BibTeX tools written (mostly) by David Kotz.
I provide them as-is.  Use them as you please. Some slight
modifications may be needed to pathnames embedded in the shell
scripts, to find the library files they need (sed, awk, and bst
files).

The programs are:
	   aux2bib - given an .aux file, make a portable .bib file to go
with it. This is useful when you need to ship a tex file elsewhere

	   bibify - this can be used to eliminate one pass of LaTeX in
many cases: (latex, bibtex, bibify, latex), instead of (latex, bibtex,
latex, latex). Handy for large documents. Does not work with multiple
aux files.  

	   bibkey - make a list of all entries that have the given
keyword in their "keyword" field.

	   cleantex - really a general tex script, this removes all the
little files created by tex and latex as they run, leaving only the
original files.

	   looktex - makes a list of all entries that match a given regexp 

	   makebib - makes an exportable .bib file from a given set of
bib files and an optional list of citations. Handy for posting bib
entries on the net! The portability comes from substituting @strings,
and stripping "comment" fields if you like. Ignore the -d option.

	   printbib - the most useful of all; this makes a dvi file from
a .bib file for handy reference, sorted by cite key and including
"keyword", "abstract", and "comment" fields.

See the shell scripts for more documentation.
Otherwise you're on your own. Good luck.

David Kotz
dfk@cs.dartmouth.edu

#!/bin/sh
# This is a shell archive (shar 3.20)
# made 09/03/1992 13:20 UTC by dfk@wildcat
# Source directory /new/dfk/bib/bibtools
#
# existing files will NOT be overwritten
# The unsharer will be INTERACTIVELY queried.
#
# This shar contains:
# length  mode       name
# ------ ---------- ------------------------------------------
#   1536 -rw-r--r-- README
#  23838 -rw-r--r-- abstract.bst
#   1968 -rwxr-xr-x aux2bib
#    644 -rwxr-xr-x bibify
#   1469 -rwxr-xr-x bibkey
#    740 -rw-r--r-- bibkey.awk
#    751 -rw-r--r-- bibkey.sed
#    468 -rwxr-xr-x cleantex
#   1443 -rwxr-xr-x looktex
#   1012 -rw-r--r-- looktex.awk
#   1566 -rwxr-xr-x makebib
#   1287 -rwxr-xr-x printbib
#   5667 -rw-r--r-- subset-dfk.bst
#   5473 -rw-r--r-- subset-nocomment.bst
#   5442 -rw-r--r-- subset.bst
#
if touch 2>&1 | fgrep '[-amc]' > /dev/null
 then TOUCH=touch
 else TOUCH=true
fi
wish=
# ============= README ==============
if test X"$1" != X"-c" -a -f 'README'; then
	case $wish in
	A*|a*) echo x - overwriting 'README';;
	*) echo "? - overwrite 'README' -- [No], [Y]es, [A]ll, [Q]uit? "
		read wish;;
	esac
	case $wish in
	Q*|q*) echo aborted; exit 86;;
	A*|a*|Y*|y*) x=Y;;
	*) x=N;;
	esac
else
	x=Y
fi
if test $x != Y; then
	echo x - skipping 'README'
else
echo "x - extracting README (Text)"
sed 's/^X//' << 'SHAR_EOF' > README &&
XSeptember 3, 1992
X
XThis is a collection of BibTeX tools written (mostly) by David Kotz.
XI provide them as-is.  Use them as you please. Some slight
Xmodifications may be needed to pathnames embedded in the shell
Xscripts, to find the library files they need (sed, awk, and bst
Xfiles).
X
XThe programs are:
X	   aux2bib - given an .aux file, make a portable .bib file to go
Xwith it. This is useful when you need to ship a tex file elsewhere
X
X	   bibify - this can be used to eliminate one pass of LaTeX in
Xmany cases: (latex, bibtex, bibify, latex), instead of (latex, bibtex,
Xlatex, latex). Handy for large documents. Does not work with multiple
Xaux files.  
X
X	   bibkey - make a list of all entries that have the given
Xkeyword in their "keyword" field.
X
X	   cleantex - really a general tex script, this removes all the
Xlittle files created by tex and latex as they run, leaving only the
Xoriginal files.
X
X	   looktex - makes a list of all entries that match a given regexp 
X
X	   makebib - makes an exportable .bib file from a given set of
Xbib files and an optional list of citations. Handy for posting bib
Xentries on the net! The portability comes from substituting @strings,
Xand stripping "comment" fields if you like. Ignore the -d option.
X
X	   printbib - the most useful of all; this makes a dvi file from
Xa .bib file for handy reference, sorted by cite key and including
X"keyword", "abstract", and "comment" fields.
X
XSee the shell scripts for more documentation.
XOtherwise you're on your own. Good luck.
X
XDavid Kotz
Xdfk@cs.dartmouth.edu
X
SHAR_EOF
$TOUCH -am 0903091892 README &&
chmod 0644 README ||
echo "restore of README failed"
set `wc -c README`;Wc_c=$1
if test "$Wc_c" != "1536"; then
	echo original size 1536, current size $Wc_c
fi
fi
# ============= abstract.bst ==============
if test X"$1" != X"-c" -a -f 'abstract.bst'; then
	case $wish in
	A*|a*) echo x - overwriting 'abstract.bst';;
	*) echo "? - overwrite 'abstract.bst' -- [No], [Y]es, [A]ll, [Q]uit? "
		read wish;;
	esac
	case $wish in
	Q*|q*) echo aborted; exit 86;;
	A*|a*|Y*|y*) x=Y;;
	*) x=N;;
	esac
else
	x=Y
fi
if test $x != Y; then
	echo x - skipping 'abstract.bst'
else
echo "x - extracting abstract.bst (Text)"
sed 's/^X//' << 'SHAR_EOF' > abstract.bst &&
X% BibTeX bibliography style `abstract' 
X% by David Kotz dfk@cs.duke.edu
X% March 1989
X%    modified from
X% BibTeX standard bibliography style `alpha'
X	% version 0.99a for BibTeX versions 0.99a or later, LaTeX version 2.09.
X	% Copyright (C) 1985, all rights reserved.
X	% Copying of this file is authorized only if either
X	% (1) you make absolutely no changes to your copy, including name, or
X	% (2) if you do make changes, you name it something other than
X	% btxbst.doc, plain.bst, unsrt.bst, alpha.bst, and abbrv.bst.
X	% This restriction helps ensure that all standard styles are identical.
X	% The file btxbst.doc has the documentation for this style.
X
X% DFK added abstract, comment, keyword
XENTRY
X  { abstract
X    address
X    author
X    booktitle
X    chapter
X    comment
X    edition
X    editor
X    howpublished
X    institution
X    journal
X    key
X    keyword
X    month
X    note
X    number
X    organization
X    pages
X    publisher
X    school
X    series
X    title
X    type
X    volume
X    year
X  }
X  {}
X  { label extra.label sort.label }
X
X% DFK added after.quote to signify end of something not needing period
XINTEGERS { output.state before.all mid.sentence after.sentence after.block after.quote}
X
X% DFK added after.quote 
XFUNCTION {init.state.consts}
X{ #0 'before.all :=
X  #1 'mid.sentence :=
X  #2 'after.sentence :=
X  #3 'after.block :=
X  #4 'after.quote :=
X}
X
XSTRINGS { s t }
X
X% DFK added after.quote handling so no period is printed after quotes
XFUNCTION {output.nonnull}
X{ 's :=
X  output.state after.quote =
X    { write$
X      newline$
X      "\newblock " write$
X    }
X  { output.state mid.sentence =
X    { ", " * write$ }
X    { output.state after.block =
X	{ add.period$ write$
X	  newline$
X	  "\newblock " write$
X	}
X	{ output.state before.all =
X	     'write$
X	     { add.period$ " " * write$ }
X	    if$
X	}
X      if$
X      mid.sentence 'output.state :=
X    }
X  if$
X  }
X  if$
X  s
X}
X
XFUNCTION {output}
X{ duplicate$ empty$
X    'pop$
X    'output.nonnull
X  if$
X}
X
X% DFK added, variant of output
XFUNCTION {output.quote}
X{ duplicate$ empty$
X    'pop$
X    { output.nonnull 
X	 after.quote 'output.state :=}
X  if$
X}
X
XFUNCTION {output.check}
X{ 't :=
X  duplicate$ empty$
X    { pop$ "empty " t * " in " * cite$ * warning$ }
X    'output.nonnull
X  if$
X}
X
X% DFK changed to use cite$ for the label
XFUNCTION {output.bibitem}
X{ newline$
X  "\bibitem[" write$
X  cite$ write$
X  "]{" write$
X  cite$ write$
X  "}" write$
X  newline$
X  ""
X  before.all 'output.state :=
X}
X
X% DFK changed to not put period when after.quote
XFUNCTION {fin.entry}
X{ output.state after.quote =
X   'skip$
X   'add.period$
X  if$
X  write$
X  newline$
X}
X
XFUNCTION {new.block}
X{ output.state before.all =
X    'skip$
X    { after.block 'output.state := }
X  if$
X}
X
XFUNCTION {new.sentence}
X{ output.state after.block =
X    'skip$
X    { output.state before.all =
X	'skip$
X	{ after.sentence 'output.state := }
X      if$
X    }
X  if$
X}
X
XFUNCTION {not}
X{   { #0 }
X    { #1 }
X  if$
X}
X
XFUNCTION {and}
X{   'skip$
X    { pop$ #0 }
X  if$
X}
X
XFUNCTION {or}
X{   { pop$ #1 }
X    'skip$
X  if$
X}
X
XFUNCTION {new.block.checka}
X{ empty$
X    'skip$
X    'new.block
X  if$
X}
X
XFUNCTION {new.block.checkb}
X{ empty$
X  swap$ empty$
X  and
X    'skip$
X    'new.block
X  if$
X}
X
XFUNCTION {new.sentence.checka}
X{ empty$
X    'skip$
X    'new.sentence
X  if$
X}
X
XFUNCTION {new.sentence.checkb}
X{ empty$
X  swap$ empty$
X  and
X    'skip$
X    'new.sentence
X  if$
X}
X
XFUNCTION {field.or.null}
X{ duplicate$ empty$
X    { pop$ "" }
X    'skip$
X  if$
X}
X
XFUNCTION {emphasize}
X{ duplicate$ empty$
X    { pop$ "" }
X    { "{\em " swap$ * "}" * }
X  if$
X}
X
XINTEGERS { nameptr namesleft numnames }
X
XFUNCTION {format.names}
X{ 's :=
X  #1 'nameptr :=
X  s num.names$ 'numnames :=
X  numnames 'namesleft :=
X    { namesleft #0 > }
X    { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't :=
X      nameptr #1 >
X	{ namesleft #1 >
X	    { ", " * t * }
X	    { numnames #2 >
X		{ "," * }
X		'skip$
X	      if$
X	      t "others" =
X		{ " et~al." * }
X		{ " and " * t * }
X	      if$
X	    }
X	  if$
X	}
X	't
X      if$
X      nameptr #1 + 'nameptr :=
X      namesleft #1 - 'namesleft :=
X    }
X  while$
X}
X
XFUNCTION {format.authors}
X{ author empty$
X    { "" }
X    { author format.names }
X  if$
X}
X
XFUNCTION {format.editors}
X{ editor empty$
X    { "" }
X    { editor format.names
X      editor num.names$ #1 >
X	{ ", editors" * }
X	{ ", editor" * }
X      if$
X    }
X  if$
X}
X
XFUNCTION {format.title}
X{ title empty$
X    { "" }
X    { title "t" change.case$ }
X  if$
X}
X
XFUNCTION {n.dashify}
X{ 't :=
X  ""
X    { t empty$ not }
X    { t #1 #1 substring$ "-" =
X	{ t #1 #2 substring$ "--" = not
X	    { "--" *
X	      t #2 global.max$ substring$ 't :=
X	    }
X	    {   { t #1 #1 substring$ "-" = }
X		{ "-" *
X		  t #2 global.max$ substring$ 't :=
X		}
X	      while$
X	    }
X	  if$
X	}
X	{ t #1 #1 substring$ *
X	  t #2 global.max$ substring$ 't :=
X	}
X      if$
X    }
X  while$
X}
X
XFUNCTION {format.date}
X{ year empty$
X    { month empty$
X	{ "" }
X	{ "there's a month but no year in " cite$ * warning$
X	  month
X	}
X      if$
X    }
X    { month empty$
X	'year
X	{ month " " * year * }
X      if$
X    }
X  if$
X}
X
XFUNCTION {format.btitle}
X{ title emphasize
X}
X
XFUNCTION {tie.or.space.connect}
X{ duplicate$ text.length$ #3 <
X    { "~" }
X    { " " }
X  if$
X  swap$ * *
X}
X
XFUNCTION {either.or.check}
X{ empty$
X    'pop$
X    { "can't use both " swap$ * " fields in " * cite$ * warning$ }
X  if$
X}
X
XFUNCTION {format.bvolume}
X{ volume empty$
X    { "" }
X    { "volume" volume tie.or.space.connect
X      series empty$
X	'skip$
X	{ " of " * series emphasize * }
X      if$
X      "volume and number" number either.or.check
X    }
X  if$
X}
X
XFUNCTION {format.number.series}
X{ volume empty$
X    { number empty$
X	{ series field.or.null }
X	{ output.state mid.sentence =
X	    { "number" }
X	    { "Number" }
X	  if$
X	  number tie.or.space.connect
X	  series empty$
X	    { "there's a number but no series in " cite$ * warning$ }
X	    { " in " * series * }
X	  if$
X	}
X      if$
X    }
X    { "" }
X  if$
X}
X
XFUNCTION {format.edition}
X{ edition empty$
X    { "" }
X    { output.state mid.sentence =
X	{ edition "l" change.case$ " edition" * }
X	{ edition "t" change.case$ " edition" * }
X      if$
X    }
X  if$
X}
X
XINTEGERS { multiresult }
X
XFUNCTION {multi.page.check}
X{ 't :=
X  #0 'multiresult :=
X    { multiresult not
X      t empty$ not
X      and
X    }
X    { t #1 #1 substring$
X      duplicate$ "-" =
X      swap$ duplicate$ "," =
X      swap$ "+" =
X      or or
X	{ #1 'multiresult := }
X	{ t #2 global.max$ substring$ 't := }
X      if$
X    }
X  while$
X  multiresult
X}
X
XFUNCTION {format.pages}
X{ pages empty$
X    { "" }
X    { pages multi.page.check
X	{ "pages" pages n.dashify tie.or.space.connect }
X	{ "page" pages tie.or.space.connect }
X      if$
X    }
X  if$
X}
X
XFUNCTION {format.vol.num.pages}
X{ volume field.or.null
X  number empty$
X    'skip$
X    { "(" number * ")" * *
X      volume empty$
X	{ "there's a number but no volume in " cite$ * warning$ }
X	'skip$
X      if$
X    }
X  if$
X  pages empty$
X    'skip$
X    { duplicate$ empty$
X	{ pop$ format.pages }
X	{ ":" * pages n.dashify * }
X      if$
X    }
X  if$
X}
X
XFUNCTION {format.chapter.pages}
X{ chapter empty$
X    'format.pages
X    { type empty$
X	{ "chapter" }
X	{ type "l" change.case$ }
X      if$
X      chapter tie.or.space.connect
X      pages empty$
X	'skip$
X	{ ", " * format.pages * }
X      if$
X    }
X  if$
X}
X
XFUNCTION {format.in.ed.booktitle}
X{ booktitle empty$
X    { "" }
X    { editor empty$
X	{ "In " booktitle emphasize * }
X	{ "In " format.editors * ", " * booktitle emphasize * }
X      if$
X    }
X  if$
X}
X
XFUNCTION {empty.misc.check}
X{ author empty$ title empty$ howpublished empty$
X  month empty$ year empty$ note empty$
X  and and and and and
X  key empty$ not and
X    { "all relevant fields are empty in " cite$ * warning$ }
X    'skip$
X  if$
X}
X
XFUNCTION {format.thesis.type}
X{ type empty$
X    'skip$
X    { pop$
X      type "t" change.case$
X    }
X  if$
X}
X
XFUNCTION {format.tr.number}
X{ type empty$
X    { "Technical Report" }
X    'type
X  if$
X  number empty$
X    { "t" change.case$ }
X    { number tie.or.space.connect }
X  if$
X}
X
XFUNCTION {format.article.crossref}
X{ key empty$
X    { journal empty$
X	{ "need key or journal for " cite$ * " to crossref " * crossref *
X	  warning$
X	  ""
X	}
X	{ "In {\em " journal * "\/}" * }
X      if$
X    }
X    { "In " key * }
X  if$
X  " \cite{" * crossref * "}" *
X}
X
XFUNCTION {format.crossref.editor}
X{ editor #1 "{vv~}{ll}" format.name$
X  editor num.names$ duplicate$
X  #2 >
X    { pop$ " et~al." * }
X    { #2 <
X	'skip$
X	{ editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
X	    { " et~al." * }
X	    { " and " * editor #2 "{vv~}{ll}" format.name$ * }
X	  if$
X	}
X      if$
X    }
X  if$
X}
X
XFUNCTION {format.book.crossref}
X{ volume empty$
X    { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
X      "In "
X    }
X    { "Volume" volume tie.or.space.connect
X      " of " *
X    }
X  if$
X  editor empty$
X  editor field.or.null author field.or.null =
X  or
X    { key empty$
X	{ series empty$
X	    { "need editor, key, or series for " cite$ * " to crossref " *
X	      crossref * warning$
X	      "" *
X	    }
X	    { "{\em " * series * "\/}" * }
X	  if$
X	}
X	{ key * }
X      if$
X    }
X    { format.crossref.editor * }
X  if$
X  " \cite{" * crossref * "}" *
X}
X
XFUNCTION {format.incoll.inproc.crossref}
X{ editor empty$
X  editor field.or.null author field.or.null =
X  or
X    { key empty$
X	{ booktitle empty$
X	    { "need editor, key, or booktitle for " cite$ * " to crossref " *
X	      crossref * warning$
X	      ""
X	    }
X	    { "In {\em " booktitle * "\/}" * }
X	  if$
X	}
X	{ "In " key * }
X      if$
X    }
X    { "In " format.crossref.editor * }
X  if$
X  " \cite{" * crossref * "}" *
X}
X
X% DFK added
XFUNCTION {format.abstract}
X{ abstract empty$
X    { "" }
X    { "\begin{quote} {\bf Abstract:} " abstract * " \end{quote}" *}
X  if$
X}
X
X% DFK added
XFUNCTION {format.keyword}
X{ keyword empty$
X    { "" }
X    { "\begin{quote} {\bf Keyword:} " keyword * " \end{quote}" *}
X  if$
X}
X
X% DFK added
XFUNCTION {format.comment}
X{ comment empty$
X    { "" }
X    { "\begin{quote} {\bf Comment:} " comment * " \end{quote}" *}
X  if$
X}
X
X% DFK added
XFUNCTION {dfk.stuff}
X{ new.block
X  format.abstract output.quote
X%  new.block
X  format.keyword output.quote
X%  new.block
X  format.comment output.quote
X}
X
X% DFK: added a call to dfk.stuff in all entry-type functions below
X
XFUNCTION {article}
X{ output.bibitem
X  format.authors "author" output.check
X  new.block
X  format.title "title" output.check
X  new.block
X  crossref missing$
X    { journal emphasize "journal" output.check
X      format.vol.num.pages output
X      format.date "year" output.check
X    }
X    { format.article.crossref output.nonnull
X      format.pages output
X    }
X  if$
X  new.block
X  note output
X  dfk.stuff
X  fin.entry
X}
X
XFUNCTION {book}
X{ output.bibitem
X  author empty$
X    { format.editors "author and editor" output.check }
X    { format.authors output.nonnull
X      crossref missing$
X	{ "author and editor" editor either.or.check }
X	'skip$
X      if$
X    }
X  if$
X  new.block
X  format.btitle "title" output.check
X  crossref missing$
X    { format.bvolume output
X      new.block
X      format.number.series output
X      new.sentence
X      publisher "publisher" output.check
X      address output
X    }
X    { new.block
X      format.book.crossref output.nonnull
X    }
X  if$
X  format.edition output
X  format.date "year" output.check
X  new.block
X  note output
X  dfk.stuff
X  fin.entry
X}
X
XFUNCTION {booklet}
X{ output.bibitem
X  format.authors output
X  new.block
X  format.title "title" output.check
X  howpublished address new.block.checkb
X  howpublished output
X  address output
X  format.date output
X  new.block
X  note output
X  dfk.stuff
X  fin.entry
X}
X
XFUNCTION {inbook}
X{ output.bibitem
X  author empty$
X    { format.editors "author and editor" output.check }
X    { format.authors output.nonnull
X      crossref missing$
X	{ "author and editor" editor either.or.check }
X	'skip$
X      if$
X    }
X  if$
X  new.block
X  format.btitle "title" output.check
X  crossref missing$
X    { format.bvolume output
X      format.chapter.pages "chapter and pages" output.check
X      new.block
X      format.number.series output
X      new.sentence
X      publisher "publisher" output.check
X      address output
X    }
X    { format.chapter.pages "chapter and pages" output.check
X      new.block
X      format.book.crossref output.nonnull
X    }
X  if$
X  format.edition output
X  format.date "year" output.check
X  new.block
X  note output
X  dfk.stuff
X  fin.entry
X}
X
XFUNCTION {incollection}
X{ output.bibitem
X  format.authors "author" output.check
X  new.block
X  format.title "title" output.check
X  new.block
X  crossref missing$
X    { format.in.ed.booktitle "booktitle" output.check
X      format.bvolume output
X      format.number.series output
X      format.chapter.pages output
X      new.sentence
X      publisher "publisher" output.check
X      address output
X      format.edition output
X      format.date "year" output.check
X    }
X    { format.incoll.inproc.crossref output.nonnull
X      format.chapter.pages output
X    }
X  if$
X  new.block
X  note output
X  dfk.stuff
X  fin.entry
X}
X
XFUNCTION {inproceedings}
X{ output.bibitem
X  format.authors "author" output.check
X  new.block
X  format.title "title" output.check
X  new.block
X  crossref missing$
X    { format.in.ed.booktitle "booktitle" output.check
X      format.bvolume output
X      format.number.series output
X      format.pages output
X      address empty$
X	{ organization publisher new.sentence.checkb
X	  organization output
X	  publisher output
X	  format.date "year" output.check
X	}
X	{ address output.nonnull
X	  format.date "year" output.check
X	  new.sentence
X	  organization output
X	  publisher output
X	}
X      if$
X    }
X    { format.incoll.inproc.crossref output.nonnull
X      format.pages output
X    }
X  if$
X  new.block
X  note output
X  dfk.stuff
X  fin.entry
X}
X
XFUNCTION {conference} { inproceedings }
X
XFUNCTION {manual}
X{ output.bibitem
X  author empty$
X    { organization empty$
X	'skip$
X	{ organization output.nonnull
X	  address output
X	}
X      if$
X    }
X    { format.authors output.nonnull }
X  if$
X  new.block
X  format.btitle "title" output.check
X  author empty$
X    { organization empty$
X	{ address new.block.checka
X	  address output
X	}
X	'skip$
X      if$
X    }
X    { organization address new.block.checkb
X      organization output
X      address output
X    }
X  if$
X  format.edition output
X  format.date output
X  new.block
X  note output
X  dfk.stuff
X  fin.entry
X}
X
XFUNCTION {mastersthesis}
X{ output.bibitem
X  format.authors "author" output.check
X  new.block
X  format.title "title" output.check
X  new.block
X  "Master's thesis" format.thesis.type output.nonnull
X  school "school" output.check
X  address output
X  format.date "year" output.check
X  new.block
X  note output
X  dfk.stuff
X  fin.entry
X}
X
XFUNCTION {misc}
X{ output.bibitem
X  format.authors output
X  title howpublished new.block.checkb
X  format.title output
X  howpublished new.block.checka
X  howpublished output
X  format.date output
X  new.block
X  note output
X  dfk.stuff
X  fin.entry
X  empty.misc.check
X}
X
XFUNCTION {phdthesis}
X{ output.bibitem
X  format.authors "author" output.check
X  new.block
X  format.btitle "title" output.check
X  new.block
X  "PhD thesis" format.thesis.type output.nonnull
X  school "school" output.check
X  address output
X  format.date "year" output.check
X  new.block
X  note output
X  dfk.stuff
X  fin.entry
X}
X
XFUNCTION {proceedings}
X{ output.bibitem
X  editor empty$
X    { organization output }
X    { format.editors output.nonnull }
X  if$
X  new.block
X  format.btitle "title" output.check
X  format.bvolume output
X  format.number.series output
X  address empty$
X    { editor empty$
X	{ publisher new.sentence.checka }
X	{ organization publisher new.sentence.checkb
X	  organization output
X	}
X      if$
X      publisher output
X      format.date "year" output.check
X    }
X    { address output.nonnull
X      format.date "year" output.check
X      new.sentence
X      editor empty$
X	'skip$
X	{ organization output }
X      if$
X      publisher output
X    }
X  if$
X  new.block
X  note output
X  dfk.stuff
X  fin.entry
X}
X
XFUNCTION {techreport}
X{ output.bibitem
X  format.authors "author" output.check
X  new.block
X  format.title "title" output.check
X  new.block
X  format.tr.number output.nonnull
X  institution "institution" output.check
X  address output
X  format.date "year" output.check
X  new.block
X  note output
X  dfk.stuff
X  fin.entry
X}
X
XFUNCTION {unpublished}
X{ output.bibitem
X  format.authors "author" output.check
X  new.block
X  format.title "title" output.check
X  new.block
X  note "note" output.check
X  format.date output
X  dfk.stuff
X  fin.entry
X}
X
XFUNCTION {default.type} { misc }
X
XMACRO {jan} {"January"}
X
XMACRO {feb} {"February"}
X
XMACRO {mar} {"March"}
X
XMACRO {apr} {"April"}
X
XMACRO {may} {"May"}
X
XMACRO {jun} {"June"}
X
XMACRO {jul} {"July"}
X
XMACRO {aug} {"August"}
X
XMACRO {sep} {"September"}
X
XMACRO {oct} {"October"}
X
XMACRO {nov} {"November"}
X
XMACRO {dec} {"December"}
X
XMACRO {acmcs} {"ACM Computing Surveys"}
X
XMACRO {acta} {"Acta Informatica"}
X
XMACRO {cacm} {"Communications of the ACM"}
X
XMACRO {ibmjrd} {"IBM Journal of Research and Development"}
X
XMACRO {ibmsj} {"IBM Systems Journal"}
X
XMACRO {ieeese} {"IEEE Transactions on Software Engineering"}
X
XMACRO {ieeetc} {"IEEE Transactions on Computers"}
X
XMACRO {ieeetcad}
X {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"}
X
XMACRO {ipl} {"Information Processing Letters"}
X
XMACRO {jacm} {"Journal of the ACM"}
X
XMACRO {jcss} {"Journal of Computer and System Sciences"}
X
XMACRO {scp} {"Science of Computer Programming"}
X
XMACRO {sicomp} {"SIAM Journal on Computing"}
X
XMACRO {tocs} {"ACM Transactions on Computer Systems"}
X
XMACRO {tods} {"ACM Transactions on Database Systems"}
X
XMACRO {tog} {"ACM Transactions on Graphics"}
X
XMACRO {toms} {"ACM Transactions on Mathematical Software"}
X
XMACRO {toois} {"ACM Transactions on Office Information Systems"}
X
XMACRO {toplas} {"ACM Transactions on Programming Languages and Systems"}
X
XMACRO {tcs} {"Theoretical Computer Science"}
X
XREAD
X
XFUNCTION {sortify}
X{ purify$
X  "l" change.case$
X}
X
XINTEGERS { len }
X
XFUNCTION {chop.word}
X{ 's :=
X  'len :=
X  s #1 len substring$ =
X    { s len #1 + global.max$ substring$ }
X    's
X  if$
X}
X
XINTEGERS { et.al.char.used }
X
XFUNCTION {initialize.et.al.char.used}
X{ #0 'et.al.char.used :=
X}
X
XEXECUTE {initialize.et.al.char.used}
X
XFUNCTION {format.lab.names}
X{ 's :=
X  s num.names$ 'numnames :=
X  numnames #1 >
X    { numnames #4 >
X	{ #3 'namesleft := }
X	{ numnames 'namesleft := }
X      if$
X      #1 'nameptr :=
X      ""
X	{ namesleft #0 > }
X	{ nameptr numnames =
X	    { s nameptr "{ff }{vv }{ll}{ jj}" format.name$ "others" =
X		{ "{\etalchar{+}}" *
X		  #1 'et.al.char.used :=
X		}
X		{ s nameptr "{v{}}{l{}}" format.name$ * }
X	      if$
X	    }
X	    { s nameptr "{v{}}{l{}}" format.name$ * }
X	  if$
X	  nameptr #1 + 'nameptr :=
X	  namesleft #1 - 'namesleft :=
X	}
X      while$
X      numnames #4 >
X	{ "{\etalchar{+}}" *
X	  #1 'et.al.char.used :=
X	}
X	'skip$
X      if$
X    }
X    { s #1 "{v{}}{l{}}" format.name$
X      duplicate$ text.length$ #2 <
X	{ pop$ s #1 "{ll}" format.name$ #3 text.prefix$ }
X	'skip$
X      if$
X    }
X  if$
X}
X
XFUNCTION {author.key.label}
X{ author empty$
X    { key empty$
X	{ cite$ #1 #3 substring$ }
X	{ key #3 text.prefix$ }
X      if$
X    }
X    { author format.lab.names }
X  if$
X}
X
XFUNCTION {author.editor.key.label}
X{ author empty$
X    { editor empty$
X	{ key empty$
X	    { cite$ #1 #3 substring$ }
X	    { key #3 text.prefix$ }
X	  if$
X	}
X	{ editor format.lab.names }
X      if$
X    }
X    { author format.lab.names }
X  if$
X}
X
XFUNCTION {author.key.organization.label}
X{ author empty$
X    { key empty$
X	{ organization empty$
X	    { cite$ #1 #3 substring$ }
X	    { "The " #4 organization chop.word #3 text.prefix$ }
X	  if$
X	}
X	{ key #3 text.prefix$ }
X      if$
X    }
X    { author format.lab.names }
X  if$
X}
X
XFUNCTION {editor.key.organization.label}
X{ editor empty$
X    { key empty$
X	{ organization empty$
X	    { cite$ #1 #3 substring$ }
X	    { "The " #4 organization chop.word #3 text.prefix$ }
X	  if$
X	}
X	{ key #3 text.prefix$ }
X      if$
X    }
X    { editor format.lab.names }
X  if$
X}
X
XFUNCTION {calc.label}
X{ type$ "book" =
X  type$ "inbook" =
X  or
X    'author.editor.key.label
X    { type$ "proceedings" =
X	'editor.key.organization.label
X	{ type$ "manual" =
X	    'author.key.organization.label
X	    'author.key.label
X	  if$
X	}
X      if$
X    }
X  if$
X  duplicate$
X  year field.or.null purify$ #-1 #2 substring$
X  *
X  'label :=
X  year field.or.null purify$ #-1 #4 substring$
X  *
X  sortify 'sort.label :=
X}
X
XFUNCTION {sort.format.names}
X{ 's :=
X  #1 'nameptr :=
X  ""
X  s num.names$ 'numnames :=
X  numnames 'namesleft :=
X    { namesleft #0 > }
X    { nameptr #1 >
X	{ "   " * }
X	'skip$
X      if$
X      s nameptr "{vv{ } }{ll{ }}{  ff{ }}{  jj{ }}" format.name$ 't :=
X      nameptr numnames = t "others" = and
X	{ "et al" * }
X	{ t sortify * }
X      if$
X      nameptr #1 + 'nameptr :=
X      namesleft #1 - 'namesleft :=
X    }
X  while$
X}
X
XFUNCTION {sort.format.title}
X{ 't :=
X  "A " #2
X    "An " #3
X      "The " #4 t chop.word
X    chop.word
X  chop.word
X  sortify
X  #1 global.max$ substring$
X}
X
XFUNCTION {author.sort}
X{ author empty$
X    { key empty$
X	{ "to sort, need author or key in " cite$ * warning$
X	  ""
X	}
X	{ key sortify }
X      if$
X    }
X    { author sort.format.names }
X  if$
X}
X
XFUNCTION {author.editor.sort}
X{ author empty$
X    { editor empty$
X	{ key empty$
X	    { "to sort, need author, editor, or key in " cite$ * warning$
X	      ""
X	    }
X	    { key sortify }
X	  if$
X	}
X	{ editor sort.format.names }
X      if$
X    }
X    { author sort.format.names }
X  if$
X}
X
XFUNCTION {author.organization.sort}
X{ author empty$
X    { organization empty$
X	{ key empty$
X	    { "to sort, need author, organization, or key in " cite$ * warning$
X	      ""
X	    }
X	    { key sortify }
X	  if$
X	}
X	{ "The " #4 organization chop.word sortify }
X      if$
X    }
X    { author sort.format.names }
X  if$
X}
X
XFUNCTION {editor.organization.sort}
X{ editor empty$
X    { organization empty$
X	{ key empty$
X	    { "to sort, need editor, organization, or key in " cite$ * warning$
X	      ""
X	    }
X	    { key sortify }
X	  if$
X	}
X	{ "The " #4 organization chop.word sortify }
X      if$
X    }
X    { editor sort.format.names }
X  if$
X}
X
XFUNCTION {presort}
X{ calc.label
X  sort.label
X  "    "
X  *
X  type$ "book" =
X  type$ "inbook" =
X  or
X    'author.editor.sort
X    { type$ "proceedings" =
X	'editor.organization.sort
X	{ type$ "manual" =
X	    'author.organization.sort
X	    'author.sort
X	  if$
X	}
X      if$
X    }
X  if$
X  *
X  "    "
X  *
X  year field.or.null sortify
X  *
X  "    "
X  *
X  title field.or.null
X  sort.format.title
X  *
X% DFK throw away stuff above and use cite$ for sort key
X  pop$
X  cite$
X  #1 entry.max$ substring$
X  'sort.key$ :=
X}
X
XITERATE {presort}
X
XSORT
X
XSTRINGS { longest.label last.sort.label next.extra }
X
XINTEGERS { longest.label.width last.extra.num }
X
XFUNCTION {initialize.longest.label}
X{ "" 'longest.label :=
X  #0 int.to.chr$ 'last.sort.label :=
X  "" 'next.extra :=
X  #0 'longest.label.width :=
X  #0 'last.extra.num :=
X}
X
XFUNCTION {forward.pass}
X{ last.sort.label sort.label =
X    { last.extra.num #1 + 'last.extra.num :=
X      last.extra.num int.to.chr$ 'extra.label :=
X    }
X    { "a" chr.to.int$ 'last.extra.num :=
X      "" 'extra.label :=
X      sort.label 'last.sort.label :=
X    }
X  if$
X}
X
XFUNCTION {reverse.pass}
X{ next.extra "b" =
X    { "a" 'extra.label := }
X    'skip$
X  if$
X  label extra.label * 'label :=
X  label width$ longest.label.width >
X    { label 'longest.label :=
X      label width$ 'longest.label.width :=
X    }
X    'skip$
X  if$
X  extra.label 'next.extra :=
X}
X
XEXECUTE {initialize.longest.label}
X
XITERATE {forward.pass}
X
XREVERSE {reverse.pass}
X
XFUNCTION {begin.bib}
X{ et.al.char.used
X    { "\newcommand{\etalchar}[1]{$^{#1}$}" write$ newline$ }
X    'skip$
X  if$
X  preamble$ empty$
X    'skip$
X    { preamble$ write$ newline$ }
X  if$
X  "\begin{thebibliography}{"  longest.label  * "}" * write$ newline$
X}
X
XEXECUTE {begin.bib}
X
XEXECUTE {init.state.consts}
X
XITERATE {call.type$}
X
XFUNCTION {end.bib}
X{ newline$
X  "\end{thebibliography}" write$ newline$
X}
X
XEXECUTE {end.bib}
SHAR_EOF
$TOUCH -am 0801230992 abstract.bst &&
chmod 0644 abstract.bst ||
echo "restore of abstract.bst failed"
set `wc -c abstract.bst`;Wc_c=$1
if test "$Wc_c" != "23838"; then
	echo original size 23838, current size $Wc_c
fi
fi
# ============= aux2bib ==============
if test X"$1" != X"-c" -a -f 'aux2bib'; then
	case $wish in
	A*|a*) echo x - overwriting 'aux2bib';;
	*) echo "? - overwrite 'aux2bib' -- [No], [Y]es, [A]ll, [Q]uit? "
		read wish;;
	esac
	case $wish in
	Q*|q*) echo aborted; exit 86;;
	A*|a*|Y*|y*) x=Y;;
	*) x=N;;
	esac
else
	x=Y
fi
if test $x != Y; then
	echo x - skipping 'aux2bib'
else
echo "x - extracting aux2bib (Text)"
sed 's/^X//' << 'SHAR_EOF' > aux2bib &&
X#!/usr/local/bin/perl -s
X#
X# take a latex AUX file and change the bibstyle to subset or subset-nocomment
X# depending on if the -c flag was given (-c means use comments), then rename
X# the modified file to references.aux, run bibtex on it, rename the file
X# references.bbl to references.bib and delete references.{aux,blg}.  This
X# results in a BibTeX file which can be shipped with the latex source of the
X# paper.  The \bibliography{} command in the latex file will need to be changed
X# to use the newly generated bibliography.
X#
X# assumes subset.bst and subset-nocomment.bst are in the input path
X#
X# V. Khera	07-AUG-1992
X# khera@cs.duke.edu
X
X$tmpfile = "refs$$";
X$outfile = "references.bib";
X
X$SIG{'INT'} = 'handler';
X$SIG{'QUIT'} = 'handler';
X$SIG{'TERM'} = 'handler';
X$| = 1;				# make sure output is flushed after print.
X
Xsub handler {
X  local($sig) = @_;
X  print "Got a SIG$sig -- cleaning up\n";
X  &cleanup;
X  exit 1;
X}
X
Xsub cleanup {
X  unlink <$tmpfile.*>;
X}
X
X$bibstyle = defined($c) ? "subset" : "subset-nocomment";
X
Xdie "usage: $0 [-c] <auxfile>\n" unless $#ARGV == 0;
X
X$infile = shift;
X
X# canonicalize the name to end i .aux. assumes file is in current directory,
X# even though a path may have been specified.  tough noogies, i say!
X$infile =~ s#(.*/)?([^.]*).*#\2.aux#;
X
Xdie "No such file $infile\n" unless -f $infile;
X
Xopen(INF,$infile) || die "Cannot read $infile\n";
X@auxdata = <INF>;		# slurp the whole file in
Xclose(INF);
X
X# create a new AUX file with subset bibstyle specified.
X@result = grep(m/(\\citation|\\bibdata).*/ , @auxdata);
Xdie "No citations or data files specified in $infile\n" unless @result;
Xpush(@result,"\\bibstyle{$bibstyle}\n");
X
Xopen (OUTF,">$tmpfile.aux") || die "Cannot create temp file\n";
Xprint OUTF @result;
Xclose(OUTF);
X
Xprint "Running bibtex...\n";
X
X$result = system "bibtex $tmpfile";
Xdie "Error running bibtex\n" unless ($result >> 8) == 0;
Xrename ("$tmpfile.bbl", $outfile);
X
Xprint "Output is in $outfile\n";
X
X&cleanup;
SHAR_EOF
$TOUCH -am 0811124692 aux2bib &&
chmod 0755 aux2bib ||
echo "restore of aux2bib failed"
set `wc -c aux2bib`;Wc_c=$1
if test "$Wc_c" != "1968"; then
	echo original size 1968, current size $Wc_c
fi
fi
# ============= bibify ==============
if test X"$1" != X"-c" -a -f 'bibify'; then
	case $wish in
	A*|a*) echo x - overwriting 'bibify';;
	*) echo "? - overwrite 'bibify' -- [No], [Y]es, [A]ll, [Q]uit? "
		read wish;;
	esac
	case $wish in
	Q*|q*) echo aborted; exit 86;;
	A*|a*|Y*|y*) x=Y;;
	*) x=N;;
	esac
else
	x=Y
fi
if test $x != Y; then
	echo x - skipping 'bibify'
else
echo "x - extracting bibify (Text)"
sed 's/^X//' << 'SHAR_EOF' > bibify &&
X#!/bin/csh -f
X
Xif ($1 !~ *.aux) then
X    set input=$1.aux
X    set bbl = $1.bbl
Xelse
X    set input=$1
X    set bbl=$1:r.bbl
Xendif
X
Xset file=/tmp/bibify$$
Xonintr clean
X
Xcat $input > $file
X
Xset style=`sed -n 's/\\bibstyle{\(.*\)}/\1/p' $input`
X
Xswitch($style)
Xcase "alpha":
Xcase "/u/dfk/lib/abstract":
X cat $bbl | sed -n 's/bibitem\[\(.*\)\]{\(.*\)}/bibcite{\2}{\1}/p' >> $file
X breaksw
Xcase "plain":
Xcase "unsrt":
Xcase "abbrv":
X cat $bbl | sed -n 's/bibitem/bibcite/p'| awk '{print $1"{"NR"}"}' >> $file
X breaksw
Xdefault:
X echo unknown bibliography style, cannot bibify.
X goto clean
Xendsw
X
Xmv $file $input
X
Xclean:
X/bin/rm -f $file.* >& /dev/null
X
SHAR_EOF
$TOUCH -am 0517131290 bibify &&
chmod 0755 bibify ||
echo "restore of bibify failed"
set `wc -c bibify`;Wc_c=$1
if test "$Wc_c" != "644"; then
	echo original size 644, current size $Wc_c
fi
fi
# ============= bibkey ==============
if test X"$1" != X"-c" -a -f 'bibkey'; then
	case $wish in
	A*|a*) echo x - overwriting 'bibkey';;
	*) echo "? - overwrite 'bibkey' -- [No], [Y]es, [A]ll, [Q]uit? "
		read wish;;
	esac
	case $wish in
	Q*|q*) echo aborted; exit 86;;
	A*|a*|Y*|y*) x=Y;;
	*) x=N;;
	esac
else
	x=Y
fi
if test $x != Y; then
	echo x - skipping 'bibkey'
else
echo "x - extracting bibkey (Text)"
sed 's/^X//' << 'SHAR_EOF' > bibkey &&
X#!/bin/csh -f
X# 
X# bibkey - look for a word in the keyword field
X# in the references in a BiBTeX file. A restricted form of looktex, in
X# that bibkey only looks at "keyword" fields of the entries.
X#
X# David Kotz (dfk@cs.dartmouth.edu)
X#
X# usage: 
X#  bibkey keyword file...
X#
X# Warning: Any characters in keyword that have meanings in regexps
X# used by either sed or egrep must be escaped with a \ (the most 
X# likely occurrence might be \ itself: use \\). Case is ignored in 
X# the search.
X#
X# Multiple keywords may be specified with an egrep alternation format:
X# eg  bibkey 'jones|smith' foo.bib
X#
X# Actually, any egrep expression is allowed. 
X# Be sure to quote it properly. 
X#
X
Xset L=~/lib
X
Xif ($#argv < 2) then
X    echo usage: bibkey keyword 'file...'
X    exit 1
Xendif
X
Xset keyword=`echo "$1" | tr A-Z a-z`
Xshift
X
Xset script=/tmp/bibkey$$
Xonintr cleanup
X
X# Search for the keyword and get a script for extracting the
X# references:
X#  Cat the files
X#  Strip comment lines and comments on lines
X#  Translate to lower case (needs to precede sed and egrep)
X#  Extract the keyword entries, plus number for lines with @
X#  Search for the keyword
X#  Convert this output into a sed script
Xcat $* \
X    | sed -e 's/^%.*//' -e 's/\([^\\]\)%.*/\1/' \
X    | tr A-Z a-z \
X    | sed -n -f $L/bibkey.sed \
X    | egrep '^[0-9]*$|'"($keyword)" \
X    | awk -f $L/bibkey.awk > $script
X
X# Now have sed print out the correct entries:
Xcat $* | sed -n -f $script 
X
Xcleanup:
Xrm -f $script
SHAR_EOF
$TOUCH -am 0803160792 bibkey &&
chmod 0755 bibkey ||
echo "restore of bibkey failed"
set `wc -c bibkey`;Wc_c=$1
if test "$Wc_c" != "1469"; then
	echo original size 1469, current size $Wc_c
fi
fi
# ============= bibkey.awk ==============
if test X"$1" != X"-c" -a -f 'bibkey.awk'; then
	case $wish in
	A*|a*) echo x - overwriting 'bibkey.awk';;
	*) echo "? - overwrite 'bibkey.awk' -- [No], [Y]es, [A]ll, [Q]uit? "
		read wish;;
	esac
	case $wish in
	Q*|q*) echo aborted; exit 86;;
	A*|a*|Y*|y*) x=Y;;
	*) x=N;;
	esac
else
	x=Y
fi
if test $x != Y; then
	echo x - skipping 'bibkey.awk'
else
echo "x - extracting bibkey.awk (Text)"
sed 's/^X//' << 'SHAR_EOF' > bibkey.awk &&
X# bibkey.awk 
X#
X# Goes with bin/bibkey - look for a word in the keyword entry 
X#
X# David Kotz (dfk@cs.dartmouth.edu)
X#
X# On stdin, we get a list of line numbers of the beginning of entries
X# (in the concatenated bibtex input) and the text of lines from keyword
X# entries  that have the keyword in them.
X#
X# On stdout, we produce a sed script for printing entries that had a
X# match in them somewhere. This is a list of lines like "A,Bp" where A
X# and B are line numbers.
X
XBEGIN {found=0; last=1}
X
X{
X# test: is line a number?
X    if ($1+0 > 0) {
X	       if (found) {
X	              print last "," $1-1 "p";
X	              found=0
X	       }
X	       last=$1
X    } else {
X	   found = 1
X    }
X}
X
XEND {
X    if (found)
X        print last ",$p";
X}
SHAR_EOF
$TOUCH -am 0803155292 bibkey.awk &&
chmod 0644 bibkey.awk ||
echo "restore of bibkey.awk failed"
set `wc -c bibkey.awk`;Wc_c=$1
if test "$Wc_c" != "740"; then
	echo original size 740, current size $Wc_c
fi
fi
# ============= bibkey.sed ==============
if test X"$1" != X"-c" -a -f 'bibkey.sed'; then
	case $wish in
	A*|a*) echo x - overwriting 'bibkey.sed';;
	*) echo "? - overwrite 'bibkey.sed' -- [No], [Y]es, [A]ll, [Q]uit? "
		read wish;;
	esac
	case $wish in
	Q*|q*) echo aborted; exit 86;;
	A*|a*|Y*|y*) x=Y;;
	*) x=N;;
	esac
else
	x=Y
fi
if test $x != Y; then
	echo x - skipping 'bibkey.sed'
else
echo "x - extracting bibkey.sed (Text)"
sed 's/^X//' << 'SHAR_EOF' > bibkey.sed &&
X# bibkey.sed
X#
X# Goes with bin/bibkey - look for a word in the keyword entry 
X#
X# David Kotz (dfk@cs.dartmouth.edu)
X#
X# On stdin, we get a lowercased bibtex file with comments stripped.
X#
X# On stdout, we produce a list of line numbers that are the starting
X# line number of each reference, and the text of all "keyword"
X# entries on separate lines.
X
X# the idea is to get @ line numbers and all keywords
X# @ entry
X/^[ 	]*@.*/=
X# one-line keyword entry
Xs/[ 	]*keyword[ 	]*=[ 	]*"\(.*\)".*/\1/p
Xt 
X# start of multi-line keyword entry
Xs/[ 	]*keyword[ 	]*=[ 	]*"\(.*\)/\1/
Xt partial
Xb
X# Handle multi-line keyword entry: save this line, repeatedly add
X# lines until close quote forces output
X:partial
XN
Xs/\(.*\n.*\)".*/\1/
Xt done
Xb partial
X:done
Xs/\n/ /g
Xp
SHAR_EOF
$TOUCH -am 0803160892 bibkey.sed &&
chmod 0644 bibkey.sed ||
echo "restore of bibkey.sed failed"
set `wc -c bibkey.sed`;Wc_c=$1
if test "$Wc_c" != "751"; then
	echo original size 751, current size $Wc_c
fi
fi
# ============= cleantex ==============
if test X"$1" != X"-c" -a -f 'cleantex'; then
	case $wish in
	A*|a*) echo x - overwriting 'cleantex';;
	*) echo "? - overwrite 'cleantex' -- [No], [Y]es, [A]ll, [Q]uit? "
		read wish;;
	esac
	case $wish in
	Q*|q*) echo aborted; exit 86;;
	A*|a*|Y*|y*) x=Y;;
	*) x=N;;
	esac
else
	x=Y
fi
if test $x != Y; then
	echo x - skipping 'cleantex'
else
echo "x - extracting cleantex (Text)"
sed 's/^X//' << 'SHAR_EOF' > cleantex &&
X#!/bin/csh
X#
X# cleantex - clean up files related to Latex processing
X#
X# usage - cleantex [base]...
X# default is \*, ie, to remove all latex extraneous files. 
X# Otherwise, those beginning with 'base.' are removed.
X#
X# No csh -f flag so that we get safe-rm instead of rm, where appropriate.
X
Xset extensions="{dvi,aux,log,toc,lof,bbl,blg,lot}"
X
Xif ($#argv == 0) then
X	   rm -f *~ *.$extensions
Xelse
X	   foreach i ($*)
X	   	   rm -f $i.tex~ $i.$extensions
X	   end
Xendif
SHAR_EOF
$TOUCH -am 0205231692 cleantex &&
chmod 0755 cleantex ||
echo "restore of cleantex failed"
set `wc -c cleantex`;Wc_c=$1
if test "$Wc_c" != "468"; then
	echo original size 468, current size $Wc_c
fi
fi
# ============= looktex ==============
if test X"$1" != X"-c" -a -f 'looktex'; then
	case $wish in
	A*|a*) echo x - overwriting 'looktex';;
	*) echo "? - overwrite 'looktex' -- [No], [Y]es, [A]ll, [Q]uit? "
		read wish;;
	esac
	case $wish in
	Q*|q*) echo aborted; exit 86;;
	A*|a*|Y*|y*) x=Y;;
	*) x=N;;
	esac
else
	x=Y
fi
if test $x != Y; then
	echo x - skipping 'looktex'
else
echo "x - extracting looktex (Text)"
sed 's/^X//' << 'SHAR_EOF' > looktex &&
X#!/bin/csh -f
X# looktex - look for a keyword in the references in a BiBTeX file.
X#
X# David Kotz (dfk@cs.dartmouth.edu)
X#
X# usage: 
X#  looktex keyword file...
X#
X# Warning: Any characters in keyword that have meanings in regexps
X# used by either sed or egrep must be escaped with a \ (the most 
X# likely occurrence might be \ itself: use \\). Case is ignored in 
X# the search, as well as position in the reference.
X#
X# Multiple keywords may be specified with an egrep alternation format:
X# eg  looktex 'jones|smith' foo.bib
X#
X# Actually, any egrep expression is allowed. 
X# Be sure to quote it properly. 
X#
X
Xset L=~/lib
X
Xif ($#argv < 2) then
X    echo usage: looktex keyword 'file...'
X    exit 1
Xendif
X
Xset keyword=`echo "$1" | tr A-Z a-z`
Xshift
X
Xset script=/tmp/looktex$$
Xonintr cleanup
X
X# Search for the keyword and get a script for extracting the
X# references:
X#  Cat the files
X#  Strip comment lines and comments on lines
X#  Translate to lower case
X#  Search for the keyword and all @ lines
X#  Extract the line number only, plus 'entry' for lines with @
X#  Convert this output into a sed script
Xcat $* \
X    | sed -e 's/^%.*//' -e 's/\([^\\]\)%.*/\1/' \
X    | tr A-Z a-z \
X    | egrep -n "($keyword)"'|^[ ]*@' \
X    | sed -n -e "s/:[ ]*@.*$keyword.*/ entry key/p" -e 's/:[ ]*@.*/ entry/p' -e "s/:.*//p" \
X    | awk -f $L/looktex.awk > $script
X
X# Now have sed print out the correct entries:
Xcat $* | sed -n -f $script 
X
Xcleanup:
Xrm -f $script
SHAR_EOF
$TOUCH -am 0803155092 looktex &&
chmod 0755 looktex ||
echo "restore of looktex failed"
set `wc -c looktex`;Wc_c=$1
if test "$Wc_c" != "1443"; then
	echo original size 1443, current size $Wc_c
fi
fi
# ============= looktex.awk ==============
if test X"$1" != X"-c" -a -f 'looktex.awk'; then
	case $wish in
	A*|a*) echo x - overwriting 'looktex.awk';;
	*) echo "? - overwrite 'looktex.awk' -- [No], [Y]es, [A]ll, [Q]uit? "
		read wish;;
	esac
	case $wish in
	Q*|q*) echo aborted; exit 86;;
	A*|a*|Y*|y*) x=Y;;
	*) x=N;;
	esac
else
	x=Y
fi
if test $x != Y; then
	echo x - skipping 'looktex.awk'
else
echo "x - extracting looktex.awk (Text)"
sed 's/^X//' << 'SHAR_EOF' > looktex.awk &&
X# looktex.awk 
X#
X# Goes with bin/looktex - look for a keyword in the references in a BiBTeX file
X#
X# David Kotz (dfk@cs.dartmouth.edu)
X#
X# This takes a list of line numbers that had the keyword. Some of the
X# line numbers will be followed by "entry" or "entry key"; "entry"
X# means that the line number is the start of a new bibtex entry, not a
X# line containing the keyword. "entry key" means that it is a line
X# starting an entry AND containing the keyword.
X#
X# On stdout, we produce a sed script for printing entries that had a
X# match in them somewhere. This is a list of lines like "A,Bp" where A
X# and B are line numbers.
X
XBEGIN {found=0; last=1}
X
X# defines the start of a new entry WITH a keyword match
XNF==3 {
X    if (found) { print last "," $1-1 "p" }
X    found=1
X    last=$1 
X}
X
X# defines the start of a new entry
XNF==2 {
X    if (found) { print last "," $1-1 "p" }
X    found=0
X    last=$1
X}
X
X# marks a place where the keyword was found
XNF==1 {found=1}
X
XEND {
X    if (found)
X        print last ",$p";
X}
SHAR_EOF
$TOUCH -am 0803154292 looktex.awk &&
chmod 0644 looktex.awk ||
echo "restore of looktex.awk failed"
set `wc -c looktex.awk`;Wc_c=$1
if test "$Wc_c" != "1012"; then
	echo original size 1012, current size $Wc_c
fi
fi
# ============= makebib ==============
if test X"$1" != X"-c" -a -f 'makebib'; then
	case $wish in
	A*|a*) echo x - overwriting 'makebib';;
	*) echo "? - overwrite 'makebib' -- [No], [Y]es, [A]ll, [Q]uit? "
		read wish;;
	esac
	case $wish in
	Q*|q*) echo aborted; exit 86;;
	A*|a*|Y*|y*) x=Y;;
	*) x=N;;
	esac
else
	x=Y
fi
if test $x != Y; then
	echo x - skipping 'makebib'
else
echo "x - extracting makebib (Text)"
sed 's/^X//' << 'SHAR_EOF' > makebib &&
X#!/bin/csh -f
X#
X# makebib - make a bib file that has the given citations
X#
X# usage: 
X#    makebib [-n | -d] file.bib... [citekey]...
X# Where -n means "no comment", ie, don't include any "comment" fields.
X# And -d means "dfk", ie, add attribution to dfk to all comment fields.
X# Output is to subset.bib. If citekey is not given, then all refs in
X# the bibfile are included.
X
Xonintr cleanup
X
Xif ($#argv < 1) then
X	   echo 'usage: makebib [-n|-d] file.bib... [citekey]...'
X	   exit 1
Xendif
X
Xif ("$1" == "-n") then
X	   set bst=subset-nocomment
X	   shift
Xelse
X	   if ("$1" == "-d") then
X	   	   set bst=subset-dfk
X	   	   shift
X	   else
X	   	   set bst=subset
X	   endif
Xendif
X
Xif ($#argv < 1) then
X	   echo 'usage: makebib [-n|-d] file.bib... [citekey]...'
X	   exit 1
Xendif
X
Xset files = $1:r
Xshift
X
Xwhile ($1:e == "bib")
X	   set files=($files,$1:r)
X	   shift
Xend
X
Xecho creating subset.tex for $files
X
Xcat > subset.tex <<EOF
X\documentstyle{article}
X\begin{document}
XEOF
X
Xif ($#argv > 0) then
X	   foreach f ($*)
X	      echo "\nocite{$f}" >> subset.tex
X	   end
Xelse
X	   echo "\nocite{*}" >> subset.tex
Xendif
X
Xcat >> subset.tex <<EOF
X\bibliographystyle{$bst}
X\bibliography{$files}
X\end{document}
XEOF
X
Xrm -f subset.{aux,log,dvi,bbl,blg}
X
Xecho latex subset.tex
Xlatex subset.tex
Xecho bibtex subset
Xbibtex subset
X
Xsed > subset.bib \
X   -e 's/\\ie/i.e./g' \
X   -e 's/\\eg/e.g./g' \
X   -e 's/\\etc/{\\em etc.}/g' \
X   -e 's/\\vs/{\\em vs.}/g' \
X   -e 's/\\usec/{{$\\mu$}sec}/g' \
X  subset.bbl
X
Xecho ""
Xecho output is in subset.bib
X
Xcleanup:
Xrm -f subset.{tex,aux,log,dvi,bbl,blg}
X
SHAR_EOF
$TOUCH -am 0827104492 makebib &&
chmod 0755 makebib ||
echo "restore of makebib failed"
set `wc -c makebib`;Wc_c=$1
if test "$Wc_c" != "1566"; then
	echo original size 1566, current size $Wc_c
fi
fi
# ============= printbib ==============
if test X"$1" != X"-c" -a -f 'printbib'; then
	case $wish in
	A*|a*) echo x - overwriting 'printbib';;
	*) echo "? - overwrite 'printbib' -- [No], [Y]es, [A]ll, [Q]uit? "
		read wish;;
	esac
	case $wish in
	Q*|q*) echo aborted; exit 86;;
	A*|a*|Y*|y*) x=Y;;
	*) x=N;;
	esac
else
	x=Y
fi
if test $x != Y; then
	echo x - skipping 'printbib'
else
echo "x - extracting printbib (Text)"
sed 's/^X//' << 'SHAR_EOF' > printbib &&
X#!/bin/csh -f
X#
X# printbib - print a full bibtex bib file out
X#
X# David Kotz
X#
X# usage:
X#  printbib bibfile...
X#
X# Then send the dvi file 'abstract.dvi' to the printer
X# (usage varies; try lpr -d abstract.dvi)
X
Xif ($#argv == 0) then
X	   echo usage: printbib bibfile...
X	   exit 1
Xendif
X
Xif ($1:e == "bib") then
X	   set files=($1:r)
Xelse
X	   set files=($1)
Xendif
X
Xshift
Xforeach f ($*)
X	   if ($f:e == "bib") then
X	   	   set files="$files,$f:r"
X	   else
X	   	   set files="$files,$f"
X	   endif
Xend
X
Xecho creating abstract.tex for $files
X
Xcat > abstract.tex <<EOF
X\documentstyle[11pt]{article}
X\sloppy
X\setlength{\textwidth}{6.5in}
X\setlength{\textheight}{9in}
X\setlength{\topmargin}{-0.5in}
X\setlength{\oddsidemargin}{0pt}
X\setlength{\evensidemargin}{0pt}
X\newcommand{\eg}{e.g.}		% e.g.
X\newcommand{\ie}{i.e.}		% i.e.
X\newcommand{\etc}{etc.}		% etc.
X\newcommand{\vs}{{\em vs.}}		% vs.
X\begin{document}
X\begin{center} \Large Bibliography files \large \\\\
XEOF
Xecho $files >> abstract.tex
Xcat >> abstract.tex <<EOF
X\\\\ \today
X\end{center}
X\nocite{*}
X\bibliographystyle{abstract}
XEOF
X
Xecho "\bibliography{$files}" >> abstract.tex
Xecho '\end{document}' >> abstract.tex
X
Xrm -f abstract.{aux,log,dvi,bbl,blg}
X
Xset echo 
Xlatex abstract.tex
Xbibtex abstract
Xlatex abstract.tex
Xlatex abstract.tex
SHAR_EOF
$TOUCH -am 0113153792 printbib &&
chmod 0755 printbib ||
echo "restore of printbib failed"
set `wc -c printbib`;Wc_c=$1
if test "$Wc_c" != "1287"; then
	echo original size 1287, current size $Wc_c
fi
fi
# ============= subset-dfk.bst ==============
if test X"$1" != X"-c" -a -f 'subset-dfk.bst'; then
	case $wish in
	A*|a*) echo x - overwriting 'subset-dfk.bst';;
	*) echo "? - overwrite 'subset-dfk.bst' -- [No], [Y]es, [A]ll, [Q]uit? "
		read wish;;
	esac
	case $wish in
	Q*|q*) echo aborted; exit 86;;
	A*|a*|Y*|y*) x=Y;;
	*) x=N;;
	esac
else
	x=Y
fi
if test $x != Y; then
	echo x - skipping 'subset-dfk.bst'
else
echo "x - extracting subset-dfk.bst (Text)"
sed 's/^X//' << 'SHAR_EOF' > subset-dfk.bst &&
X% BibTeX bibliography style `subset'
X% by David Kotz dfk@cs.dartmouth.edu
X% August 1992
X%   This takes an aux file and produces an unusual .bbl file,
X% that is actually in .bib format -- but it has all of the references,
X% and strings expanded. Thus, it becomes a complete, portable .bib
X% file. Doesn't handle crossrefs?
X%  modified from
X   % BibTeX bibliography style `abstract' 
X   % by David Kotz dfk@cs.duke.edu
X   % March 1989
X   %  modified from
X   %  BibTeX standard bibliography style `alpha'
X	 % version 0.99a for BibTeX versions 0.99a or later, LaTeX version 2.09.
X      % Copyright (C) 1985, all rights reserved.
X      % Copying of this file is authorized only if either
X      % (1) you make absolutely no changes to your copy, including name, or
X      % (2) if you do make changes, you name it something other than
X      % btxbst.doc, plain.bst, unsrt.bst, alpha.bst, and abbrv.bst.
X      % This restriction helps ensure that all standard styles are identical.
X      % The file btxbst.doc has the documentation for this style.
X
X% DFK added abstract, comment, keyword to standard set
XENTRY
X  { abstract
X    address
X    author
X    booktitle
X    chapter
X    comment
X    edition
X    editor
X    howpublished
X    institution
X    journal
X    key
X    keyword
X    month
X    note
X    number
X    organization
X    pages
X    publisher
X    school
X    series
X    title
X    type
X    volume
X    year
X  }
X  {}
X  { label extra.label sort.label }
X
XSTRINGS { s t }
X
X% output a field; the top is the text, the next to top is the name of
X% the field, and we know that the text is nonnull.
X% we start by finishing the previous line
XFUNCTION {output.field}
X{
X  ", " write$	 	    % write comma and newline
X  newline$
X  "  " write$	 	    % and a respectable indentation
X
X  swap$ 		 	    		  % now field name is on top
X  " = {" * 	 	    		  % put = {
X  swap$ *		 	    		  % now text is back on top; concatenate
X  "}" *		  	    		  % put }
X  write$
X}
X
X% output if top not empty; below the top is the name of the field
XFUNCTION {output}
X{ duplicate$ empty$
X    { pop$ pop$ }
X    'output.field
X  if$
X}
X
X% special for "comment"
X% output if top not empty; below the top is the name of the field
XFUNCTION {output.comment}
X{ duplicate$ empty$
X    { pop$ pop$ }
X    { " [David.Kotz@Dartmouth.edu]" * output.field }
X  if$
X}
X
X% Takes name of type as argument, and prints @ line
X% then it prints each field 
XFUNCTION {output.bibitem}
X{
X% write the @ line
X  "@" swap$ * write$    		  % @type
X  "{" cite$ * write$  		  % {citekey
X
X% The fields, in what seems to be a good order
X  "key" key output
X  "author" author output
X  "title" title output
X
X  "journal" journal output
X  "booktitle" booktitle output
X
X  "chapter" chapter output
X  "edition" edition output
X  "editor" editor output
X
X  "year" year output
X  "month" month output
X  "series" series output
X  "volume" volume output
X  "number" number output
X  "type" type output
X
X  "pages" pages output
X
X  "institution" institution output
X  "school" school output
X  "organization" organization output
X  "publisher" publisher output
X  "howpublished" howpublished output
X  "address" address output
X
X  "note" note output
X
X  "keyword" keyword output
X  "abstract" abstract output
X  "comment" comment output.comment
X 
X% finish entry
X  newline$
X  "}" write$ 
X  newline$
X  newline$
X}
X
XFUNCTION {article}{ "Article" output.bibitem }
X
XFUNCTION {book}{ "Book" output.bibitem }
X
XFUNCTION {booklet}{ "Booklet" output.bibitem }
X
XFUNCTION {inbook}{ "InBook" output.bibitem }
X
XFUNCTION {incollection}{ "InCollection" output.bibitem }
X
XFUNCTION {inproceedings}{ "InProceedings" output.bibitem }
X
XFUNCTION {conference}{ "Conference" output.bibitem }
X
XFUNCTION {manual}{ "Manual" output.bibitem }
X
XFUNCTION {mastersthesis}{ "MastersThesis" output.bibitem }
X
XFUNCTION {misc}{ "Misc" output.bibitem }
X
XFUNCTION {phdthesis}{ "PhdThesis" output.bibitem }
X
XFUNCTION {proceedings}{ "Proceedings" output.bibitem }
X
XFUNCTION {techreport}{ "TechReport" output.bibitem }
X
XFUNCTION {unpublished}{ "Unpublished" output.bibitem }
X
XFUNCTION {default.type} { misc }
X
XMACRO {jan} {"January"}
X
XMACRO {feb} {"February"}
X
XMACRO {mar} {"March"}
X
XMACRO {apr} {"April"}
X
XMACRO {may} {"May"}
X
XMACRO {jun} {"June"}
X
XMACRO {jul} {"July"}
X
XMACRO {aug} {"August"}
X
XMACRO {sep} {"September"}
X
XMACRO {oct} {"October"}
X
XMACRO {nov} {"November"}
X
XMACRO {dec} {"December"}
X
XMACRO {acmcs} {"ACM Computing Surveys"}
X
XMACRO {acta} {"Acta Informatica"}
X
XMACRO {cacm} {"Communications of the ACM"}
X
XMACRO {ibmjrd} {"IBM Journal of Research and Development"}
X
XMACRO {ibmsj} {"IBM Systems Journal"}
X
XMACRO {ieeese} {"IEEE Transactions on Software Engineering"}
X
XMACRO {ieeetc} {"IEEE Transactions on Computers"}
X
XMACRO {ieeetcad}
X {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"}
X
XMACRO {ipl} {"Information Processing Letters"}
X
XMACRO {jacm} {"Journal of the ACM"}
X
XMACRO {jcss} {"Journal of Computer and System Sciences"}
X
XMACRO {scp} {"Science of Computer Programming"}
X
XMACRO {sicomp} {"SIAM Journal on Computing"}
X
XMACRO {tocs} {"ACM Transactions on Computer Systems"}
X
XMACRO {tods} {"ACM Transactions on Database Systems"}
X
XMACRO {tog} {"ACM Transactions on Graphics"}
X
XMACRO {toms} {"ACM Transactions on Mathematical Software"}
X
XMACRO {toois} {"ACM Transactions on Office Information Systems"}
X
XMACRO {toplas} {"ACM Transactions on Programming Languages and Systems"}
X
XMACRO {tcs} {"Theoretical Computer Science"}
X
XREAD
X
X% DFK use cite$ for sort key
XFUNCTION {presort}
X{
X  cite$
X  #1 entry.max$ substring$
X  'sort.key$ :=
X}
X
XITERATE {presort}
X
XSORT
X
XFUNCTION {begin.bib}
X{
X  "% BibTeX bibliography file" write$ 
X  newline$ 
X  newline$
X}
X
XEXECUTE {begin.bib}
X
XITERATE {call.type$}
SHAR_EOF
$TOUCH -am 0827105092 subset-dfk.bst &&
chmod 0644 subset-dfk.bst ||
echo "restore of subset-dfk.bst failed"
set `wc -c subset-dfk.bst`;Wc_c=$1
if test "$Wc_c" != "5667"; then
	echo original size 5667, current size $Wc_c
fi
fi
# ============= subset-nocomment.bst ==============
if test X"$1" != X"-c" -a -f 'subset-nocomment.bst'; then
	case $wish in
	A*|a*) echo x - overwriting 'subset-nocomment.bst';;
	*) echo "? - overwrite 'subset-nocomment.bst' -- [No], [Y]es, [A]ll, [Q]uit? "
		read wish;;
	esac
	case $wish in
	Q*|q*) echo aborted; exit 86;;
	A*|a*|Y*|y*) x=Y;;
	*) x=N;;
	esac
else
	x=Y
fi
if test $x != Y; then
	echo x - skipping 'subset-nocomment.bst'
else
echo "x - extracting subset-nocomment.bst (Text)"
sed 's/^X//' << 'SHAR_EOF' > subset-nocomment.bst &&
X% BibTeX bibliography style `subset'
X% by David Kotz dfk@cs.dartmouth.edu
X% August 1992
X%   This takes an aux file and produces an unusual .bbl file,
X% that is actually in .bib format -- but it has all of the references,
X% and strings expanded. Thus, it becomes a complete, portable .bib
X% file. Doesn't handle crossrefs?
X%  modified from
X   % BibTeX bibliography style `abstract' 
X   % by David Kotz dfk@cs.duke.edu
X   % March 1989
X   %  modified from
X   %  BibTeX standard bibliography style `alpha'
X	 % version 0.99a for BibTeX versions 0.99a or later, LaTeX version 2.09.
X      % Copyright (C) 1985, all rights reserved.
X      % Copying of this file is authorized only if either
X      % (1) you make absolutely no changes to your copy, including name, or
X      % (2) if you do make changes, you name it something other than
X      % btxbst.doc, plain.bst, unsrt.bst, alpha.bst, and abbrv.bst.
X      % This restriction helps ensure that all standard styles are identical.
X      % The file btxbst.doc has the documentation for this style.
X
X% DFK added abstract, comment, keyword to standard set
XENTRY
X  { abstract
X    address
X    author
X    booktitle
X    chapter
X    comment
X    edition
X    editor
X    howpublished
X    institution
X    journal
X    key
X    keyword
X    month
X    note
X    number
X    organization
X    pages
X    publisher
X    school
X    series
X    title
X    type
X    volume
X    year
X  }
X  {}
X  { label extra.label sort.label }
X
XSTRINGS { s t }
X
X% output a field; the top is the text, the next to top is the name of
X% the field, and we know that the text is nonnull.
X% we start by finishing the previous line
XFUNCTION {output.field}
X{
X  ", " write$	 	    % write comma and newline
X  newline$
X  "  " write$	 	    % and a respectable indentation
X
X  swap$ 		 	    		  % now field name is on top
X  " = {" * 	 	    		  % put = {
X  swap$ *		 	    		  % now text is back on top; concatenate
X  "}" *		  	    		  % put }
X  write$
X}
X
X% output if top not empty; below the top is the name of the field
XFUNCTION {output}
X{ duplicate$ empty$
X    { pop$ pop$ }
X    'output.field
X  if$
X}
X
X% Takes name of type as argument, and prints @ line
X% then it prints each field 
XFUNCTION {output.bibitem}
X{
X% write the @ line
X  "@" swap$ * write$    		  % @type
X  "{" cite$ * write$  		  % {citekey
X
X% The fields, in what seems to be a good order
X  "key" key output
X  "author" author output
X  "title" title output
X
X  "journal" journal output
X  "booktitle" booktitle output
X
X  "chapter" chapter output
X  "edition" edition output
X  "editor" editor output
X
X  "year" year output
X  "month" month output
X  "series" series output
X  "volume" volume output
X  "number" number output
X  "type" type output
X
X  "pages" pages output
X
X  "institution" institution output
X  "school" school output
X  "organization" organization output
X  "publisher" publisher output
X  "howpublished" howpublished output
X  "address" address output
X
X  "note" note output
X
X  "keyword" keyword output
X  "abstract" abstract output
X% leave out the comments here
X%  "comment" comment output
X
X% finish entry
X  newline$
X  "}" write$ 
X  newline$
X  newline$
X}
X
XFUNCTION {article}{ "Article" output.bibitem }
X
XFUNCTION {book}{ "Book" output.bibitem }
X
XFUNCTION {booklet}{ "Booklet" output.bibitem }
X
XFUNCTION {inbook}{ "InBook" output.bibitem }
X
XFUNCTION {incollection}{ "InCollection" output.bibitem }
X
XFUNCTION {inproceedings}{ "InProceedings" output.bibitem }
X
XFUNCTION {conference}{ "Conference" output.bibitem }
X
XFUNCTION {manual}{ "Manual" output.bibitem }
X
XFUNCTION {mastersthesis}{ "MastersThesis" output.bibitem }
X
XFUNCTION {misc}{ "Misc" output.bibitem }
X
XFUNCTION {phdthesis}{ "PhdThesis" output.bibitem }
X
XFUNCTION {proceedings}{ "Proceedings" output.bibitem }
X
XFUNCTION {techreport}{ "TechReport" output.bibitem }
X
XFUNCTION {unpublished}{ "Unpublished" output.bibitem }
X
XFUNCTION {default.type} { misc }
X
XMACRO {jan} {"January"}
X
XMACRO {feb} {"February"}
X
XMACRO {mar} {"March"}
X
XMACRO {apr} {"April"}
X
XMACRO {may} {"May"}
X
XMACRO {jun} {"June"}
X
XMACRO {jul} {"July"}
X
XMACRO {aug} {"August"}
X
XMACRO {sep} {"September"}
X
XMACRO {oct} {"October"}
X
XMACRO {nov} {"November"}
X
XMACRO {dec} {"December"}
X
XMACRO {acmcs} {"ACM Computing Surveys"}
X
XMACRO {acta} {"Acta Informatica"}
X
XMACRO {cacm} {"Communications of the ACM"}
X
XMACRO {ibmjrd} {"IBM Journal of Research and Development"}
X
XMACRO {ibmsj} {"IBM Systems Journal"}
X
XMACRO {ieeese} {"IEEE Transactions on Software Engineering"}
X
XMACRO {ieeetc} {"IEEE Transactions on Computers"}
X
XMACRO {ieeetcad}
X {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"}
X
XMACRO {ipl} {"Information Processing Letters"}
X
XMACRO {jacm} {"Journal of the ACM"}
X
XMACRO {jcss} {"Journal of Computer and System Sciences"}
X
XMACRO {scp} {"Science of Computer Programming"}
X
XMACRO {sicomp} {"SIAM Journal on Computing"}
X
XMACRO {tocs} {"ACM Transactions on Computer Systems"}
X
XMACRO {tods} {"ACM Transactions on Database Systems"}
X
XMACRO {tog} {"ACM Transactions on Graphics"}
X
XMACRO {toms} {"ACM Transactions on Mathematical Software"}
X
XMACRO {toois} {"ACM Transactions on Office Information Systems"}
X
XMACRO {toplas} {"ACM Transactions on Programming Languages and Systems"}
X
XMACRO {tcs} {"Theoretical Computer Science"}
X
XREAD
X
X% DFK use cite$ for sort key
XFUNCTION {presort}
X{
X  cite$
X  #1 entry.max$ substring$
X  'sort.key$ :=
X}
X
XITERATE {presort}
X
XSORT
X
XFUNCTION {begin.bib}
X{
X  "% BibTeX bibliography file" write$ 
X  newline$ 
X  newline$
X}
X
XEXECUTE {begin.bib}
X
XITERATE {call.type$}
SHAR_EOF
$TOUCH -am 0806141092 subset-nocomment.bst &&
chmod 0644 subset-nocomment.bst ||
echo "restore of subset-nocomment.bst failed"
set `wc -c subset-nocomment.bst`;Wc_c=$1
if test "$Wc_c" != "5473"; then
	echo original size 5473, current size $Wc_c
fi
fi
# ============= subset.bst ==============
if test X"$1" != X"-c" -a -f 'subset.bst'; then
	case $wish in
	A*|a*) echo x - overwriting 'subset.bst';;
	*) echo "? - overwrite 'subset.bst' -- [No], [Y]es, [A]ll, [Q]uit? "
		read wish;;
	esac
	case $wish in
	Q*|q*) echo aborted; exit 86;;
	A*|a*|Y*|y*) x=Y;;
	*) x=N;;
	esac
else
	x=Y
fi
if test $x != Y; then
	echo x - skipping 'subset.bst'
else
echo "x - extracting subset.bst (Text)"
sed 's/^X//' << 'SHAR_EOF' > subset.bst &&
X% BibTeX bibliography style `subset'
X% by David Kotz dfk@cs.dartmouth.edu
X% August 1992
X%   This takes an aux file and produces an unusual .bbl file,
X% that is actually in .bib format -- but it has all of the references,
X% and strings expanded. Thus, it becomes a complete, portable .bib
X% file. Doesn't handle crossrefs?
X%  modified from
X   % BibTeX bibliography style `abstract' 
X   % by David Kotz dfk@cs.duke.edu
X   % March 1989
X   %  modified from
X   %  BibTeX standard bibliography style `alpha'
X	 % version 0.99a for BibTeX versions 0.99a or later, LaTeX version 2.09.
X      % Copyright (C) 1985, all rights reserved.
X      % Copying of this file is authorized only if either
X      % (1) you make absolutely no changes to your copy, including name, or
X      % (2) if you do make changes, you name it something other than
X      % btxbst.doc, plain.bst, unsrt.bst, alpha.bst, and abbrv.bst.
X      % This restriction helps ensure that all standard styles are identical.
X      % The file btxbst.doc has the documentation for this style.
X
X% DFK added abstract, comment, keyword to standard set
XENTRY
X  { abstract
X    address
X    author
X    booktitle
X    chapter
X    comment
X    edition
X    editor
X    howpublished
X    institution
X    journal
X    key
X    keyword
X    month
X    note
X    number
X    organization
X    pages
X    publisher
X    school
X    series
X    title
X    type
X    volume
X    year
X  }
X  {}
X  { label extra.label sort.label }
X
XSTRINGS { s t }
X
X% output a field; the top is the text, the next to top is the name of
X% the field, and we know that the text is nonnull.
X% we start by finishing the previous line
XFUNCTION {output.field}
X{
X  ", " write$	 	    % write comma and newline
X  newline$
X  "  " write$	 	    % and a respectable indentation
X
X  swap$ 		 	    		  % now field name is on top
X  " = {" * 	 	    		  % put = {
X  swap$ *		 	    		  % now text is back on top; concatenate
X  "}" *		  	    		  % put }
X  write$
X}
X
X% output if top not empty; below the top is the name of the field
XFUNCTION {output}
X{ duplicate$ empty$
X    { pop$ pop$ }
X    'output.field
X  if$
X}
X
X% Takes name of type as argument, and prints @ line
X% then it prints each field 
XFUNCTION {output.bibitem}
X{
X% write the @ line
X  "@" swap$ * write$    		  % @type
X  "{" cite$ * write$  		  % {citekey
X
X% The fields, in what seems to be a good order
X  "key" key output
X  "author" author output
X  "title" title output
X
X  "journal" journal output
X  "booktitle" booktitle output
X
X  "chapter" chapter output
X  "edition" edition output
X  "editor" editor output
X
X  "year" year output
X  "month" month output
X  "series" series output
X  "volume" volume output
X  "number" number output
X  "type" type output
X
X  "pages" pages output
X
X  "institution" institution output
X  "school" school output
X  "organization" organization output
X  "publisher" publisher output
X  "howpublished" howpublished output
X  "address" address output
X
X  "note" note output
X
X  "keyword" keyword output
X  "abstract" abstract output
X  "comment" comment output
X
X% finish entry
X  newline$
X  "}" write$ 
X  newline$
X  newline$
X}
X
XFUNCTION {article}{ "Article" output.bibitem }
X
XFUNCTION {book}{ "Book" output.bibitem }
X
XFUNCTION {booklet}{ "Booklet" output.bibitem }
X
XFUNCTION {inbook}{ "InBook" output.bibitem }
X
XFUNCTION {incollection}{ "InCollection" output.bibitem }
X
XFUNCTION {inproceedings}{ "InProceedings" output.bibitem }
X
XFUNCTION {conference}{ "Conference" output.bibitem }
X
XFUNCTION {manual}{ "Manual" output.bibitem }
X
XFUNCTION {mastersthesis}{ "MastersThesis" output.bibitem }
X
XFUNCTION {misc}{ "Misc" output.bibitem }
X
XFUNCTION {phdthesis}{ "PhdThesis" output.bibitem }
X
XFUNCTION {proceedings}{ "Proceedings" output.bibitem }
X
XFUNCTION {techreport}{ "TechReport" output.bibitem }
X
XFUNCTION {unpublished}{ "Unpublished" output.bibitem }
X
XFUNCTION {default.type} { misc }
X
XMACRO {jan} {"January"}
X
XMACRO {feb} {"February"}
X
XMACRO {mar} {"March"}
X
XMACRO {apr} {"April"}
X
XMACRO {may} {"May"}
X
XMACRO {jun} {"June"}
X
XMACRO {jul} {"July"}
X
XMACRO {aug} {"August"}
X
XMACRO {sep} {"September"}
X
XMACRO {oct} {"October"}
X
XMACRO {nov} {"November"}
X
XMACRO {dec} {"December"}
X
XMACRO {acmcs} {"ACM Computing Surveys"}
X
XMACRO {acta} {"Acta Informatica"}
X
XMACRO {cacm} {"Communications of the ACM"}
X
XMACRO {ibmjrd} {"IBM Journal of Research and Development"}
X
XMACRO {ibmsj} {"IBM Systems Journal"}
X
XMACRO {ieeese} {"IEEE Transactions on Software Engineering"}
X
XMACRO {ieeetc} {"IEEE Transactions on Computers"}
X
XMACRO {ieeetcad}
X {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"}
X
XMACRO {ipl} {"Information Processing Letters"}
X
XMACRO {jacm} {"Journal of the ACM"}
X
XMACRO {jcss} {"Journal of Computer and System Sciences"}
X
XMACRO {scp} {"Science of Computer Programming"}
X
XMACRO {sicomp} {"SIAM Journal on Computing"}
X
XMACRO {tocs} {"ACM Transactions on Computer Systems"}
X
XMACRO {tods} {"ACM Transactions on Database Systems"}
X
XMACRO {tog} {"ACM Transactions on Graphics"}
X
XMACRO {toms} {"ACM Transactions on Mathematical Software"}
X
XMACRO {toois} {"ACM Transactions on Office Information Systems"}
X
XMACRO {toplas} {"ACM Transactions on Programming Languages and Systems"}
X
XMACRO {tcs} {"Theoretical Computer Science"}
X
XREAD
X
X% DFK use cite$ for sort key
XFUNCTION {presort}
X{
X  cite$
X  #1 entry.max$ substring$
X  'sort.key$ :=
X}
X
XITERATE {presort}
X
XSORT
X
XFUNCTION {begin.bib}
X{
X  "% BibTeX bibliography file" write$ 
X  newline$ 
X  newline$
X}
X
XEXECUTE {begin.bib}
X
XITERATE {call.type$}
SHAR_EOF
$TOUCH -am 0806140392 subset.bst &&
chmod 0644 subset.bst ||
echo "restore of subset.bst failed"
set `wc -c subset.bst`;Wc_c=$1
if test "$Wc_c" != "5442"; then
	echo original size 5442, current size $Wc_c
fi
fi
exit 0
-- 
-----------------
Mathematics and Computer Science
Dartmouth College, 6188 Bradley Hall, Hanover NH 03755-3551
email: David.Kotz@Dartmouth.edu    or   dfk@cs.dartmouth.edu
Newsgroups: comp.text.tex