home *** CD-ROM | disk | FTP | other *** search
- From decwrl!purdue!mailrus!uunet!allbery Tue Dec 5 07:52:41 PST 1989
- Article 1212 of comp.sources.misc:
- Path: decwrl!purdue!mailrus!uunet!allbery
- From: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
- Newsgroups: comp.sources.misc
- Subject: v09i046: bibtools: tools for BibTeX
- Message-ID: <73343@uunet.UU.NET>
- Date: 5 Dec 89 03:13:43 GMT
- Sender: allbery@uunet.UU.NET
- Reply-To: <kannan@osc.edu>
- Lines: 7226
- Approved: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
-
- Posting-number: Volume 9, Issue 46
- Submitted-by: kannan@osc.edu (Kannan Varadhan)
- Archive-name: bibtools
-
- I have written out what I think are fairly decent and comprehensive set
- of tools for manipulating BibTeX style bibliographies that I would like
- to have distributed via 'comp.sources.misc'. With this intent in mind,
- I am sending you this shar file.
-
- Briefly, the tools that I have are...
-
- bibc - This is a tool for creating and appending bibliography
- records to a file. This program works by prompting the
- user for the required fields, and then writes
- out/appends the record in the correct format.
-
- bibv - This tool takes one or more bib files, and produces a
- sample file, called bibtex.tex, and a dvi version of
- the same, that contain an entry corresponding to every
- record in the files. This uses bibtex to flag
- duplicate entries, hence, the name BIB-Verifier.
-
- shbib - This is used to show complete entries matching
- a given regular expression. The syntax is somewhat
- similar to egrep.
-
- rmbib - This removes entries matching the given regular
- expression from the specified files. It is useful, in
- that, the delete records are written to stdout, so one
- can shuffle records around various bib-files.
-
- You will also find, a library of tools that I designed, for breaking up
- entries in set of specified bibliography files, and having each entry
- processed by a routine of the user's choice. Notes on these can be found
- in README.lib_bib.
-
- The manpages have more detailed information.
-
- Installation requires one to have Henry Spencer's regular expression
- package, and Flex.
-
- #--------------------------------------------------------------------------
- # to unpack the routine(s) in this package, remove everything
- # above the dotted line and say, `sh filename'
- # If any of the routines already exists, say, `sh -o filename'
- # Makefile README README.lib_bib TODO alpha.lex bibc.c bibc.h bibcent.c
- # bibcent.h bibl.l bibtools.man bibv.c bibv.h config.h foo.bib
- # gen_lex_file header includes.h inits.c lex.yy.c lexstrings.lex
- # lib_bib.c misc/ omega.lex pyr.regexp.a specl.bst strings.h sun.regexp.a
- # templates.c typescript misc/Changes misc/README misc/bibv.sh
- # misc/gets.c
- if [ ! -d . ] ; then
- echo -n Directory . not found. Creating....
- mkdir .
- if [ ! -d . ] ; then
- echo ...failed
- echo unable to create directory .. Please create the directory and try again
- exit
- fi
- echo ...done
- fi
- echo -n "Makefile..." 1>&2
- if test -f Makefile
- then
- case $# in
- 0)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- case $1 in
- -o) ;;
- *)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- fi
- sed 's/^X//' << 'EOFile Makefile' > Makefile
- X.SUFFIXES: .out .o .c .l .lex
- X
- X# The ARCH defines the type of architecture we are using to install
- X# these tools. This is essentially only to figure out the final BINDEST
- X# INCDIR defines the location of the regexp includes.
- X# RELIB defines the location of the regular expression library
- X# MANTYPE defines the location of the man pages, as manl/bibtools.l
- X# TEXLIB is the location to put specl.bst, the bibtex macro file
- XARCH=pyr
- XCFLAGS=-O
- XINCDIR=-I../Regexp
- XRELIB=$(ARCH).regexp.a
- XBINDEST=/n/shell/0/kannan/bin/${ARCH}/
- XMANTYPE=l
- XMANDEST=/n/shell/0/kannan/man/man$(MANTYPE)
- XTEXLIB=/n/shell/0/kannan/Bib/
- X
- XCCFLAGS=${CFLAGS} ${INCDIR}
- XINCLUDES=includes.h config.h strings.h
- X
- Xall: bibc shbib rmbib bibv
- X @echo Fee Fi Fo Fum
- X
- Xbibc: bibc.o lex.yy.o inits.o templates.o lib_bib.o
- X cc ${CFLAGS} bibc.o lex.yy.o inits.o templates.o lib_bib.o $(RELIB) -o $@
- X
- Xshbib: shbib.o lib_bib.o
- X cc ${CFLAGS} shbib.o lib_bib.o $(RELIB) -o $@
- X
- Xrmbib: rmbib.o lib_bib.o
- X cc ${CFLAGS} rmbib.o lib_bib.o $(RELIB) -o $@
- X
- Xbibv: bibv.o lib_bib.o
- X cc ${CFLAGS} bibv.o lib_bib.o $(RELIB) -o $@
- X
- Xbibc.o: bibc.c $(INCLUDES) bibc.h
- X cc -c ${CCFLAGS} bibc.c
- X
- Xinits.o: inits.c $(INCLUDES) bibc.h
- X cc -c ${CCFLAGS} inits.c
- X
- Xtemplates.o: templates.c $(INCLUDES) bibc.h
- X cc -c ${CCFLAGS} templates.c
- X
- Xlex.yy.o: lex.yy.c $(INCLUDES)
- X cc -c ${CCFLAGS} lex.yy.c
- X
- Xlex.yy.c: bibl.l $(INCLUDES)
- X flex -I bibl.l
- X
- Xbibl.l: alpha.lex lexstrings.lex omega.lex
- X gen_lex_file alpha.lex lexstrings.lex omega.lex > bibl.l
- X
- Xshbib.o: bibcent.c $(INCLUDES) bibcent.h
- X cc -c -DSHBIB ${CCFLAGS} bibcent.c
- X mv bibcent.o shbib.o
- X
- Xrmbib.o: bibcent.c $(INCLUDES) bibcent.h
- X cc -c -DRMBIB ${CCFLAGS} bibcent.c
- X mv bibcent.o rmbib.o
- X
- Xbibv.o: bibv.c $(INCLUDES) bibv.h
- X cc -c ${CCFLAGS} bibv.c
- X
- Xlib_bib.o: lib_bib.c $(INCLUDES)
- X cc -c ${CCFLAGS} lib_bib.c
- X
- Xinstall: all
- X install -s bibc ${BINDEST}
- X install -s bibv ${BINDEST}
- X install -s shbib ${BINDEST}
- X install -s rmbib ${BINDEST}
- X install -c specl.bst ${TEXLIB}
- X cp bibtools.man ${MANDEST}/bibtools.$(MANTYPE)
- X ln ${MANDEST}/bibtools.$(MANTYPE) ${MANDEST}/bibc.$(MANTYPE)
- X ln ${MANDEST}/bibtools.$(MANTYPE) ${MANDEST}/bibv.$(MANTYPE)
- X ln ${MANDEST}/bibtools.$(MANTYPE) ${MANDEST}/shbib.$(MANTYPE)
- X ln ${MANDEST}/bibtools.$(MANTYPE) ${MANDEST}/rmbib.$(MANTYPE)
- X
- Xclean:
- X rm -f bibc bibv shbib rmbib core linterrs *.o
- X
- Xlint:
- X lint $(INCDIR) bibc.c inits.c templates.c lib_bib.c lex.yy.c > linterrs
- X lint $(INCDIR) -DSHBIB bibcent.c lib_bib.c >> linterrs
- X lint $(INCDIR) -DRMBIB bibcent.c lib_bib.c >> linterrs
- X lint $(INCDIR) bibv.c lib_bib.c >> linterrs
- X
- X#
- X# Debug and test makes.....
- X#
- Xdebug:
- X make CFLAGS='-gx -DEBUG' ARCH=${ARCH} all
- X
- Xbackup:
- X @rm -f core linterrs *.o
- X (cd .. ; pack Bibcreate/* > bibc.shar)
- X
- Xmakes:
- X sed 's/^ARCH=.*/ARCH=sun/' Makefile > makefile.sun
- X sed 's/^ARCH=.*/ARCH=pyr/' Makefile > makefile.pyr
- EOFile Makefile
- chmod u=rw+,g=rw+,o=r++ Makefile
- echo '...done' 1>&2
- if [ ! -d . ] ; then
- echo -n Directory . not found. Creating....
- mkdir .
- if [ ! -d . ] ; then
- echo ...failed
- echo unable to create directory .. Please create the directory and try again
- exit
- fi
- echo ...done
- fi
- echo -n "README..." 1>&2
- if test -f README
- then
- case $# in
- 0)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- case $1 in
- -o) ;;
- *)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- fi
- sed 's/^X//' << 'EOFile README' > README
- XCopyright (c) 1989 Ohio State University
- XWritten by Kannan Varadhan. Not derived from licensed software.
- X
- XPermission is granted to anyone to use this software for any purpose on
- Xany computer system, and to redistribute it freely, subject to the
- Xfollowing restrictions...
- X
- X 1. The author is not responsible for the consequences of use of
- X this software, no matter how awful, even if they arise
- X from defects in it.
- X
- X 2. The origin of this software must not be misrepresented, either
- X by explicit claim or by omission.
- X
- X 3. Altered versions must be plainly marked as such, and must not
- X be misrepresented as being the original software.
- X
- XInstalling bibc:
- X
- XBefore you start, you will need
- Xa) a regular expression package. I prefer to use the one that Henry
- XSpenser wrote aeons ago. This one is in the public domain. A copy of
- Xit should be in the Regexp directory. From this, we need regcomp(),
- Xregexec() and regerror().
- X
- XIf you wish to use some other regular expression package, you have to
- Xfigure out how your set of routines will compile the re, and then how it
- Xwill execute a string on the resulting automaton. You can then change
- Xthe defines REGCOMP, REGEXEC, which are routine invokes, and REGEXP, the
- Xstruct, and change the includes for regexp.h in 'includes.h'. Simple,
- Xisn't it? :-)
- X
- Xb) You will also need flex before you can make bibc though. In case
- Xyou do not have access to flex, you could use the lex.yy.c with this
- Xcode, which has been generated with flex.
- X
- XBoth these packages have appeared on comp.sources.xxxxxxxx.
- X
- XNow edit Makefile, and config.h, and put in your various options. There
- Xare adequate comments alongside the various parameters, so one should
- Xhave no problem here.
- X
- XIf you are on a system V machine, edit strings.h, and make sure all the
- Xdefinitions there are ok too.
- X
- Xmake, and make install should see you through.
- X
- XNote that bibv uses a specially hacked bst file, called specl.bst. This
- Xstyle causes the bibitem keys to be the same as the \cite-keys that you
- Xhave used. This is a convenient style for keeping hardcopies for ready
- Xreference, considering that these are sorted nicely and all that :)
- XIf you would like to have a copy of the btxbst.doc file, send me a note,
- Xand I'll send it to you....
- X
- XKANNAN Sun Dec 3 02:08:19 EST 1989
- EOFile README
- chmod u=rw+,g=rw+,o=r++ README
- echo '...done' 1>&2
- if [ ! -d . ] ; then
- echo -n Directory . not found. Creating....
- mkdir .
- if [ ! -d . ] ; then
- echo ...failed
- echo unable to create directory .. Please create the directory and try again
- exit
- fi
- echo ...done
- fi
- echo -n "README.lib_bib..." 1>&2
- if test -f README.lib_bib
- then
- case $# in
- 0)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- case $1 in
- -o) ;;
- *)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- fi
- sed 's/^X//' << 'EOFile README.lib_bib' > README.lib_bib
- XThis is a detailed note on the kind of functions available as part of a
- Xlibrary for manipulating bib-files. Hopefully, someone might find
- Xthis useful to write other tools to manipulate bibliographies in other
- Xways.
- X
- X-------------------------------------------------------------------------
- X
- Xchar *
- Xmy_gets (buffer, size)
- X/*
- X * This is an emulation of gets() using fgets.3
- X * This routine reads everything upto a newline, using fgets.3
- X *
- X * OUTPUT: Returns buffer on exit, (char *) NULL on error
- X * The contents of buffer are the input string, a max of (size -1)
- X * characters are filled on exit,
- X * The buffer is zeroed and returned on EOF.
- X *
- X * This routine only deals with EOF as an error cleanly. On any other
- X * error returned by fgets.3, this routine will return will return
- X * (char *) NULL and a partially filled buffer....*sigh*
- X *
- X * if EMUL_GETS is turned on, (it probably should, neh? :-) then
- X * it converts any trailing NEWLINE character ('\n') to a NIL ('\0')
- X * character, else, it leaves them alone
- X */
- Xchar *buffer;
- Xint size;
- X
- X-------------------------------------------------------------------------
- X
- Xanswer (string, resp)
- X/*
- X * Display string, query user....return TRUE if answer = resp
- X */
- Xchar *string;
- Xchar resp;
- X
- X-------------------------------------------------------------------------
- X
- Xprocess_bibfiles (files, process_recd, onerror)
- X/*
- X * For each file in files,
- X * delineate_next_record
- X * process_record (file, record);
- X * if process_record() indicates error,
- X * onerror (open_file_descriptor);
- X * lseek to EOF
- X * cause exit()
- X *
- X * An argument of "-" as a filename, returns the filedescriptor 0,
- X * corresponding to stdin.
- X */
- Xchar **files;
- Xint (*process_recd)(), (*onerror)();
- X
- X-------------------------------------------------------------------------
- X
- Xget_next_file (curfd)
- X/*
- X * Close current file descriptor;
- X * get next bib file from bibflist
- X * open file, and return new file descriptor;
- X *
- X * An argument of "-" as a filename, returns the filedescriptor 0,
- X * corresponding to stdin.
- X */
- Xint curfd;
- X
- X-------------------------------------------------------------------------
- X
- Xchar *
- Xlcase (string)
- X/*
- X * Lower case the given string
- X */
- Xchar *string;
- X
- X-------------------------------------------------------------------------
- X
- Xchar *
- Xreplstr (str)
- X/*
- X * replicate the given string. get storage, and return the new string.
- X */
- Xchar *str;
- X
- X-------------------------------------------------------------------------
- X
- Xchar *
- Xdelineate_recd (string)
- X/*
- X * Get next record, using '\n@' as a flag per record.
- X * Match all braces,
- X * If record found, delineate current record by placing '\0' at end of
- X * current record, and return address of next record.
- X * else return (char *) NULL;
- X */
- Xchar *string;
- X
- X-------------------------------------------------------------------------
- X
- Xstrcount (str, c)
- X/*
- X * Count the number of occurences of character 'c' in string "str"
- X */
- Xchar *str;
- Xchar c;
- X
- X-------------------------------------------------------------------------
- X
- Xchar *
- Xget_atsign (str)
- X/*
- X * Get an atsign, check if it is preceeded by a newline
- X * If yes, return value,
- X * else repeat search
- X */
- Xchar *str;
- X
- X-------------------------------------------------------------------------
- X
- XREGEXP *
- Xmy_rcomp (re)
- X/*
- X * STRATEGY: lcase the string inplace, and feed to regcomp(), return the
- X * value returned as is...
- X */
- Xchar *re;
- X
- X{ return regcomp (lcase (re)); }
- X
- X-------------------------------------------------------------------------
- X
- Xmy_rexec (prog, str)
- Xregexp *prog;
- X/*
- X * my_rexec = TRUE, if lcase (copy of str) contains given re
- X * = FALSE otherwise.
- X */
- Xchar *str;
- X
- EOFile README.lib_bib
- chmod u=rw+,g=r++,o=r++ README.lib_bib
- echo '...done' 1>&2
- if [ ! -d . ] ; then
- echo -n Directory . not found. Creating....
- mkdir .
- if [ ! -d . ] ; then
- echo ...failed
- echo unable to create directory .. Please create the directory and try again
- exit
- fi
- echo ...done
- fi
- echo -n "TODO..." 1>&2
- if test -f TODO
- then
- case $# in
- 0)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- case $1 in
- -o) ;;
- *)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- fi
- sed 's/^X//' << 'EOFile TODO' > TODO
- Xerror handling in abrupt departures bibc
- X handled some of it...clean exit is still guaranteed, though
- X some garbage (?) gets seen on the screen
- Xsignals all
- X nyeah..considering the algorithm we are using for processing the
- X files, this, unless I am shown otherwise, is not going to be
- X really necessary! Consider the algorithms in brief:
- X
- X bibc:
- X while ! EOF do
- X get a record from user,
- X write out record,
- X done
- X bibv: For each file do
- X for each record in file do
- X get cite key
- X write into bibtex.tex
- X store filename
- X done
- X done
- X write out list of files,
- X run latex, bibtex, latex, latex
- X
- X shbib, rmbib: for each file do
- X for each record in file do
- X match regexp against record
- X if match, printout
- X if no match, and remove specified,
- X write record into file.bak
- X done
- X if file.bak exists rename file.bak as file
- X done
- X
- X Notice that the original file is never destroyed irrecoverably.
- Xcleaner handling of stdin shbib and rmbib
- X Question is, why? stdin can always be specified as "-"
- X to shbib, rmbib and bibv. With shbib and rmbib, a file "-.bak"
- X will be created for stdin, which is "safe".
- Xstat the file before editing bibc
- X DONE
- Xmanual pages all
- X Whatever, I guess
- XA README writeup on installation all
- X DONE
- XA writeup and comments for lib_bib.c libbib
- X DONE
- EOFile TODO
- chmod u=rw+,g=r++,o=r++ TODO
- echo '...done' 1>&2
- if [ ! -d . ] ; then
- echo -n Directory . not found. Creating....
- mkdir .
- if [ ! -d . ] ; then
- echo ...failed
- echo unable to create directory .. Please create the directory and try again
- exit
- fi
- echo ...done
- fi
- echo -n "alpha.lex..." 1>&2
- if test -f alpha.lex
- then
- case $# in
- 0)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- case $1 in
- -o) ;;
- *)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- fi
- sed 's/^X//' << 'EOFile alpha.lex' > alpha.lex
- X%{
- X
- X/*
- X * This program has been written by Kannan Varadhan. You are welcome to
- X * use, copy, modify, or circulate as you please, provided you do not
- X * charge any fee for any of it, and you do not remove these header
- X * comments from any of these files.
- X *
- X * -- kva Mon Dec 4 11:26:37 EST 1989
- X */
- X
- X#include "bibc.h"
- X#undef YY_INPUT
- X#define YY_INPUT(buf,reslt,msize) my_input (buf, &reslt, msize)
- X
- Xmy_input (buf,reslt, size)
- Xchar *buf;
- Xint *reslt;
- Xint size;
- X
- X{
- Xchar inputln[80];
- X
- X bzero (inputln, 80);
- X if (! GETS (inputln, 80))
- X Strcpy (buf, "EOF");
- X else
- X Strncpy (buf, inputln, size);
- X Strcat (buf, "!");
- X#ifdef FLEX_DEBUG
- X Fprintf (stderr, "buf contains: %s\n", buf);
- X#endif
- X return *reslt = strlen (buf);
- X}
- X
- X
- Xmy_yylex ()
- X
- X{
- X#define PROMPTSTR "\
- XWhat kind of record would you like to enter (one of the following)?\n\
- X article book booklet conference\n\
- X inbook incollection inproceedings manual\n\
- X mastersthesis msthesis misc phdthesis\n\
- X proceedings techreport unpublished\n\
- Xor EDIT quit\n"
- X
- X Fprintf (stderr, PROMPTSTR);
- X return yylex ();
- X}
- X
- X%}
- EOFile alpha.lex
- chmod u=rw+,g=r++,o=r++ alpha.lex
- echo '...done' 1>&2
- if [ ! -d . ] ; then
- echo -n Directory . not found. Creating....
- mkdir .
- if [ ! -d . ] ; then
- echo ...failed
- echo unable to create directory .. Please create the directory and try again
- exit
- fi
- echo ...done
- fi
- echo -n "bibc.c..." 1>&2
- if test -f bibc.c
- then
- case $# in
- 0)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- case $1 in
- -o) ;;
- *)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- fi
- sed 's/^X//' << 'EOFile bibc.c' > bibc.c
- X/*
- X * This program has been written by Kannan Varadhan. You are welcome to
- X * use, copy, modify, or circulate as you please, provided you do not
- X * charge any fee for any of it, and you do not remove these header
- X * comments from any of these files.
- X *
- X * -- kva Mon Dec 4 11:26:37 EST 1989
- X */
- X
- X#define GLOBALS
- X#include "bibc.h"
- X
- Xmain (argc, argv, envp)
- Xint argc;
- Xchar **argv, **envp;
- X
- X{
- Xint retval;
- X
- X retval = FLD_NULL;
- X
- X (void) process_args (argc, argv);
- X (void) initialise (&bibitem);
- X
- X while (retval = my_yylex()) {
- X switch (retval) {
- X case FLD_ERROR: Fprintf (stderr, "Uh oh! no no no\n");
- X continue;
- X case ARTICLE: retval = get_article (); break;
- X case BOOK: retval = get_book (); break;
- X case BOOKLET: retval = get_booklet (); break;
- X case CONFERENCE: retval = get_inproceedings (); break;
- X case INBOOK: retval = get_inbook (); break;
- X case INCOLLECTION: retval = get_incollection (); break;
- X case INPROCEEDINGS: retval = get_inproceedings (); break;
- X case MANUAL: retval = get_manual (); break;
- X case MASTERSTHESIS: retval = get_mastersthesis (); break;
- X case MISC: retval = get_misc (); break;
- X case PHDTHESIS: retval = get_phdthesis (); break;
- X case PROCEEDINGS: retval = get_proceedings (); break;
- X case TECHREPORT: retval = get_techreport (); break;
- X case UNPUBLISHED: retval = get_unpublished (); break;
- X case FLD_EDITOR: retval = edit (outfile, _O_outfilename, envp); break;
- X }
- X if (retval != -1)
- X (void) writeout (&bibitem, outfile);
- X (void) resetall (&bibitem);
- X }
- X fclose (outfile);
- X return 0;
- X}
- X
- Xwriteout (bi, outfile)
- Xbibrec *bi;
- XFILE *outfile;
- X
- X{
- X#define PUT(VAR,REC) \
- X if (ISSET (VAR,REC)) \
- X { \
- X if (Index (ISVAL(VAR,REC), QUOTE_CHAR)) \
- X { tmp1 = OPEN_BRACE; tmp2 = CLOSE_BRACE ; } \
- X else if (ISVAL(VAR,REC)[0] == '\\') \
- X { \
- X tmp1 = tmp2 = ' '; \
- X ISVAL(VAR,REC)[0] = ' '; \
- X } \
- X else \
- X tmp1 = tmp2 = QUOTE_CHAR; \
- X Sprintf (recordbuf, "%s ,\n\t%s = %c%s%c", recordbuf, \
- X (VAR)->REC.prompt, tmp1, ISVAL (VAR,REC), tmp2);\
- X }
- Xchar recordbuf[1024];
- Xchar tmp1, tmp2;
- Xint i;
- X
- X Sprintf (recordbuf, "@%s { %s", ISVAL(bi, rectype), ISVAL (bi, citekey));
- X PUT (bi, address);
- X PUT (bi, annote);
- X PUT (bi, author);
- X PUT (bi, booktitle);
- X PUT (bi, chapter);
- X PUT (bi, edition);
- X PUT (bi, editor);
- X PUT (bi, howpublished);
- X PUT (bi, institution);
- X PUT (bi, journal);
- X PUT (bi, key);
- X PUT (bi, month);
- X PUT (bi, note);
- X PUT (bi, number);
- X PUT (bi, organisation);
- X PUT (bi, pages);
- X PUT (bi, publisher);
- X PUT (bi, school);
- X PUT (bi, series);
- X PUT (bi, title);
- X PUT (bi, type);
- X PUT (bi, volume);
- X PUT (bi, year);
- X PUT (bi, comment);
- X for (i = 0; i != usr_defns_ctr; i++)
- X PUT (bi, usr_defns[i]);
- X Strcat (recordbuf, "\n\t}\n\n");
- X
- X (void) write (2, "", 1);
- X if (_O_verbose)
- X Fprintf (stderr, recordbuf);
- X if (_O_verify)
- X {
- X if (answer ("Is this correct?", NO))
- X return 0;
- X }
- X Fprintf (outfile, recordbuf);
- X fflush (outfile);
- X return 0;
- X}
- X
- X
- Xget_field (next_field, rectype, status)
- Xfield *next_field;
- Xchar *rectype;
- Xchar status;
- X
- X{
- X#define ERRORMSG1 \
- X "ERROR: %s is a REQUIRED FIELD for %s. Let's try that again...sigh...\n"
- X#define ERRORMSG2 \
- X "ERROR: Frankly my dear, I don't give a damn...\n"
- Xchar inputline[512];
- Xchar error;
- Xchar secondtime = FALSE;
- X
- XRETRY: Fprintf (stderr, "%s%s? ", next_field->prompt,
- X ((status == OPTIONAL)? " (optional)" : "" ));
- X fflush (stderr);
- X error = FALSE;
- X bzero (inputline, 512);
- X if (! GETS (inputline, 512))
- X return -1;
- X switch (inputline[0]) {
- X case '\0':
- X if ((status == REQUIRED) && _O_pester_usr)
- X error = TRUE;
- X else
- X return 0;
- X break;
- X case '?':
- X Fprintf (stderr, "%s\n", next_field->helpstring);
- X goto RETRY;
- X case 'x':
- X if (! Strcmp(inputline, "xx"))
- X {
- X if (answer ("Abort?", YES))
- X return -1;
- X }
- X case ' ':
- X (void) clr_leading_blanks (inputline);
- X if (Strlen(inputline) == 0)
- X {
- X if ((status == REQUIRED) && _O_pester_usr)
- X error = TRUE;
- X else
- X return 0;
- X }
- X break;
- X }
- X if (error)
- X {
- X if (secondtime)
- X {
- X Fprintf (stderr, ERRORMSG2, next_field->prompt, rectype);
- X return 0;
- X }
- X else
- X {
- X Fprintf (stderr, ERRORMSG1, next_field->prompt, rectype);
- X secondtime = TRUE;
- X goto RETRY;
- X }
- X }
- X Strcpy (next_field->string, inputline);
- X next_field->full = TRUE;
- X return 0;
- X}
- X
- X
- Xedit (filep, editfile, envp)
- XFILE *filep;
- Xchar *editfile;
- Xchar **envp;
- X
- X{
- XFILE *freopen();
- Xchar *EDITOR, *TEXEDIT, *getenv();
- Xchar *string, *format_cmd();
- Xint editorpid;
- Xint statresult;
- Xstruct stat efile;
- X
- X statresult = stat (editfile, &efile);
- X if ((statresult == -1) || (efile.st_mode & S_IFREG != 1))
- X {
- X Fprintf (stderr, "Cannot edit file %s\n", editfile);
- X return -1;
- X }
- X TEXEDIT = getenv ("TEXEDIT");
- X if (! TEXEDIT)
- X {
- X EDITOR = getenv ("VISUAL");
- X if (! EDITOR) EDITOR = getenv ("EDITOR");
- X if (! EDITOR) EDITOR = DEFAULT_EDITOR;
- X }
- X else
- X string = format_cmd (TEXEDIT, editfile);
- X
- X fclose (filep);
- X editorpid = fork();
- X if (editorpid < 0)
- X {
- X perror ("Cannot fork Editor");
- X exit (-2);
- X }
- X else if (editorpid == 0) /* CHILD */
- X {
- X if (TEXEDIT)
- X execle ("/bin/sh", "sh", "-c", string, (char *) NULL, envp);
- X else
- X execlp (EDITOR, EDITOR, editfile, (char *) NULL, envp);
- X perror ("Cannot exec EDITOR, using DEFAULT_EDITOR");
- X execlp (DEFAULT_EDITOR, DEFAULT_EDITOR, editfile, (char *) NULL, envp);
- X perror ("Cannot exec DEFAULT_EDITOR, giving up");
- X exit (-3);
- X }
- X else
- X (void) wait ((union wait *) 0);
- X filep = freopen (_O_outfilename, "a", filep);
- X return -1 /* A wierd return code, indicating, print nothing..*/;
- X}
- X
- X
- Xclr_leading_blanks (string)
- Xchar *string;
- X
- X{
- Xchar *temp, buffer[512];
- X
- X temp = string;
- X while (*temp == ' ') temp++;
- X Strcpy (buffer, temp);
- X Strcpy (string, buffer);
- X return 0;
- X}
- X
- X
- X
- Xchar *
- Xformat_cmd (envstr, filename)
- Xchar *envstr, *filename;
- X
- X{
- X/*
- X * The envstr is going to be the TEXEDIT environment string.
- X * The filename is going to be the name of the bibfile we are concerned with
- X * We assume that the format of the TEXEDIT string is going to be of the form
- X * <editor name> [%d] %s
- X * The %d would be optional, and contain the displacement variable....
- X * Since we are appending to the end of the bibfile always, we would
- X * position the editor to the bottom of the file always.
- X * Strategy......
- X * locate the first %, if the character spec after it is not d,
- X * ie, it is not %d, then assume it is <editor> %s %d
- X * The %d is really unimportant then, see...
- X * stuff the stuff in, and return the cmd string...
- X */
- Xint lineno;
- XFILE *temp, *fopen();
- Xchar *strndx, buffer[100], cmdstr[100];
- X
- X /* First find the size in terms of lines of filename */
- X temp = fopen (filename, "r"); lineno = 0;
- X if (temp)
- X {
- X while (fgets (buffer, 100, temp)) lineno++;
- X fclose (temp);
- X lineno -= 10; /* An arbitrary figure */
- X }
- X
- X /* lineno = %d specs now... */
- X strndx = Index (envstr, '%');
- X if (! strndx)
- X Strcpy (cmdstr, envstr);
- X else if (*++strndx == 'd')
- X Sprintf (cmdstr, envstr, lineno, filename);
- X else
- X Sprintf (cmdstr, envstr, filename, lineno);
- X return cmdstr;
- X}
- X
- EOFile bibc.c
- chmod u=rw+,g=r++,o=r++ bibc.c
- echo '...done' 1>&2
- if [ ! -d . ] ; then
- echo -n Directory . not found. Creating....
- mkdir .
- if [ ! -d . ] ; then
- echo ...failed
- echo unable to create directory .. Please create the directory and try again
- exit
- fi
- echo ...done
- fi
- echo -n "bibc.h..." 1>&2
- if test -f bibc.h
- then
- case $# in
- 0)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- case $1 in
- -o) ;;
- *)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- fi
- sed 's/^X//' << 'EOFile bibc.h' > bibc.h
- X/*
- X * This program has been written by Kannan Varadhan. You are welcome to
- X * use, copy, modify, or circulate as you please, provided you do not
- X * charge any fee for any of it, and you do not remove these header
- X * comments from any of these files.
- X *
- X * -- kva Mon Dec 4 11:26:37 EST 1989
- X */
- X
- X#include "includes.h"
- X
- X#define OPTIONAL FALSE
- X#define REQUIRED TRUE
- X
- X#define FLD_ERROR -1
- X#define FLD_NULL 0x0000
- X#define ARTICLE 0x0001
- X#define BOOK 0x0002
- X#define BOOKLET 0x0004
- X#define CONFERENCE 0x0008
- X#define INBOOK 0x0010
- X#define INCOLLECTION 0x0020
- X#define INPROCEEDINGS 0x0040
- X#define MANUAL 0x0080
- X#define MASTERSTHESIS 0x0100
- X#define MISC 0x0200
- X#define PHDTHESIS 0x0400
- X#define PROCEEDINGS 0x0800
- X#define TECHREPORT 0x1000
- X#define UNPUBLISHED 0x2000
- X#define FLD_EDITOR 0x4000
- X
- X#define GET(VAR,FIELD,STATUS) \
- X if (get_field (&(VAR)->FIELD, ISVAL(VAR, rectype), STATUS) == -1)\
- X return -1
- X#define SET(VAR,FIELD,VALUE) { \
- X Strcpy ((VAR)->FIELD.string, VALUE); \
- X (VAR)->FIELD.full = TRUE; \
- X }
- X#define RESET(VAR,FIELD) { \
- X Strcpy ((VAR)->FIELD.string, ""); \
- X (VAR)->FIELD.full = FALSE; \
- X }
- X#define ISSET(VAR,FIELD) (VAR)->FIELD.full
- X#define ISVAL(VAR,FIELD) (VAR)->FIELD.string
- X#define ISHELP(VAR,FIELD) (VAR)->FIELD.helpstring
- Xtypedef struct record {
- X char full /* Actually holds a boolean place value */;
- X char string[391] /* An even 32 words / field */;
- X char prompt[32];
- X char helpstring[344] /* Display if user is confused */;
- X } field;
- X
- Xtypedef struct biblio_record {
- X field rectype;
- X field citekey;
- X field address;
- X field annote;
- X field author;
- X field booktitle;
- X field chapter;
- X field edition;
- X field editor;
- X field howpublished;
- X field institution;
- X field journal;
- X field key;
- X field month;
- X field note;
- X field number;
- X field organisation;
- X field pages;
- X field publisher;
- X field school;
- X field series;
- X field title;
- X field type;
- X field volume;
- X field year;
- X field comment;
- X field cross_ref;
- X field usr_defns[USR_DEFNS_MAX];
- X } bibrec;
- X
- XDCL (char, _O_help, FALSE);
- XDCL (char, _O_verify, FALSE);
- XDCL (char, _O_verbose, TRUE);
- XDCL (FILE, *outfile, stdout);
- XDCL (char, _O_outfilename[50], "");
- XDCL (char, _O_pester_usr, SAFE);
- X
- XDCLX (bibrec, bibitem);
- XDCL (int, usr_defns_ctr, 0);
- X
- X
- EOFile bibc.h
- chmod u=rw+,g=r++,o=r++ bibc.h
- echo '...done' 1>&2
- if [ ! -d . ] ; then
- echo -n Directory . not found. Creating....
- mkdir .
- if [ ! -d . ] ; then
- echo ...failed
- echo unable to create directory .. Please create the directory and try again
- exit
- fi
- echo ...done
- fi
- echo -n "bibcent.c..." 1>&2
- if test -f bibcent.c
- then
- case $# in
- 0)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- case $1 in
- -o) ;;
- *)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- fi
- sed 's/^X//' << 'EOFile bibcent.c' > bibcent.c
- X/*
- X * This program has been written by Kannan Varadhan. You are welcome to
- X * use, copy, modify, or circulate as you please, provided you do not
- X * charge any fee for any of it, and you do not remove these header
- X * comments from any of these files.
- X *
- X * -- kva Mon Dec 4 11:26:37 EST 1989
- X */
- X
- X#define GLOBALS
- X#include "bibcent.h"
- X
- X#ifdef SHBIB
- X#undef RMBIB /* why? God alone knows */
- X#endif
- X
- X#ifdef RMBIB
- X#define PROGSTR "rmbib"
- X#else
- X#define PROGSTR "shbib"
- X#endif
- X
- Xmain (argc, argv)
- Xint argc;
- Xchar *argv[];
- X
- X{
- Xextern int process_record(), onerror_cleanup();
- X
- X if (process_args (argc, argv) == -1)
- X return -1 /* EXIT */;
- X regprog = (REGEXP *) REGCOMP (_O_regexp);
- X
- X (void) process_bibfiles (_O_flist, process_record, onerror_cleanup);
- X
- X (void) finish_up ();
- X return 0;
- X}
- X
- X
- Xfinish_up ()
- X
- X{
- X if (store.isfull)
- X (void) output_record (store.filename, store.bibentry);
- X
- X if (_O_rem)
- X {
- X DASSERT (mytmpfile);
- X (void) restore_bakfile (_O_file, mytmpfile);
- X }
- X return 0;
- X}
- X
- X
- Xonerror_cleanup (rdfd)
- Xint rdfd;
- X
- X{
- XFILE *rdfp, *fdopen();
- Xchar buffer[100];
- X
- X if (mytmpfile)
- X {
- X rdfp = fdopen (rdfd, "r");
- X while (fgets (buffer, sizeof(buffer), rdfp))
- X Fprintf (mytmpfile, buffer);
- X (void) restore_bakfile (_O_file, mytmpfile);
- X }
- X
- X return 0;
- X}
- X
- X
- Xprocess_record (file, string)
- Xchar *file, *string;
- X
- X{
- Xint retcode = 0;
- Xchar tmpfn[20];
- X
- X if (_O_file != file)
- X {
- X if (_O_rem)
- X {
- X (void) restore_bakfile (_O_file, mytmpfile);
- X Sprintf (tmpfn, "%s.bak", file);
- X mytmpfile = fopen (tmpfn, "w");
- X }
- X _O_file = file;
- X }
- X
- X if (REGMATCH (regprog, string) != 1)
- X {
- X STASH (string);
- X retcode = 0;
- X }
- X else switch (_O_srch)
- X {
- X case FIRST_MATCH:
- X if (output_record (_O_file, string) == -1)
- X break /* record was not processed...return normally */;
- X retcode = -1;
- X break;
- X case LAST_MATCH:
- X if (store.isfull)
- X {
- X STASH (store.bibentry);
- X free (store.bibentry);
- X }
- X store.isfull = TRUE;
- X store.filename = _O_file;
- X store.bibentry = (char *) replstr (string);
- X break;
- X case GLOBAL_MATCH:
- X (void) output_record (_O_file, string);
- X break;
- X }
- X return retcode;
- X}
- X
- X
- Xprocess_args (argc, argv)
- Xint argc;
- Xchar *argv[];
- X
- X{
- Xint opt, count, i;
- Xextern char *optarg;
- Xextern int optind;
- Xchar **temp;
- X
- X if (argc <= 1)
- X _O_help = TRUE;
- X
- X while ((opt = getopt (argc, argv, "fghilrs")) != EOF)
- X switch (opt) {
- X case 'f':
- X _O_srch = FIRST_MATCH;
- X break;
- X case 'g':
- X _O_srch = GLOBAL_MATCH;
- X break;
- X case 'l':
- X _O_srch = LAST_MATCH;
- X break;
- X case 'h':
- X _O_help = TRUE;
- X break;
- X case 'r':
- X#ifndef RMBIB
- X _O_rem = TRUE;
- X#endif
- X break;
- X case 'i':
- X#ifdef RMBIB
- X _O_inq = TRUE;
- X#endif
- X break;
- X case 's':
- X _O_silent = TRUE;
- X break;
- X case '?':
- X default:
- X _O_help = TRUE;
- X }
- X
- X if (_O_help)
- X {
- X (void) usage ();
- X return -1;
- X }
- X
- X#ifdef RMBIB
- X _O_rem = TRUE;
- X#endif
- X
- X _O_regexp = argv[optind];
- X _O_files = (char **) malloc ((unsigned) (sizeof(char *) * (argc - optind + 1)));
- X if (_O_files == (char **) NULL)
- X {
- X perror (PROGSTR);
- X exit (-2);
- X }
- X
- X count = 0;
- X temp = _O_flist = _O_files;
- X for (i = ++optind; i < argc; i++)
- X {
- X *temp = argv[i];
- X temp++;
- X count++;
- X }
- X *temp = (char *) NULL;
- X if (! *_O_flist)
- X *_O_flist = "-" /* stdin */;
- X if (count <= 1) _O_silent = TRUE;
- X store.isfull = FALSE;
- X
- X return 0;
- X}
- X
- X
- Xrestore_bakfile (file, fptr)
- Xchar *file;
- XFILE *fptr;
- X
- X{
- Xchar tmpfn[20];
- X
- X if (! fptr)
- X return 0;
- X
- X fclose (fptr);
- X Sprintf (tmpfn, "%s.bak", file);
- X (void) rename (tmpfn, file);
- X return 0;
- X}
- X
- X
- Xusage ()
- X
- X{
- X#ifndef RMBIB
- XFprintf (stderr, "usage: %s [-f] [-l] [-g] [-r] [-s] [-h] reg-expn file(s)\n",
- X PROGSTR);
- XFprintf (stderr, "\t-f\tGet first match only\n");
- XFprintf (stderr, "\t-l\tGet last matching record only\n");
- XFprintf (stderr, "\t-g\tGet all matches\n");
- XFprintf (stderr, "\t-r\tDelete matching record\n");
- XFprintf (stderr, "\t-s\tAct Silently, ie don't echo record to stdout\n");
- XFprintf (stderr, "\t-h\tPrint this help\n");
- X#else
- XFprintf (stderr, "usage: %s [-f] [-l] [-g] [-i] [-s] [-h] reg-expn file(s)\n",
- X PROGSTR);
- XFprintf (stderr, "\t-f\tDelete first matching record only\n");
- XFprintf (stderr, "\t-l\tDelete last matching record only\n");
- XFprintf (stderr, "\t-g\tDelete all matches\n");
- XFprintf (stderr, "\t-i\tInquire before deleting record\n");
- XFprintf (stderr, "\t-s\tAct Silently, ie don't echo record to stdout\n");
- XFprintf (stderr, "\t-h\tPrint this help\n");
- X#endif
- Xreturn 0;
- X}
- X
- X
- Xoutput_record (file, record)
- Xchar *file, *record;
- X
- X{
- X if (! _O_silent)
- X Fprintf (stdout, "%s:\n", file);
- X#ifdef RMBIB
- X if (_O_inq)
- X {
- X Fprintf (stderr, "%s\n", record);
- X if (answer ("remove? ", NO))
- X {
- X STASH (record);
- X return -1 /* deletion did not occur */;
- X }
- X else
- X Fprintf (stdout, "%s\n", record);
- X }
- X#else
- X Fprintf (stdout, "%s\n", record);
- X#endif
- X return 0;
- X}
- EOFile bibcent.c
- chmod u=rw+,g=r++,o=r++ bibcent.c
- echo '...done' 1>&2
- if [ ! -d . ] ; then
- echo -n Directory . not found. Creating....
- mkdir .
- if [ ! -d . ] ; then
- echo ...failed
- echo unable to create directory .. Please create the directory and try again
- exit
- fi
- echo ...done
- fi
- echo -n "bibcent.h..." 1>&2
- if test -f bibcent.h
- then
- case $# in
- 0)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- case $1 in
- -o) ;;
- *)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- fi
- sed 's/^X//' << 'EOFile bibcent.h' > bibcent.h
- X/*
- X * This program has been written by Kannan Varadhan. You are welcome to
- X * use, copy, modify, or circulate as you please, provided you do not
- X * charge any fee for any of it, and you do not remove these header
- X * comments from any of these files.
- X *
- X * -- kva Mon Dec 4 11:26:37 EST 1989
- X */
- X
- X#include "includes.h"
- X
- X#define FIRST_MATCH 1 /* -f flag, the default */
- X#define GLOBAL_MATCH 2 /* -g flag */
- X#define LAST_MATCH 4 /* -l flag */
- X
- XREGEXP *REGCOMP();
- X
- Xtypedef struct recd {
- X int isfull;
- X char *filename;
- X char *bibentry;
- X } record;
- X
- XDCL (char, _O_srch, FIRST_MATCH);
- XDCL (char, _O_rem, FALSE); /* -r flag, shent only */
- X#ifdef RMBIB
- XDCL (char, _O_inq, FALSE); /* -i flag, rment only */
- X#endif
- XDCL (char, _O_silent, FALSE); /* -s flag, shent only */
- XDCL (char, _O_help, FALSE); /* -h flag */
- X
- XDCLX (char, **_O_files);
- XDCLX (char, **_O_flist);
- XDCL (char , *_O_file, (char *) NULL);
- XDCL (char, *_O_regexp, (char *) NULL);
- X
- XDCLX (REGEXP, *regprog);
- XDCLX (FILE, *mytmpfile);
- X
- XDCLX (record, store);
- X
- X#ifdef RMBIB
- X#define STASH(str) fprintf (mytmpfile, "%s\n", str)
- X#else
- X#define STASH(str) if (mytmpfile) fprintf (mytmpfile, "%s\n", str)
- X#endif
- EOFile bibcent.h
- chmod u=rw+,g=r++,o=r++ bibcent.h
- echo '...done' 1>&2
- if [ ! -d . ] ; then
- echo -n Directory . not found. Creating....
- mkdir .
- if [ ! -d . ] ; then
- echo ...failed
- echo unable to create directory .. Please create the directory and try again
- exit
- fi
- echo ...done
- fi
- echo -n "bibl.l..." 1>&2
- if test -f bibl.l
- then
- case $# in
- 0)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- case $1 in
- -o) ;;
- *)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- fi
- sed 's/^X//' << 'EOFile bibl.l' > bibl.l
- X%{
- X
- X/*
- X * This program has been written by Kannan Varadhan. You are welcome to
- X * use, copy, modify, or circulate as you please, provided you do not
- X * charge any fee for any of it, and you do not remove these header
- X * comments from any of these files.
- X *
- X * -- kva Mon Dec 4 11:26:37 EST 1989
- X */
- X
- X#include "bibc.h"
- X#undef YY_INPUT
- X#define YY_INPUT(buf,reslt,msize) my_input (buf, &reslt, msize)
- X
- Xmy_input (buf,reslt, size)
- Xchar *buf;
- Xint *reslt;
- Xint size;
- X
- X{
- Xchar inputln[80];
- X
- X bzero (inputln, 80);
- X if (! GETS (inputln, 80))
- X Strcpy (buf, "EOF");
- X else
- X Strncpy (buf, inputln, size);
- X Strcat (buf, "!");
- X#ifdef FLEX_DEBUG
- X Fprintf (stderr, "buf contains: %s\n", buf);
- X#endif
- X return *reslt = strlen (buf);
- X}
- X
- X
- Xmy_yylex ()
- X
- X{
- X#define PROMPTSTR "\
- XWhat kind of record would you like to enter (one of the following)?\n\
- X article book booklet conference\n\
- X inbook incollection inproceedings manual\n\
- X mastersthesis msthesis misc phdthesis\n\
- X proceedings techreport unpublished\n\
- Xor EDIT quit\n"
- X
- X Fprintf (stderr, PROMPTSTR);
- X return yylex ();
- X}
- X
- X%}
- X
- X%%
- X"a!" return ARTICLE;
- X"ar!" return ARTICLE;
- X"art!" return ARTICLE;
- X"arti!" return ARTICLE;
- X"artic!" return ARTICLE;
- X"articl!" return ARTICLE;
- X"article!" return ARTICLE;
- X"book!" return BOOK;
- X"bookl!" return BOOKLET;
- X"bookle!" return BOOKLET;
- X"booklet!" return BOOKLET;
- X"c!" return CONFERENCE;
- X"co!" return CONFERENCE;
- X"con!" return CONFERENCE;
- X"conf!" return CONFERENCE;
- X"confe!" return CONFERENCE;
- X"confer!" return CONFERENCE;
- X"confere!" return CONFERENCE;
- X"conferen!" return CONFERENCE;
- X"conferenc!" return CONFERENCE;
- X"conference!" return CONFERENCE;
- X"inb!" return INBOOK;
- X"inbo!" return INBOOK;
- X"inboo!" return INBOOK;
- X"inbook!" return INBOOK;
- X"inc!" return INCOLLECTION;
- X"inco!" return INCOLLECTION;
- X"incol!" return INCOLLECTION;
- X"incoll!" return INCOLLECTION;
- X"incolle!" return INCOLLECTION;
- X"incollec!" return INCOLLECTION;
- X"incollect!" return INCOLLECTION;
- X"incollecti!" return INCOLLECTION;
- X"incollectio!" return INCOLLECTION;
- X"incollection!" return INCOLLECTION;
- X"inp!" return INPROCEEDINGS;
- X"inpr!" return INPROCEEDINGS;
- X"inpro!" return INPROCEEDINGS;
- X"inproc!" return INPROCEEDINGS;
- X"inproce!" return INPROCEEDINGS;
- X"inprocee!" return INPROCEEDINGS;
- X"inproceed!" return INPROCEEDINGS;
- X"inproceedi!" return INPROCEEDINGS;
- X"inproceedin!" return INPROCEEDINGS;
- X"inproceeding!" return INPROCEEDINGS;
- X"inproceedings!" return INPROCEEDINGS;
- X"man!" return MANUAL;
- X"manu!" return MANUAL;
- X"manua!" return MANUAL;
- X"manual!" return MANUAL;
- X"mas!" return MASTERSTHESIS;
- X"mast!" return MASTERSTHESIS;
- X"maste!" return MASTERSTHESIS;
- X"master!" return MASTERSTHESIS;
- X"masters!" return MASTERSTHESIS;
- X"masterst!" return MASTERSTHESIS;
- X"mastersth!" return MASTERSTHESIS;
- X"mastersthe!" return MASTERSTHESIS;
- X"mastersthes!" return MASTERSTHESIS;
- X"mastersthesi!" return MASTERSTHESIS;
- X"mastersthesis!" return MASTERSTHESIS;
- X"ms!" return MASTERSTHESIS;
- X"mst!" return MASTERSTHESIS;
- X"msth!" return MASTERSTHESIS;
- X"msthe!" return MASTERSTHESIS;
- X"msthes!" return MASTERSTHESIS;
- X"msthesi!" return MASTERSTHESIS;
- X"msthesis!" return MASTERSTHESIS;
- X"mi!" return MISC;
- X"mis!" return MISC;
- X"misc!" return MISC;
- X"ph!" return PHDTHESIS;
- X"phd!" return PHDTHESIS;
- X"phdt!" return PHDTHESIS;
- X"phdth!" return PHDTHESIS;
- X"phdthe!" return PHDTHESIS;
- X"phdthes!" return PHDTHESIS;
- X"phdthesi!" return PHDTHESIS;
- X"phdthesis!" return PHDTHESIS;
- X"pr!" return PROCEEDINGS;
- X"pro!" return PROCEEDINGS;
- X"proc!" return PROCEEDINGS;
- X"proce!" return PROCEEDINGS;
- X"procee!" return PROCEEDINGS;
- X"procees!" return PROCEEDINGS;
- X"proceesi!" return PROCEEDINGS;
- X"proceesin!" return PROCEEDINGS;
- X"proceesing!" return PROCEEDINGS;
- X"proceesings!" return PROCEEDINGS;
- X"t!" return TECHREPORT;
- X"te!" return TECHREPORT;
- X"tec!" return TECHREPORT;
- X"tech!" return TECHREPORT;
- X"techr!" return TECHREPORT;
- X"techre!" return TECHREPORT;
- X"techrep!" return TECHREPORT;
- X"techrepo!" return TECHREPORT;
- X"techrepor!" return TECHREPORT;
- X"techreport!" return TECHREPORT;
- X"u!" return UNPUBLISHED;
- X"un!" return UNPUBLISHED;
- X"unp!" return UNPUBLISHED;
- X"unpu!" return UNPUBLISHED;
- X"unpub!" return UNPUBLISHED;
- X"unpubl!" return UNPUBLISHED;
- X"unpubli!" return UNPUBLISHED;
- X"unpublis!" return UNPUBLISHED;
- X"unpublish!" return UNPUBLISHED;
- X"unpublishe!" return UNPUBLISHED;
- X"unpublished!" return UNPUBLISHED;
- X"quit!" return FLD_NULL;
- X"EOF!" return FLD_NULL;
- X"EDIT!" return FLD_EDITOR;
- X[a-zA-Z0-9]*! return FLD_ERROR;
- X%%
- X
- EOFile bibl.l
- chmod u=rw+,g=r++,o=r++ bibl.l
- echo '...done' 1>&2
- if [ ! -d . ] ; then
- echo -n Directory . not found. Creating....
- mkdir .
- if [ ! -d . ] ; then
- echo ...failed
- echo unable to create directory .. Please create the directory and try again
- exit
- fi
- echo ...done
- fi
- echo -n "bibtools.man..." 1>&2
- if test -f bibtools.man
- then
- case $# in
- 0)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- case $1 in
- -o) ;;
- *)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- fi
- sed 's/^X//' << 'EOFile bibtools.man' > bibtools.man
- X.\" @(#)bibtools.1 (beta version) Sept 15 89
- X.TH BIBTOOLS 1 "15 September 1989"
- X.SH NAME
- X.sp1
- X.nf
- X\fBbibtools\fP
- X \fBbibc\fP \- Create BibTeX and scribe style bibliographies
- X \fBbibv\fP \- Verify a series of BibTeX style bibliographies for
- X citation conflicts
- X \fBshbib\fP \- Display one or more records fromthe specified bib files
- X \fBrmbib\fP \- Delete one or more records fromthe specified bib files
- X.fi
- X.SH SYNOPSIS
- X.sp1
- X.nf
- X\fBbibc\fP [-verify|-i] [-|+pester] [-|+verbose] [-file \fIfilename\fP] [-help]
- X\fBbibv\fP [-s <style>] [-h] [ \fIfilename\fP ... ]
- X\fBshbib\fP [-f|-g|-l] [-s] [-r] [-h] \fIregexp\fP [ \fIfilename\fP... ]
- X\fBrmbib\fP [-f|-g|-l] [-s] [-i] [-h] \fIregexp\fP [ \fIfilename\fP... ]
- X.fi
- X.SH DESCRIPTION
- X.sp 1
- X\fIbibc\fP (mnemonic for BIB-Creator) is a prompt based tool for
- Xcreating bibliographies in the BibTeX format. \fIbibc\fP first queries the
- Xuser for the kind of record they wish to create. \fIbibc\fP understands
- Xthe various fields required for the kind of record specified, and will
- Xquery the user for the values for each of these fields. \fIbibc\fP can
- Xdistinguish between required and optional fields, and will, by default
- Xinsist once on the user specifying the required fields.
- X
- X.nf
- X Once it has obtained a complete record, it will write it to the
- X file specified using the \fB-file\fP option, or to stdout.
- X
- X \fIbibc\fP's insistence can be turned off by using the
- X \fB-pester\fP flag. Specifying \fB+pester\fP will reverse this
- X flag. Default is \fB+pester\fP.
- X
- X One can require \fIbibc\fP to confirm every record before it is
- X entered into the bib-file by using the \fB-verify,\fP or
- X \fB-i\fP option. The default is "do not verify".
- X
- X If the \fB-verbose\fP option is specified, \fIbibc\fP will not echo the
- X record to stdout. \fB+verbose\fP will cause every record to be
- X echoed. Default is \fB+verbose\fP.
- X
- X The \fB-help\fP option causes \fIbibc\fP to print out a short usage
- X summary, describing all the options available to it.
- X.fi
- X
- XTyping a '?' will cause \fIbibc\fP to print out one or two lines of help about
- Xthe concerned field. One can abort the current record, and restart a
- Xnew one by typing "xx" to a field.
- X
- XA field that begins with a '\\' is assumed to flag a macro, and will
- Xtherefore not be quoted in the output.
- X
- XSpecifying "EDIT" (case is important here), will cause \fIbibc\fP to fork an
- Xeditor on the current file. \fIbibc\fP will first attempt to fork off an
- Xeditor using the "TEXEDIT" environment variable. Then, it will
- Xsucessively try "VISUAL", and "EDITOR", failing which it will try to
- Xfork off a default editor, fixed by your system administrator.
- X
- XIt is possible for a user to define a maximum of 5 fields for
- Xthemselves. This is done by setting an environment variable called
- X\fBBIBCINIT\fP. The syntax of this variable is similar to the MAILPATH
- Xvariable in ksh, and is 'FIELD1?help_string1:FIELD2?help_string2:...'
- XThese fields are queried at the very end, the help_strings are the
- Xstrings put out when one types a '?' to get information on the specific
- Xfield. By default, these fields are considered optional.
- X
- XSee the USAGE section for more help.
- X
- X\fIbibv\fP (mnemonic for BIB Verifier) creates a small sample LaTeX file,
- Xcontaining just citations for every entry in the bib files specified,
- Xand runs this file sucessively through latex, bibtex, latex, latex to
- Xproduce bibtex.tex and bibtex.dvi files. The run through bibtex causes
- Xany duplicate citations to be flagged. One can print the dvi file, and
- Xget a hardcopy record of all the entries in the specified bib files.
- X
- X.nf
- X \fIbibv\fP uses a special kind of bst file, called
- X \fBspecl\fP. This style file causes the bibitem keys to be the
- X same as the \\cite-keys that are used in the bib files
- X themselves. This is a convenient style for keeping hardcopies
- X of the bibliographies for reference.
- X One can use the \fB-s\fP option to specify a different style to
- X be used.
- X
- X The \fB-h\fP option causes a brief help message to get printed out.
- X.fi
- X
- X\fIshbib\fP (mnemonic for SHow BIB entry) is used to view records in the
- Xgiven bib files. The records matching the specific regular expression
- Xare printed on stdout.
- X
- X.nf
- X The \fB-f\fP option specifies that only the first matching record is
- X to be printed out. This is the default.
- X
- X The \fB-g\fP option specifies the all records matching the expression
- X amongst all the files is to be printed out. This is a mnemonic
- X for "globally match".
- X
- X The \fB-l\fP option specifies that only the last matching record is
- X to be printed out.
- X
- X The \fB-r\fP option asks shbib to remove all records that get printed
- X out, from the respective files. Note that this option can be
- X dangerous when used carelessly, and is not always recommended.
- X
- X If more than one files is given to \fIshbib\fP, the file where the
- X corresponding match is made is also echoed to stdout. The \fB-s\fP
- X option, for silent, asks \fIshbib\fP not to do this echoing.
- X
- X The \fI-h\fP option causes a brief help message to get printed out.
- X.fi
- X
- X\fIrmbib\fP (mnemonic for ReMove BIB entry) is a tool to remove records
- Xmatching the given regular expression from the corresponding bib
- Xfiles. The records that are deleted are also echoed to stdout.
- X
- X.nf
- X The \fB-f\fP option, the default specifies that only the first
- X matching record is to be deleted.
- X
- X The \fB-g\fP option, requires all matching records are to be deleted.
- X
- X The \fB-l\fP option requires that only the last matching record is to
- X be deleted.
- X
- X The \fB-s\fP option asks \fIrmbib\fP not to echo the filename
- X matched, if more than one bibfile has been specified.
- X
- X The \fB-i\fP option requires \fIrmbib\fP to inquire the user before
- X deleting any record.
- X
- X The \fB-h\fP option causes a brief help message to get printed out.
- X.fi
- X
- X.sp1
- X.SH USAGE
- X.sp1
- X
- XSee the sample walkthrough of usage of \fIbibc\fP, and a brief use of
- X\fIshbib\fP. \fBBold\fP lettering indicates characters that the user
- Xtypes in.
- X
- X.nf
- XScript started on Sun Dec 3 00:47:28 1989
- Xcheops Bibcreate. \fBbibc -help\fP
- XUsage: bibc [-i|-verify] [+|-verbose] [+|-pester] [-file <filename>] [-help]
- X -i Inquire whether to commit a record
- X -verify Same as above, a duplicate form
- X -verbose Turn off verbose flag
- X +verbose Turn on verbose flag
- X -pester Do not insist, even for required fields
- X +pester Insist once for required fields
- X -file <filename> Output bib entries to <filename>
- X -help Print this help output
- Xcheops Bibcreate. \fBbibc -file foo.bib\fP
- XWhat kind of record would you like to enter (one of the following)?
- X article book booklet conference
- X inbook incollection inproceedings manual
- X mastersthesis msthesis misc phdthesis
- X proceedings techreport unpublished
- Xor EDIT quit
- X\fBinb\fP
- XCITEKEY? \fBNAR88\fP
- XAUTHOR? \fBNarayan, R. K.\fP
- XTITLE? \fBA Writer's Nightmare\fP
- XCHAPTER?
- XERROR: CHAPTER is a REQUIRED FIELD for INBOOK. Let's try that again...sigh...
- XCHAPTER?
- XERROR: Frankly my dear, I don't give a damn...
- XPAGES (optional)? \fB164--166\fP
- XPUBLISHER? \fBPenguin Books\fP
- XYEAR? \fB1988\fP
- XVOLUME (optional)? \fB1\fP
- XSERIES (optional)?
- XADDRESS (optional)?
- XEDITION (optional)?
- XMONTH (optional)?
- XNOTE (optional)?
- XKEY (optional)? \fB?\fP
- XUsed for alphabetising and creating a label when the author and
- X editor fields are missing.
- XKEY (optional)?
- XCOMMENT (optional)?
- XCROSS-REFERENCE (optional)?
- X@INBOOK { NAR88 ,
- X AUTHOR = "Narayan, R. K." ,
- X PAGES = "164--166" ,
- X PUBLISHER = "Penguin Books" ,
- X TITLE = "A Writer's Nightmare" ,
- X VOLUME = "1" ,
- X YEAR = "1988"
- X }
- X
- XWhat kind of record would you like to enter (one of the following)?
- X article book booklet conference
- X inbook incollection inproceedings manual
- X mastersthesis msthesis misc phdthesis
- X proceedings techreport unpublished
- Xor EDIT quit
- X\fBin\fP
- XUh oh! no no no
- XWhat kind of record would you like to enter (one of the following)?
- X article book booklet conference
- X inbook incollection inproceedings manual
- X mastersthesis msthesis misc phdthesis
- X proceedings techreport unpublished
- Xor EDIT quit
- X\fBmi\fP
- XCITEKEY? \fBxx\fP
- XAbort? [y|n] \fBy\fP
- XWhat kind of record would you like to enter (one of the following)?
- X article book booklet conference
- X inbook incollection inproceedings manual
- X mastersthesis msthesis misc phdthesis
- X proceedings techreport unpublished
- Xor EDIT quit
- X\fB^D\fP
- Xcheops Bibcreate. \fBBIBCINIT="USR_FIELD1:USR_FIELD2?Bah Humbug" export BIBCINIT\fP
- Xcheops Bibcreate. \fBbibc -file foo.bib\fP
- XWhat kind of record would you like to enter (one of the following)?
- X article book booklet conference
- X inbook incollection inproceedings manual
- X mastersthesis msthesis misc phdthesis
- X proceedings techreport unpublished
- Xor EDIT quit
- X\fBa\fP
- XCITEKEY? \fBLAM78\fP
- XAUTHOR? \fBLamport, Leslie\fP
- XTITLE? \fBTime, Clocks, and the Ordering of Events in a Distributed System\fP
- XJOURNAL? \fB\\jacm\fP
- XYEAR? \fB1978\fP
- XVOLUME (optional)? \fB21\fP
- XNUMBER (optional)? \fB7\fP
- XPAGES (optional)? \fB558--565\fP
- XMONTH (optional)? \fB\\jul\fP
- XNOTE (optional)?
- XKEY (optional)?
- XCOMMENT (optional)?
- XCROSS-REFERENCE (optional)?
- XUSR_FIELD1 (optional)? \fB?\fP
- XYou asked for it, buster, so you figure it out...
- XUSR_FIELD1 (optional)? \fBThis wasn't in the jacm, sigh\fP
- XUSR_FIELD2 (optional)? \fB?\fP
- XBah Humbug
- XUSR_FIELD2 (optional)? \fBThere we go, it was in the cacm, so we can EDIT and change the entry\fP
- X@ARTICLE { LAM78 ,
- X AUTHOR = "Lamport, Leslie" ,
- X JOURNAL = jacm ,
- X MONTH = jul ,
- X NUMBER = "7" ,
- X PAGES = "558--565" ,
- X TITLE = "Time, Clocks, and the Ordering of Events in a Distributed System" ,
- X VOLUME = "21" ,
- X YEAR = "1978" ,
- X USR_FIELD1 = "This wasn't in the jacm, sigh" ,
- X USR_FIELD2 = "There we go, it was in the cacm, so we can EDIT and change the entry"
- X }
- X
- XWhat kind of record would you like to enter (one of the following)?
- X article book booklet conference
- X inbook incollection inproceedings manual
- X mastersthesis msthesis misc phdthesis
- X proceedings techreport unpublished
- Xor EDIT quit
- X\fB^D\fP
- Xcheops Bibcreate. \fBshbib lam78 foo.bib\fP
- X@ARTICLE { LAM78 ,
- X AUTHOR = "Lamport, Leslie" ,
- X JOURNAL = jacm ,
- X MONTH = jul ,
- X NUMBER = "7" ,
- X PAGES = "558--565" ,
- X TITLE = "Time, Clocks, and the Ordering of Events in a Distributed System" ,
- X VOLUME = "21" ,
- X YEAR = "1978" ,
- X USR_FIELD1 = "This wasn't in the jacm, sigh" ,
- X USR_FIELD2 = "There we go, it was in the cacm, so we can EDIT and change the entry"
- X }
- Xcheops Bibcreate.
- X
- Xscript done on Sun Dec 3 00:57:11 1989
- X.fi
- X
- X.sp1
- X.SH BUGS
- X.sp1
- XThe order of entries in the bib file will not be the same as one had
- Xoriginally started out with if one uses the \fB-r -l\fP option to
- X\fIshbib\fP, or uses the \fB-l\fP option to \fIrmbib\fP.
- X
- XOne might like to have a tool for sorting entries in a file based on
- Xsome specified keys.
- X
- XExiting in the middle of a entering a record via \fBbibc\fP causes some
- Xunnecessary garbage to appear on the screen. The output file is always
- Xconsistent though.
- X
- XThese tools may crash if the bib files specified are not complete and
- Xconsistent.
- X
- XThe method of delineating records is to locate a '\\n@', ie, a newline
- Xfollowed by an '@' as the next character.
- X
- XThe \fB-i\fP option to \fIbibc\fP and \fIrmbib\fP will cause the record
- Xto be seemingly displayed twice. This is not so. The first time, the
- Xwrite is to stderr, the final write is to stdout. This is so one can
- Xredirect stdout to correct places, such as doing
- X
- X.nf
- X \fBrmbib -g -i -s Concurrency bib-files > concurrency.bib\fP
- X.fi
- X
- XHopefully, not much else.
- X
- X.sp1
- X.SH AUTHOR
- X.sp1
- X.LP
- X.nf
- X Kannan Varadhan - kannan@osc.edu
- X.fi
- X.sp1
- X.SH SEE ALSO
- X.sp1
- X.nf
- X\fBegrep(1)\fP, \fBmh(1)\fP, \fBprompter(1)\fP, \fBaddbib(1)\fP, \fPlookbib(1)\fP
- X.fi
- EOFile bibtools.man
- chmod u=rw+,g=+++,o=+++ bibtools.man
- echo '...done' 1>&2
- if [ ! -d . ] ; then
- echo -n Directory . not found. Creating....
- mkdir .
- if [ ! -d . ] ; then
- echo ...failed
- echo unable to create directory .. Please create the directory and try again
- exit
- fi
- echo ...done
- fi
- echo -n "bibv.c..." 1>&2
- if test -f bibv.c
- then
- case $# in
- 0)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- case $1 in
- -o) ;;
- *)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- fi
- sed 's/^X//' << 'EOFile bibv.c' > bibv.c
- X/*
- X * This program has been written by Kannan Varadhan. You are welcome to
- X * use, copy, modify, or circulate as you please, provided you do not
- X * charge any fee for any of it, and you do not remove these header
- X * comments from any of these files.
- X *
- X * -- kva Mon Dec 4 11:26:37 EST 1989
- X */
- X
- X#define GLOBALS
- X#include "bibv.h"
- X
- Xmain (argc, argv)
- Xint argc;
- Xchar *argv[];
- X
- X{
- Xextern int process_record();
- X
- X if (process_args (argc, argv) == -1)
- X return -1 /* EXIT */;
- X
- X (void) set_signals_bibv ();
- X
- X Fprintf (texfile, PREAMBLE, style, userid);
- X (void) process_bibfiles (_O_flist, process_record, (int (*)()) NULL);
- X (void) finish_up ();
- X if (execute (OUTFILE) >= 0)
- X Fprintf (stderr, "Now printout %s.dvi to see the output\n", OUTFILE);
- X (void) cleanup (OUTFILE);
- X return 0;
- X}
- X
- X
- Xfinish_up ()
- X
- X{
- Xchar *temp;
- X
- X Fprintf (stderr, "FILE %s has %d records\n", _O_file, ctr);
- X temp = Rindex (bibrecd, ',');
- X *temp = '\0';
- X Fprintf (texfile, EPILOGUE, bibrecd);
- X fflush (texfile);
- X return 0;
- X}
- X
- X
- Xprocess_record (file, string)
- Xchar *file, *string;
- X
- X{
- Xchar *temp, *key;
- X
- X if (_O_file != file)
- X {
- X if (ctr)
- X Fprintf (stderr, "FILE %s has %d records\n", _O_file, ctr);
- X Fprintf (texfile, SECTIONHDR, file);
- X if (Strcmp ((file + strlen (file) - 4), ".bib") == SAME)
- X Strncat (bibrecd, file, (strlen(file) - 4));
- X else
- X Strcat (bibrecd, file);
- X Strcat (bibrecd, ",");
- X _O_file = file;
- X ctr = 0;
- X }
- X
- X if (REGMATCH (regprog, string) == 1)
- X {
- X temp = Index (string, OPEN_BRACE) + 1;
- X while ((*temp == ' ') || (*temp == '\t') || (*temp == '\n'))
- X temp++;
- X key = temp;
- X while ((*temp != ' ') && (*temp != '\t') && (*temp != '\n') &&
- X (*temp != ','))
- X temp++;
- X *temp = '\0';
- X Fprintf (texfile, CITE, key);
- X ctr++;
- X }
- X
- X return 0;
- X}
- X
- X
- Xprocess_args (argc, argv)
- Xint argc;
- Xchar *argv[];
- X
- X{
- Xint opt, count, i;
- Xextern char *optarg;
- Xextern int optind;
- Xchar **temp;
- Xchar outfile[100];
- X
- X if (argc <= 1)
- X _O_help = TRUE;
- X
- X while ((opt = getopt (argc, argv, "hs:")) != EOF)
- X switch (opt) {
- X case 'h':
- X _O_help = TRUE;
- X break;
- X case 's':
- X style = optarg;
- X break;
- X case '?':
- X default:
- X _O_help = TRUE;
- X }
- X
- X if (_O_help)
- X {
- X usage ();
- X return -1;
- X }
- X
- X _O_files = (char **) malloc ((unsigned) (sizeof (char *) * (argc - optind + 1)));
- X if (_O_files == (char **) NULL)
- X {
- X perror (PROGSTR);
- X exit (-2);
- X }
- X
- X count = 1;
- X temp = _O_flist = _O_files;
- X for (i = optind; i < argc; i++)
- X {
- X *temp = argv[i];
- X count += Strlen (*temp) + 1;
- X temp++;
- X }
- X *temp = (char *) NULL;
- X bibrecd = (char *) malloc ((unsigned) count);
- X bzero (bibrecd, count);
- X
- X pwentry = getpwuid (getuid());
- X userid = pwentry->pw_name;
- X
- X Sprintf (outfile, "%s.tex", OUTFILE);
- X texfile = fopen (outfile, "w");
- X
- X regprog = (REGEXP *) REGCOMP (KEYS);
- X return 0;
- X}
- X
- X
- Xusage ()
- X
- X{
- XFprintf (stderr, "usage: %s [-s style-file] [-h] [ filename ... ]\n", PROGSTR);
- Xreturn 0;
- X}
- X
- X
- Xexecute (outfile)
- Xchar *outfile;
- X
- X{
- X if (run (LATEX, "latex", outfile, TRUE) < 0)
- X return -1;
- X if (run (BIBTEX, "bibtex", outfile, FALSE) < 0)
- X return -1;
- X if (run (LATEX, "latex", outfile, TRUE) < 0)
- X return -1;
- X if (run (LATEX, "latex", outfile, FALSE) < 0)
- X return -1;
- X return 0;
- X}
- X
- X
- Xcleanup (outfile)
- Xchar *outfile;
- X
- X{
- Xchar fn[100];
- X
- X Sprintf (fn, "%s.bbl", outfile); unlink (fn);
- X Sprintf (fn, "%s.aux", outfile); unlink (fn);
- X Sprintf (fn, "%s.log", outfile); unlink (fn);
- X Sprintf (fn, "%s.blg", outfile); unlink (fn);
- X return 0;
- X}
- X
- Xrun (progname, arg0, filename, fdstatus)
- Xchar *progname, *arg0, *filename;
- Xint fdstatus;
- X
- X{
- Xint pid;
- Xchar emsg[100];
- Xunion wait status;
- X
- X Sprintf (emsg, "Cannot run %s .. Aborting", arg0);
- X pid = vfork();
- X if (pid < 0) /* ERROR */
- X {
- X perror ("fork");
- X return -1;
- X }
- X else if (pid == 0) /* CHILD */
- X {
- X if (fdstatus)
- X {
- X close (0); open ("/dev/null", O_RDONLY);
- X close (1); open ("/dev/null", O_WRONLY);
- X close (2); open ("/dev/null", O_WRONLY);
- X }
- X execlp (progname, progname, filename, 0);
- X perror (emsg);
- X return -1;
- X }
- X else
- X (void) wait4 (pid, &status, 0, (struct rusage *) NULL);
- X
- X if (status.w_termsig != 0)
- X {
- X Fprintf (stderr, "%s error, signal %2d %s\n", arg0,
- X status.w_termsig,
- X (status.w_coredump ? ", core dumped" : "")
- X );
- X return -1;
- X }
- X return 0;
- X}
- X
- Xset_signals_bibv ()
- X
- X{
- Xextern int hangup_bibv(), abort_bibv();
- X
- X signal (SIGHUP, hangup_bibv);
- X signal (SIGINT, hangup_bibv);
- X signal (SIGQUIT, hangup_bibv);
- X signal (SIGTERM, hangup_bibv);
- X
- X signal (SIGILL, abort_bibv);
- X signal (SIGBUS, abort_bibv);
- X signal (SIGSEGV, abort_bibv);
- X signal (SIGSYS, abort_bibv);
- X signal (SIGPIPE, abort_bibv);
- X return -1;
- X}
- X
- Xhangup_bibv ()
- X/*
- X * Nothing to do but cleanout bibtex.* files, and exit
- X */
- X
- X{
- Xchar fn[100];
- X
- X Sprintf (fn, "%s.tex", OUTFILE); unlink (fn);
- X Sprintf (fn, "%s.dvi", OUTFILE); unlink (fn);
- X Sprintf (fn, "%s.bbl", OUTFILE); unlink (fn);
- X Sprintf (fn, "%s.aux", OUTFILE); unlink (fn);
- X Sprintf (fn, "%s.log", OUTFILE); unlink (fn);
- X Sprintf (fn, "%s.blg", OUTFILE); unlink (fn);
- X exit (-1);
- X}
- X
- X
- Xabort_bibv (sig, code, scp)
- X/*
- X * First print out a small message, then hangup_bibv()
- X */
- X
- X{
- XFprintf (stderr, "Unexpected error signal %d received..aborting\n", sig);
- Xhangup_bibv ();
- X/*NOT REACHED*/
- X}
- EOFile bibv.c
- chmod u=rw+,g=r++,o=r++ bibv.c
- echo '...done' 1>&2
- if [ ! -d . ] ; then
- echo -n Directory . not found. Creating....
- mkdir .
- if [ ! -d . ] ; then
- echo ...failed
- echo unable to create directory .. Please create the directory and try again
- exit
- fi
- echo ...done
- fi
- echo -n "bibv.h..." 1>&2
- if test -f bibv.h
- then
- case $# in
- 0)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- case $1 in
- -o) ;;
- *)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- fi
- sed 's/^X//' << 'EOFile bibv.h' > bibv.h
- X/*
- X * This program has been written by Kannan Varadhan. You are welcome to
- X * use, copy, modify, or circulate as you please, provided you do not
- X * charge any fee for any of it, and you do not remove these header
- X * comments from any of these files.
- X *
- X * -- kva Mon Dec 4 11:26:37 EST 1989
- X */
- X
- X#include "includes.h"
- X#include <pwd.h>
- X
- X#define PROGSTR "bibv"
- X
- XREGEXP *REGCOMP();
- X
- XDCLX (char, **_O_files);
- XDCLX (char, **_O_flist);
- XDCL (char, *_O_file, (char *) NULL);
- XDCL (char, *bibrecd, (char *) NULL);
- XDCL (char, *style, STYLE);
- XDCLX (struct passwd, *pwentry);
- XDCLX (char, *userid);
- XDCL (int, ctr, 0);
- X
- XDCLX (REGEXP, *regprog);
- XDCLX (FILE, *texfile);
- X
- XDCL (char, _O_help, FALSE);
- X
- X#define PREAMBLE "\\documentstyle{article}\n\
- X\\begin{document}\n\
- X\\bibliographystyle{%s}\n\
- X\\title{Verifying Biblio files}\n\
- X\\author{%s}\n\
- X\\date{\\today}\n\
- X\\maketitle\n"
- X
- X#define SECTIONHDR "\\section{FILE %s}\n\nCiting:\n"
- X#define CITE "\\cite {%s}\n"
- X#define COMMENTS "\
- X%\n\
- X% This is a sample tex file sillustrating, and verifying all the bib\n\
- X% bib entries you have in the bib files you have specified.\n\
- X%"
- X
- X#define EPILOGUE "\\bibliography{%s}\n\\end{document}"
- X
- X#define KEYS "@arti|@book|@conf|@inbo|@inco|@inpr|@manu|@mast|@misc|@phdt|@proc|@tech|@unpu"
- EOFile bibv.h
- chmod u=rw+,g=r++,o=r++ bibv.h
- echo '...done' 1>&2
- if [ ! -d . ] ; then
- echo -n Directory . not found. Creating....
- mkdir .
- if [ ! -d . ] ; then
- echo ...failed
- echo unable to create directory .. Please create the directory and try again
- exit
- fi
- echo ...done
- fi
- echo -n "config.h..." 1>&2
- if test -f config.h
- then
- case $# in
- 0)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- case $1 in
- -o) ;;
- *)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- fi
- sed 's/^X//' << 'EOFile config.h' > config.h
- X/*
- X * This program has been written by Kannan Varadhan. You are welcome to
- X * use, copy, modify, or circulate as you please, provided you do not
- X * charge any fee for any of it, and you do not remove these header
- X * comments from any of these files.
- X *
- X * -- kva Mon Dec 4 11:26:37 EST 1989
- X */
- X
- X/*
- X * SAFE turns off the -pester flag by default, set it to TRUE unless
- X * you have absolutely pained users like me, who think they know what
- X * what they are doing....As to whether they (or I) actually know or
- X * not is not the issue here, is it? :-)
- X */
- X#ifndef SAFE
- X#define SAFE TRUE
- X#endif
- X
- X/* maximum size of string a user is permitted to input */
- X#define MAXLEN 391
- X
- X/* The number of fields a user can define for himself... */
- X#define USR_DEFNS_MAX 5
- X
- X/* hmmm..... */
- X#define DEFAULT_EDITOR "/usr/ucb/vi"
- X
- X/*
- X * If a user defines his own fields, but no help prompts, this is
- X * What I'd say ... ;-)
- X */
- X#define DEFAULT_USERHLP "You asked for it, buster, so you figure it out..."
- X
- X/*
- X * bibv definitions
- X */
- X/* style file to use for bibv */
- X#define STYLE "specl"
- X
- X/* locations of latex and bibtex */
- X#define LATEX "/usr/local/bin/latex"
- X#define BIBTEX "/usr/local/bin/bibtex"
- X
- X/* wait4() equivalent, if you don't have it */
- X#define wait4(PID,STATUS,OPTS,RUSAGE) wait3 (STATUS, OPTS, RUSAGE) /* sigh */
- X
- X/* Name of file output by bibv */
- X#define OUTFILE "bibtex"
- X
- X/*
- X * REGULAR EXPRESSION HANDLING
- X *
- X * entry handling routines only, shent and rment
- X */
- X
- X#define BUFSIZE 8000
- X#define RECSIZE 800
- X
- X#define NOCASE /* Perform caseless regular expression matching */
- X/*
- X * Caseless regular expression matching is done simply by converting
- X * all strings to lower case, and then performing the comparison.
- X */
- X
- X/*
- X * There are three defines
- X * REGEXP defines type of regular expression
- X * REGCOMP compile the r. e. into one of type REGEXP
- X * REGMATCH it to perform the match
- X */
- X#define REGEXP regexp
- X
- X#ifdef NOCASE
- X#define REGCOMP my_rcomp
- X#define REGMATCH my_rexec
- X#else
- X#define REGCOMP regcomp
- X#define REGMATCH regexec
- X#endif
- X
- X
- X/*
- X * What routine to use for gets(). gets() has flaws in it's handling.
- X * I prefer to simulate gets() functionality using my_gets(), in gets.c
- X *
- X * If you don't trust it, you could use, gets() directly.
- X */
- X
- X/*#define GETS(BUFF,SIZE) gets (BUFF) /* Rather not */
- X#define GETS(BUFF,SIZE) my_gets (BUFF, SIZE) /* preferred */
- EOFile config.h
- chmod u=rw+,g=r++,o=r++ config.h
- echo '...done' 1>&2
- if [ ! -d . ] ; then
- echo -n Directory . not found. Creating....
- mkdir .
- if [ ! -d . ] ; then
- echo ...failed
- echo unable to create directory .. Please create the directory and try again
- exit
- fi
- echo ...done
- fi
- echo -n "foo.bib..." 1>&2
- if test -f foo.bib
- then
- case $# in
- 0)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- case $1 in
- -o) ;;
- *)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- fi
- sed 's/^X//' << 'EOFile foo.bib' > foo.bib
- X@INBOOK { NAR88 ,
- X AUTHOR = "Narayan, R. K." ,
- X PAGES = "164--166" ,
- X PUBLISHER = "Penguin Books" ,
- X TITLE = "A Writer's Nightmare" ,
- X VOLUME = "1" ,
- X YEAR = "1988"
- X }
- X@ARTICLE { LAM78 ,
- X AUTHOR = "Lamport, Leslie" ,
- X JOURNAL = jacm ,
- X MONTH = jul ,
- X NUMBER = "7" ,
- X PAGES = "558--565" ,
- X TITLE = "Time, Clocks, and the Ordering of Events in a Distributed System" ,
- X VOLUME = "21" ,
- X YEAR = "1978"
- X }
- X@ARTICLE { lam23 ,
- X AUTHOR = "asd" ,
- X JOURNAL = "asd" ,
- X TITLE = "asd" ,
- X YEAR = "asd"
- X }
- X@ARTICLE { asd ,
- X AUTHOR = "asd" ,
- X JOURNAL = "fd" ,
- X TITLE = "adsf" ,
- X YEAR = "fsd" ,
- X USR_FIELD2 = "help"
- X }
- EOFile foo.bib
- chmod u=rw+,g=r++,o=r++ foo.bib
- echo '...done' 1>&2
- if [ ! -d . ] ; then
- echo -n Directory . not found. Creating....
- mkdir .
- if [ ! -d . ] ; then
- echo ...failed
- echo unable to create directory .. Please create the directory and try again
- exit
- fi
- echo ...done
- fi
- echo -n "gen_lex_file..." 1>&2
- if test -f gen_lex_file
- then
- case $# in
- 0)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- case $1 in
- -o) ;;
- *)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- fi
- sed 's/^X//' << 'EOFile gen_lex_file' > gen_lex_file
- X#! /bin/sh
- X
- X# /*
- X# * This program has been written by Kannan Varadhan. You are welcome to
- X# * use, copy, modify, or circulate as you please, provided you do not
- X# * charge any fee for any of it, and you do not remove these header
- X# * comments from any of these files.
- X# *
- X# * -- kva Mon Dec 4 11:26:37 EST 1989
- X# */
- X
- Xcase $# in
- X0|1|2)
- Xecho usage: `basename $0` preamble_file rules_file postscript_file outputfile
- Xexit ;;
- Xesac
- X
- Xtrap 'rm $tmpfil; exit' 1 2 3 6 9 15
- X
- Xpreamble=$1;
- Xrules=$2;
- Xpostscript=$3;
- Xoutput=$4;
- X
- Xcat $preamble
- Xegrep -v '^#' $rules | awk '
- XBEGIN { printf "\n%%%%\n" ; }
- X{ token = $1;
- X min = length ($2);
- X max = length ($3);
- X key = $3;
- X for (i = min; i <= max; i++)
- X printf "\"%s!\"\t\treturn %s;\n", substr (key, 1, i), token
- X }'
- X
- Xcat $postscript
- Xexit
- EOFile gen_lex_file
- chmod u=rwx,g=r+x,o=r+x gen_lex_file
- echo '...done' 1>&2
- if [ ! -d . ] ; then
- echo -n Directory . not found. Creating....
- mkdir .
- if [ ! -d . ] ; then
- echo ...failed
- echo unable to create directory .. Please create the directory and try again
- exit
- fi
- echo ...done
- fi
- echo -n "header..." 1>&2
- if test -f header
- then
- case $# in
- 0)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- case $1 in
- -o) ;;
- *)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- fi
- sed 's/^X//' << 'EOFile header' > header
- X/*
- X * This program has been written by Kannan Varadhan. You are welcome to
- X * use, copy, modify, or circulate as you please, provided you do not
- X * charge any fee for any of it, and you do not remove these header
- X * comments from any of these files.
- X *
- X * -- kva Mon Dec 4 11:26:37 EST 1989
- X */
- EOFile header
- chmod u=rw+,g=r++,o=r++ header
- echo '...done' 1>&2
- if [ ! -d . ] ; then
- echo -n Directory . not found. Creating....
- mkdir .
- if [ ! -d . ] ; then
- echo ...failed
- echo unable to create directory .. Please create the directory and try again
- exit
- fi
- echo ...done
- fi
- echo -n "includes.h..." 1>&2
- if test -f includes.h
- then
- case $# in
- 0)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- case $1 in
- -o) ;;
- *)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- fi
- sed 's/^X//' << 'EOFile includes.h' > includes.h
- X/*
- X * This program has been written by Kannan Varadhan. You are welcome to
- X * use, copy, modify, or circulate as you please, provided you do not
- X * charge any fee for any of it, and you do not remove these header
- X * comments from any of these files.
- X *
- X * -- kva Mon Dec 4 11:26:37 EST 1989
- X */
- X
- X#include <stdio.h>
- X#include <sys/types.h>
- X#include <sys/file.h>
- X#include <sys/stat.h>
- X#include <ctype.h>
- X#include <assert.h>
- X#include <errno.h>
- X#include <signal.h>
- X#include <sys/wait.h>
- X#include <sys/time.h>
- X#include <sys/resource.h>
- X#include "strings.h"
- X#include "config.h"
- X#include "regexp.h"
- X
- Xextern int errno;
- X#ifdef GLOBALS
- X#define DCL(TYPE,VAR,VAL) TYPE VAR = VAL
- X#define DCLX(TYPE,VAR) TYPE VAR
- X#else
- X#define DCL(TYPE,VAR,VAL) extern TYPE VAR
- X#define DCLX(TYPE,VAR) extern TYPE VAR
- X#endif
- X
- X#define FALSE 0
- X#define TRUE ! FALSE
- X
- X#define SAME 0
- X
- X#ifdef EBUG
- X#define DEBUG
- X#endif
- X
- X#ifdef DEBUG
- X#define WRITE(STRING) write(2,STRING,strlen(STRING));write(2,"\n",1)
- X#define PRINT(FMT,VAR) fprintf (stderr, FMT, VAR)
- X#define DASSERT(COND) assert (COND)
- X#else
- X#define WRITE(STRING)
- X#define PRINT(FMT,VAR)
- X#define DASSERT(COND)
- X#endif
- X
- X#define QUOTE_CHAR '"'
- X#define OPEN_BRACE '{'
- X#define CLOSE_BRACE '}'
- X#define BSLASH '\\'
- X
- X#define YES 'y'
- X#define NO 'n'
- X
- X
- EOFile includes.h
- chmod u=rw+,g=r++,o=r++ includes.h
- echo '...done' 1>&2
- if [ ! -d . ] ; then
- echo -n Directory . not found. Creating....
- mkdir .
- if [ ! -d . ] ; then
- echo ...failed
- echo unable to create directory .. Please create the directory and try again
- exit
- fi
- echo ...done
- fi
- echo -n "inits.c..." 1>&2
- if test -f inits.c
- then
- case $# in
- 0)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- case $1 in
- -o) ;;
- *)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- fi
- sed 's/^X//' << 'EOFile inits.c' > inits.c
- X/*
- X * This program has been written by Kannan Varadhan. You are welcome to
- X * use, copy, modify, or circulate as you please, provided you do not
- X * charge any fee for any of it, and you do not remove these header
- X * comments from any of these files.
- X *
- X * -- kva Mon Dec 4 11:26:37 EST 1989
- X */
- X
- X#include "bibc.h"
- X
- Xresetall (bibitem)
- Xbibrec *bibitem;
- X
- X{
- Xint i;
- X
- X RESET (bibitem, rectype);
- X RESET (bibitem, citekey);
- X RESET (bibitem, address);
- X RESET (bibitem, annote);
- X RESET (bibitem, author);
- X RESET (bibitem, booktitle);
- X RESET (bibitem, chapter);
- X RESET (bibitem, edition);
- X RESET (bibitem, edition);
- X RESET (bibitem, editor);
- X RESET (bibitem, howpublished);
- X RESET (bibitem, institution);
- X RESET (bibitem, journal);
- X RESET (bibitem, key);
- X RESET (bibitem, month);
- X RESET (bibitem, note);
- X RESET (bibitem, number);
- X RESET (bibitem, organisation);
- X RESET (bibitem, pages);
- X RESET (bibitem, publisher);
- X RESET (bibitem, school);
- X RESET (bibitem, series);
- X RESET (bibitem, title);
- X RESET (bibitem, type);
- X RESET (bibitem, volume);
- X RESET (bibitem, year);
- X RESET (bibitem, comment);
- X RESET (bibitem, cross_ref);
- X for (i = 0; i != usr_defns_ctr; i++)
- X RESET (bibitem, usr_defns[i]);
- X
- X return 0;
- X}
- X
- X
- Xinitialise (bibitem)
- Xbibrec *bibitem;
- X
- X{
- Xchar *BIBCINIT, *getenv();
- Xchar *qmark, *colon, *userhlp, *userkey, *nextkey;
- X
- X resetall (bibitem);
- X
- X#define STORHELP(VAR,FIELD,VALUE,HELP) \
- X { \
- X Strcpy ((VAR)->FIELD.prompt, VALUE); \
- X Strcpy ((VAR)->FIELD.helpstring, HELP); \
- X }
- X
- X STORHELP (bibitem, rectype, "", "" );
- X STORHELP (bibitem, citekey, "CITEKEY",
- X"The key used to cross reference with the \cite command in the\n\
- X main text." );
- X STORHELP (bibitem, address, "ADDRESS",
- X"Publisher's address.For major publishing houses, just the city\n\
- X is given, for smaller publishers, you might choose to give the\n\
- X full address." );
- X STORHELP (bibitem, author, "AUTHOR",
- X"The name(s) of the author(s). Separate multiple authors by the\n\
- X keyword 'and'. See the LaTeX manual for more help." );
- X STORHELP (bibitem, annote, "ANNOTE",
- X"An annotation. Not used in the standard bibliography styles, but\n\
- X may be used by others." );
- X STORHELP (bibitem, booktitle, "BOOKTITLE",
- X"Title of the book, part of which is being cited." );
- X STORHELP (bibitem, chapter, "CHAPTER",
- X"A chapter number." );
- X STORHELP (bibitem, edition, "EDITION",
- X"The edition of the book--for example, 'second'." );
- X STORHELP (bibitem, editor, "EDITOR",
- X"Name(s) of editor(s), typed as in the author field. If the author\n\
- X is also indicated, then this field gives the editor of the book or\n\
- X collection in which the refernce appears." );
- X STORHELP (bibitem, howpublished, "HOWPUBLISHED",
- X"How something strange has been published." );
- X STORHELP (bibitem, institution, "INSTITUTION",
- X"The institution that published the work." );
- X STORHELP (bibitem, journal, "JOURNAL",
- X"The name of a journal." );
- X STORHELP (bibitem, key, "KEY",
- X"Used for alphabetising and creating a label when the author and\n\
- X editor fields are missing." );
- X STORHELP (bibitem, month, "MONTH",
- X"The month in which the work was published. For an unpublished\n\
- X work, the month in which it was written." );
- X STORHELP (bibitem, note, "NOTE",
- X"Any additional information that can help the reader." );
- X STORHELP (bibitem, number, "NUMBER",
- X"The number of a journal, magazine or technical report." );
- X STORHELP (bibitem, organisation, "ORGANISATION",
- X"The organisation sponsoring the conference." );
- X STORHELP (bibitem, pages, "PAGES",
- X"One or more page numbers, or range of page numbers, as 42--111,\n\
- X or 7,41,73--97." );
- X STORHELP (bibitem, publisher, "PUBLISHER",
- X"The publisher's name." );
- X STORHELP (bibitem, school, "SCHOOL",
- X"The name of the school in which the thesis was written." );
- X STORHELP (bibitem, series, "SERIES",
- X"The name of a series or set of books." );
- X STORHELP (bibitem, title, "TITLE",
- X"The work's title" );
- X STORHELP (bibitem, type, "TYPE",
- X"The type of a technical report, for example, 'Research Note'." );
- X STORHELP (bibitem, volume, "VOLUME",
- X"The volume of a journal or multivolume work." );
- X STORHELP (bibitem, year, "YEAR",
- X"The year of publication, or for an unpublished work, the year in\n\
- X which it was written." );
- X STORHELP (bibitem, comment, "COMMENT",
- X"Any relevant info associated with this record that you would like\n\
- X to store herein." );
- X STORHELP (bibitem, cross_ref, "CROSS-REFERENCE",
- X"used to fill in missing field info in this record from the\n\
- X cross-referenced bib-record..see BiBTeXing manual for more help.");
- X/*
- X * Now that the standard fields are defined, see if the user would like
- X * to define specific fields for themselves. Such fields are specified
- X * by the user in tthe BIBCINIT environment variables. The format of
- X * his variable shall be similiar to the MAILPATH variable used by the
- X * korn shell, as....
- X * <fieldname>?<optional help string>
- X * multiple fields shall be separated by <COLON>s, ':'
- X * A maximum of USR_DEFNS_MAX is taken....
- X */
- X BIBCINIT = getenv ("BIBCINIT");
- X if (BIBCINIT)
- X {
- X userkey = BIBCINIT;
- X while (userkey != (char *) NULL)
- X {
- X nextkey = (char *) NULL;
- X userhlp = DEFAULT_USERHLP;
- X if ((colon = Index (userkey, ':')) != (char *) NULL)
- X {
- X nextkey = colon + 1;
- X *colon = '\0';
- X }
- X if ((qmark = Index (userkey, '?')) != (char *) NULL)
- X {
- X userhlp = qmark + 1;
- X *qmark = '\0';
- X }
- X STORHELP (bibitem, usr_defns[usr_defns_ctr], userkey, userhlp);
- X usr_defns_ctr++;
- X if (usr_defns_ctr < USR_DEFNS_MAX)
- X userkey = nextkey;
- X else
- X userkey = (char *) NULL /* quit while we are ahead ;-) */;
- X if (qmark != (char *) NULL) *qmark = '?';
- X if (colon != (char *) NULL) *colon = ':';
- X qmark = colon = (char *) NULL;
- X }
- X }
- X#undef STORHELP
- X return 0;
- X}
- X
- X
- Xprocess_args (argc, argv)
- Xint argc;
- Xchar *argv[];
- X
- X{
- X#define SHIFT i++
- X#define args(str) (! Strcmp (argv[i], str))
- X
- Xint i;
- Xchar error[80];
- X
- X for (i = 1; i < argc; SHIFT)
- X {
- X if (args ("-i") || args ("-verify"))
- X { _O_verify = _O_verbose = TRUE; continue; }
- X if args ("-verbose")
- X { _O_verbose = FALSE; continue; }
- X if args ("+verbose")
- X { _O_verbose = TRUE; continue; }
- X if args ("-pester")
- X { _O_pester_usr = FALSE; continue; }
- X if args ("+pester")
- X { _O_pester_usr = TRUE; continue; }
- X if args ("-help")
- X { _O_help = TRUE; continue; }
- X if args ("-file")
- X { SHIFT;
- X outfile = (FILE *) fopen (argv[i], "a");
- X if (outfile)
- X Strcpy (_O_outfilename, argv[i]);
- X else
- X {
- X Sprintf (error, "bibc: file %s could not be opened", argv[i]);
- X perror (error);
- X outfile = stdout;
- X }
- X continue;
- X }
- X /* default: */
- X {
- X Fprintf (stderr, "bibc: %s is an invalid argument\n", argv[i]);
- X _O_help = TRUE;
- X continue;
- X }
- X }
- X if (_O_help)
- X {
- X (void) usage ();
- X exit (0);
- X }
- X return 0;
- X#undef SHIFT
- X#undef args
- X}
- X#define USAGE "Usage: bibc [-i|-verify] [+|-verbose] [+|-pester] [-file <filename>] [-help]\n"
- X
- X
- Xusage ()
- X
- X{
- X Fprintf (stderr, USAGE);
- XFprintf (stderr, "\t-i\t\t\tInquire whether to commit a record\n");
- XFprintf (stderr, "\t-verify\t\t\tSame as above, a duplicate form\n");
- XFprintf (stderr, "\t-verbose\t\tTurn off verbose flag\n");
- XFprintf (stderr, "\t+verbose\t\tTurn on verbose flag\n");
- XFprintf (stderr, "\t-pester\t\t\tDo not insist, even for required fields\n");
- XFprintf (stderr, "\t+pester\t\t\tInsist once for required fields\n");
- XFprintf (stderr, "\t-file <filename>\tOutput bib entries to <filename>\n");
- XFprintf (stderr, "\t-help\t\t\tPrint this help output\n");
- X return 0;
- X}
- X
- EOFile inits.c
- chmod u=rw+,g=rw+,o=r++ inits.c
- echo '...done' 1>&2
- if [ ! -d . ] ; then
- echo -n Directory . not found. Creating....
- mkdir .
- if [ ! -d . ] ; then
- echo ...failed
- echo unable to create directory .. Please create the directory and try again
- exit
- fi
- echo ...done
- fi
- echo -n "lex.yy.c..." 1>&2
- if test -f lex.yy.c
- then
- case $# in
- 0)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- case $1 in
- -o) ;;
- *)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- fi
- sed 's/^X//' << 'EOFile lex.yy.c' > lex.yy.c
- X#define FLEX_COMPRESSED
- X/* A lexical scanner generated by flex */
- X
- X/* scanner skeleton version:
- X * $Header: flex.skel,v 1.1 89/05/24 00:32:10 vern Locked $
- X */
- X
- X#include <stdio.h>
- X
- X#define FLEX_SCANNER
- X
- X/* returned upon end-of-file */
- X#define YY_END_TOK 0
- X
- X/* amount of stuff to slurp up with each read */
- X#define YY_READ_BUF_SIZE 8192
- X
- X#define YY_BUF_SIZE (YY_READ_BUF_SIZE * 2) /* size of input buffer */
- X
- X/* number of characters one rule can match. One less than YY_BUF_SIZE to make
- X * sure we never access beyond the end of an array
- X */
- X#define YY_BUF_MAX (YY_BUF_SIZE - 1)
- X
- X/* copy whatever the last rule matched to the standard output */
- X
- X#define ECHO fputs( yytext, yyout )
- X
- X/* gets input and stuffs it into "buf". number of characters read, or YY_NULL,
- X * is returned in "result".
- X */
- X#define YY_INPUT(buf,result,max_size) \
- X if ( (result = read( fileno(yyin), buf, max_size )) < 0 ) \
- X YY_FATAL_ERROR( "read() in flex scanner failed" );
- X#define YY_NULL 0
- X
- X/* report a fatal error */
- X#define YY_FATAL_ERROR(msg) \
- X { \
- X fputs( msg, stderr ); \
- X putc( '\n', stderr ); \
- X exit( 1 ); \
- X }
- X
- X/* default yywrap function - always treat EOF as an EOF */
- X#define yywrap() 1
- X
- X/* enter a start condition. This macro really ought to take a parameter,
- X * but we do it the disgusting crufty way that old Unix-lex does it
- X */
- X#define BEGIN yy_start = 1 +
- X
- X/* default declaration of generated scanner - a define so the user can
- X * easily add parameters
- X */
- X#define YY_DECL int yylex()
- X
- X/* code executed at the end of each rule */
- X#define YY_BREAK break;
- X
- X#define YY_END_OF_BUFFER_CHAR 0
- X
- X/* done after the current pattern has been matched and before the
- X * corresponding action - sets up yytext
- X */
- X#define YY_DO_BEFORE_ACTION \
- X yytext = yy_bp; \
- X yy_hold_char = *yy_cp; \
- X *yy_cp = '\0'; \
- X yy_c_buf_p = yy_cp;
- X
- X/* returns the length of the matched text */
- X#define yyleng (yy_cp - yy_bp)
- X
- X#define EOB_ACT_RESTART_SCAN 0
- X#define EOB_ACT_END_OF_FILE 1
- X#define EOB_ACT_LAST_MATCH 2
- X
- X/* return all but the first 'n' matched characters back to the input stream */
- X#define yyless(n) \
- X { \
- X *yy_cp = yy_hold_char; /* undo effects of setting up yytext */ \
- X yy_c_buf_p = yy_cp = yy_bp + n; \
- X YY_DO_BEFORE_ACTION; /* set up yytext again */ \
- X }
- X
- X#define unput(c) yyunput( c, yy_bp )
- X
- X#define YY_USER_ACTION
- X
- X# line 1 "bibl.l"
- X#define INITIAL 0
- X# line 2 "bibl.l"
- X
- X/*
- X * This program has been written by Kannan Varadhan. You are welcome to
- X * use, copy, modify, or circulate as you please, provided you do not
- X * charge any fee for any of it, and you do not remove these header
- X * comments from any of these files.
- X *
- X * -- kva Mon Dec 4 11:26:37 EST 1989
- X */
- X
- X#include "bibc.h"
- X#undef YY_INPUT
- X#define YY_INPUT(buf,reslt,msize) my_input (buf, &reslt, msize)
- X
- Xmy_input (buf,reslt, size)
- Xchar *buf;
- Xint *reslt;
- Xint size;
- X
- X{
- Xchar inputln[80];
- X
- X bzero (inputln, 80);
- X if (! GETS (inputln, 80))
- X Strcpy (buf, "EOF");
- X else
- X Strncpy (buf, inputln, size);
- X Strcat (buf, "!");
- X#ifdef FLEX_DEBUG
- X Fprintf (stderr, "buf contains: %s\n", buf);
- X#endif
- X return *reslt = strlen (buf);
- X}
- X
- X
- Xmy_yylex ()
- X
- X{
- X#define PROMPTSTR "\
- XWhat kind of record would you like to enter (one of the following)?\n\
- X article book booklet conference\n\
- X inbook incollection inproceedings manual\n\
- X mastersthesis msthesis misc phdthesis\n\
- X proceedings techreport unpublished\n\
- Xor EDIT quit\n"
- X
- X Fprintf (stderr, PROMPTSTR);
- X return yylex ();
- X}
- X
- X# line 54 "bibl.l"
- X#define YY_END_OF_BUFFER 116
- Xtypedef int yy_state_type;
- Xstatic short int yy_accept[251] =
- X { 0,
- X 0, 0, 116, 115, 114, 115, 115, 115, 115, 115,
- X 115, 115, 115, 115, 115, 115, 114, 0, 0, 0,
- X 1, 0, 0, 12, 0, 0, 0, 0, 0, 0,
- X 0, 0, 90, 0, 100, 0, 0, 0, 2, 0,
- X 0, 13, 0, 0, 0, 0, 0, 0, 69, 0,
- X 62, 0, 72, 0, 80, 0, 0, 91, 0, 101,
- X 0, 0, 112, 3, 0, 0, 14, 0, 22, 0,
- X 26, 0, 36, 0, 47, 0, 51, 0, 70, 0,
- X 63, 0, 73, 0, 81, 0, 0, 92, 0, 102,
- X 0, 113, 4, 0, 8, 0, 15, 0, 23, 0,
- X
- X 27, 0, 37, 0, 48, 0, 52, 0, 71, 64,
- X 0, 74, 0, 82, 0, 111, 93, 0, 103, 0,
- X 5, 0, 9, 0, 16, 0, 24, 0, 28, 0,
- X 38, 0, 49, 0, 53, 0, 65, 0, 75, 0,
- X 83, 0, 94, 0, 104, 0, 6, 0, 10, 0,
- X 17, 0, 25, 29, 0, 39, 0, 50, 54, 0,
- X 66, 0, 76, 0, 84, 0, 95, 0, 105, 0,
- X 7, 11, 18, 0, 30, 0, 40, 0, 55, 0,
- X 67, 0, 77, 0, 85, 0, 96, 0, 106, 0,
- X 19, 0, 31, 0, 41, 0, 56, 0, 68, 78,
- X
- X 0, 86, 0, 97, 0, 107, 0, 20, 0, 32,
- X 0, 42, 0, 57, 0, 79, 87, 0, 98, 0,
- X 108, 0, 21, 33, 0, 43, 0, 58, 0, 88,
- X 0, 99, 109, 0, 34, 0, 44, 0, 59, 0,
- X 89, 110, 35, 45, 0, 60, 0, 46, 61, 0
- X } ;
- X
- Xstatic char yy_ec[128] =
- X { 0,
- X 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- X 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- X 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- X 1, 1, 2, 1, 1, 1, 1, 1, 1, 1,
- X 1, 1, 1, 1, 1, 1, 1, 3, 3, 3,
- X 3, 3, 3, 3, 3, 3, 3, 1, 1, 1,
- X 1, 1, 1, 1, 3, 3, 3, 4, 5, 6,
- X 3, 3, 7, 3, 3, 3, 3, 3, 8, 3,
- X 3, 3, 3, 9, 3, 3, 3, 3, 3, 3,
- X 1, 1, 1, 1, 1, 1, 10, 11, 12, 13,
- X
- X 14, 15, 16, 17, 18, 3, 19, 20, 21, 22,
- X 23, 24, 25, 26, 27, 28, 29, 3, 3, 3,
- X 3, 3, 1, 1, 1, 1, 1
- X } ;
- X
- Xstatic char yy_meta[30] =
- X { 0,
- X 1, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- X 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- X 2, 2, 2, 2, 2, 2, 2, 2, 2
- X } ;
- X
- Xstatic short int yy_base[252] =
- X { 0,
- X 0, 0, 279, 280, 280, 276, 28, 29, 31, 33,
- X 35, 32, 36, 37, 38, 39, 280, 275, 41, 43,
- X 280, 42, 44, 280, 49, 61, 56, 62, 58, 63,
- X 45, 72, 280, 67, 280, 73, 75, 274, 280, 78,
- X 79, 280, 80, 85, 86, 89, 90, 92, 280, 91,
- X 280, 97, 280, 98, 280, 99, 100, 280, 104, 280,
- X 102, 273, 280, 280, 105, 103, 280, 108, 280, 110,
- X 280, 114, 280, 116, 280, 122, 280, 111, 280, 272,
- X 280, 127, 280, 125, 280, 133, 269, 280, 128, 280,
- X 134, 280, 280, 135, 280, 136, 280, 138, 280, 141,
- X
- X 280, 142, 280, 144, 280, 146, 280, 147, 280, 280,
- X 149, 280, 151, 280, 155, 280, 280, 156, 280, 157,
- X 280, 161, 280, 150, 280, 165, 280, 268, 280, 166,
- X 280, 169, 280, 267, 280, 159, 280, 170, 280, 172,
- X 280, 179, 280, 180, 280, 182, 280, 266, 280, 265,
- X 280, 183, 280, 280, 185, 280, 187, 280, 280, 188,
- X 280, 190, 280, 189, 280, 191, 280, 192, 280, 193,
- X 280, 280, 280, 196, 280, 194, 280, 200, 280, 201,
- X 280, 264, 280, 208, 280, 209, 280, 210, 280, 212,
- X 280, 219, 280, 221, 280, 222, 280, 223, 280, 280,
- X
- X 263, 280, 225, 280, 217, 280, 224, 280, 262, 280,
- X 226, 280, 228, 280, 230, 280, 280, 232, 280, 259,
- X 280, 240, 280, 280, 241, 280, 242, 280, 244, 280,
- X 258, 280, 280, 254, 280, 253, 280, 245, 280, 246,
- X 280, 280, 280, 280, 252, 280, 250, 280, 280, 280,
- X 249
- X } ;
- X
- Xstatic short int yy_def[252] =
- X { 0,
- X 250, 1, 250, 250, 250, 251, 251, 251, 251, 251,
- X 251, 251, 251, 251, 251, 251, 250, 251, 251, 251,
- X 250, 251, 251, 250, 251, 251, 251, 251, 251, 251,
- X 251, 251, 250, 251, 250, 251, 251, 251, 250, 251,
- X 251, 250, 251, 251, 251, 251, 251, 251, 250, 251,
- X 250, 251, 250, 251, 250, 251, 251, 250, 251, 250,
- X 251, 251, 250, 250, 251, 251, 250, 251, 250, 251,
- X 250, 251, 250, 251, 250, 251, 250, 251, 250, 251,
- X 250, 251, 250, 251, 250, 251, 251, 250, 251, 250,
- X 251, 250, 250, 251, 250, 251, 250, 251, 250, 251,
- X
- X 250, 251, 250, 251, 250, 251, 250, 251, 250, 250,
- X 251, 250, 251, 250, 251, 250, 250, 251, 250, 251,
- X 250, 251, 250, 251, 250, 251, 250, 251, 250, 251,
- X 250, 251, 250, 251, 250, 251, 250, 251, 250, 251,
- X 250, 251, 250, 251, 250, 251, 250, 251, 250, 251,
- X 250, 251, 250, 250, 251, 250, 251, 250, 250, 251,
- X 250, 251, 250, 251, 250, 251, 250, 251, 250, 251,
- X 250, 250, 250, 251, 250, 251, 250, 251, 250, 251,
- X 250, 251, 250, 251, 250, 251, 250, 251, 250, 251,
- X 250, 251, 250, 251, 250, 251, 250, 251, 250, 250,
- X
- X 251, 250, 251, 250, 251, 250, 251, 250, 251, 250,
- X 251, 250, 251, 250, 251, 250, 250, 251, 250, 251,
- X 250, 251, 250, 250, 251, 250, 251, 250, 251, 250,
- X 251, 250, 250, 251, 250, 251, 250, 251, 250, 251,
- X 250, 250, 250, 250, 251, 250, 251, 250, 250, 0,
- X 250
- X } ;
- X
- Xstatic short int yy_nxt[310] =
- X { 0,
- X 4, 5, 6, 6, 7, 6, 6, 6, 6, 8,
- X 9, 10, 6, 6, 6, 6, 6, 11, 6, 6,
- X 12, 6, 6, 13, 14, 6, 6, 15, 16, 17,
- X 21, 19, 17, 17, 24, 20, 17, 17, 17, 33,
- X 35, 27, 17, 39, 17, 17, 55, 37, 38, 28,
- X 42, 34, 30, 23, 22, 25, 26, 17, 29, 51,
- X 36, 31, 17, 49, 53, 32, 41, 56, 58, 40,
- X 43, 44, 45, 17, 60, 54, 17, 47, 59, 64,
- X 17, 67, 48, 62, 46, 52, 69, 71, 50, 57,
- X 73, 75, 79, 77, 68, 65, 61, 66, 81, 83,
- X
- X 85, 17, 80, 90, 95, 88, 93, 70, 72, 97,
- X 86, 99, 107, 82, 74, 101, 94, 103, 76, 78,
- X 89, 98, 96, 105, 108, 84, 112, 87, 110, 117,
- X 91, 106, 100, 102, 114, 119, 121, 123, 104, 125,
- X 111, 113, 127, 129, 120, 131, 115, 133, 135, 124,
- X 137, 149, 139, 118, 122, 132, 141, 143, 145, 128,
- X 159, 130, 147, 126, 140, 134, 151, 154, 142, 144,
- X 156, 161, 136, 163, 148, 138, 146, 150, 152, 155,
- X 165, 167, 157, 169, 173, 160, 175, 162, 177, 179,
- X 183, 181, 185, 187, 189, 193, 176, 191, 164, 170,
- X
- X 178, 195, 197, 168, 174, 166, 184, 192, 186, 200,
- X 202, 204, 196, 206, 188, 180, 182, 198, 219, 190,
- X 208, 194, 210, 212, 214, 221, 217, 224, 207, 226,
- X 203, 228, 209, 230, 201, 205, 215, 222, 211, 213,
- X 218, 233, 235, 237, 220, 239, 244, 246, 225, 227,
- X 18, 249, 234, 248, 243, 242, 229, 238, 231, 241,
- X 232, 240, 236, 223, 216, 199, 172, 171, 158, 153,
- X 116, 245, 247, 109, 92, 63, 17, 17, 250, 3,
- X 250, 250, 250, 250, 250, 250, 250, 250, 250, 250,
- X 250, 250, 250, 250, 250, 250, 250, 250, 250, 250,
- X
- X 250, 250, 250, 250, 250, 250, 250, 250, 250
- X } ;
- X
- Xstatic short int yy_chk[310] =
- X { 0,
- X 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- X 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- X 1, 1, 1, 1, 1, 1, 1, 1, 1, 7,
- X 8, 7, 9, 12, 10, 7, 11, 13, 14, 15,
- X 16, 12, 19, 22, 20, 23, 31, 19, 20, 12,
- X 25, 15, 13, 9, 8, 10, 11, 27, 12, 29,
- X 16, 13, 26, 28, 30, 14, 23, 31, 34, 22,
- X 25, 26, 26, 32, 36, 30, 37, 27, 34, 40,
- X 41, 43, 27, 37, 26, 29, 44, 45, 28, 32,
- X 46, 47, 50, 48, 43, 40, 36, 41, 52, 54,
- X
- X 56, 57, 50, 61, 66, 59, 65, 44, 45, 68,
- X 56, 70, 78, 52, 46, 72, 65, 74, 47, 48,
- X 59, 68, 66, 76, 78, 54, 84, 57, 82, 89,
- X 61, 76, 70, 72, 86, 91, 94, 96, 74, 98,
- X 82, 84, 100, 102, 91, 104, 86, 106, 108, 96,
- X 111, 124, 113, 89, 94, 104, 115, 118, 120, 100,
- X 136, 102, 122, 98, 113, 106, 126, 130, 115, 118,
- X 132, 138, 108, 140, 122, 111, 120, 124, 126, 130,
- X 142, 144, 132, 146, 152, 136, 155, 138, 157, 160,
- X 164, 162, 166, 168, 170, 176, 155, 174, 140, 146,
- X
- X 157, 178, 180, 144, 152, 142, 164, 174, 166, 184,
- X 186, 188, 178, 190, 168, 160, 162, 180, 205, 170,
- X 192, 176, 194, 196, 198, 207, 203, 211, 190, 213,
- X 186, 215, 192, 218, 184, 188, 198, 207, 194, 196,
- X 203, 222, 225, 227, 205, 229, 238, 240, 211, 213,
- X 251, 247, 222, 245, 236, 234, 215, 227, 218, 231,
- X 220, 229, 225, 209, 201, 182, 150, 148, 134, 128,
- X 87, 238, 240, 80, 62, 38, 18, 6, 3, 250,
- X 250, 250, 250, 250, 250, 250, 250, 250, 250, 250,
- X 250, 250, 250, 250, 250, 250, 250, 250, 250, 250,
- X
- X 250, 250, 250, 250, 250, 250, 250, 250, 250
- X } ;
- X
- X/* the intent behind this definition is that it'll catch
- X * any uses of REJECT which flex missed
- X */
- X#define REJECT reject_used_but_not_detected
- X
- XFILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
- X
- X/* these variables are all declared out here so that section 3 code can
- X * manipulate them
- X */
- Xstatic char *yy_c_buf_p; /* points to current character in buffer */
- Xstatic int yy_init = 1; /* whether we need to initialize */
- Xstatic int yy_start = 0; /* start state number */
- X
- X/* true when we've seen an EOF for the current input file */
- Xstatic int yy_eof_has_been_seen;
- X
- Xstatic int yy_n_chars; /* number of characters read into yy_ch_buf */
- X
- X/* yy_ch_buf has to be 2 characters longer than YY_BUF_SIZE because we need
- X * to put in 2 end-of-buffer characters (this is explained where it is
- X * done) at the end of yy_ch_buf
- X */
- Xstatic char yy_ch_buf[YY_BUF_SIZE + 2];
- X
- X/* yy_hold_char holds the character lost when yytext is formed */
- Xstatic char yy_hold_char;
- Xchar *yytext;
- X
- Xstatic yy_state_type yy_last_accepting_state;
- Xstatic char *yy_last_accepting_cpos;
- X
- Xstatic yy_state_type yy_get_previous_state();
- Xstatic int yy_get_next_buffer();
- X
- Xstatic yyunput();
- Xstatic input();
- X
- XYY_DECL
- X {
- X register yy_state_type yy_current_state;
- X register char *yy_cp, *yy_bp;
- X register int yy_act;
- X
- X
- X
- X if ( yy_init )
- X {
- X if ( ! yy_start )
- X yy_start = 1; /* first start state */
- X
- X if ( ! yyin )
- X yyin = stdin;
- X
- X if ( ! yyout )
- X yyout = stdout;
- X
- Xnew_file:
- X /* this is where we enter upon encountering an end-of-file and
- X * yywrap() indicating that we should continue processing
- X */
- X
- X /* we put in the '\n' and start reading from [1] so that an
- X * initial match-at-newline will be true.
- X */
- X
- X yy_ch_buf[0] = '\n';
- X yy_n_chars = 1;
- X
- X /* we always need two end-of-buffer characters. The first causes
- X * a transition to the end-of-buffer state. The second causes
- X * a jam in that state.
- X */
- X yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
- X yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
- X
- X yy_eof_has_been_seen = 0;
- X
- X yytext = yy_c_buf_p = &yy_ch_buf[1];
- X yy_hold_char = *yy_c_buf_p;
- X yy_init = 0;
- X }
- X
- X while ( 1 ) /* loops until end-of-file is reached */
- X {
- X yy_cp = yy_c_buf_p;
- X
- X /* support of yytext */
- X *yy_cp = yy_hold_char;
- X
- X /* yy_bp points to the position in yy_ch_buf of the start of the
- X * current run.
- X */
- X yy_bp = yy_cp;
- X
- X yy_current_state = yy_start;
- X do
- X {
- X register char yy_c = yy_ec[*yy_cp];
- X if ( yy_accept[yy_current_state] )
- X {
- X yy_last_accepting_state = yy_current_state;
- X yy_last_accepting_cpos = yy_cp;
- X }
- X while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
- X {
- X yy_current_state = yy_def[yy_current_state];
- X if ( yy_current_state >= 251 )
- X yy_c = yy_meta[yy_c];
- X }
- X yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
- X ++yy_cp;
- X }
- X while ( yy_base[yy_current_state] != 280 );
- X
- X /* bogus while loop to let YY_BACK_TRACK and EOB_ACT_LAST_MATCH
- X * actions branch here without introducing an optimizer-daunting
- X * goto
- X */
- X while ( 1 )
- X {
- X yy_act = yy_accept[yy_current_state];
- X
- X YY_DO_BEFORE_ACTION;
- X YY_USER_ACTION;
- X
- X#ifdef FLEX_DEBUG
- X fprintf( stderr, "--accepting rule #%d (\"%s\")\n",
- X yy_act, yytext );
- X#endif
- X switch ( yy_act )
- X {
- X case 0: /* must backtrack */
- X /* undo the effects of YY_DO_BEFORE_ACTION */
- X *yy_cp = yy_hold_char;
- X yy_cp = yy_last_accepting_cpos;
- X yy_current_state = yy_last_accepting_state;
- X continue; /* go to "YY_DO_BEFORE_ACTION" */
- X
- Xcase 1:
- X# line 55 "bibl.l"
- Xreturn ARTICLE;
- X YY_BREAK
- Xcase 2:
- X# line 56 "bibl.l"
- Xreturn ARTICLE;
- X YY_BREAK
- Xcase 3:
- X# line 57 "bibl.l"
- Xreturn ARTICLE;
- X YY_BREAK
- Xcase 4:
- X# line 58 "bibl.l"
- Xreturn ARTICLE;
- X YY_BREAK
- Xcase 5:
- X# line 59 "bibl.l"
- Xreturn ARTICLE;
- X YY_BREAK
- Xcase 6:
- X# line 60 "bibl.l"
- Xreturn ARTICLE;
- X YY_BREAK
- Xcase 7:
- X# line 61 "bibl.l"
- Xreturn ARTICLE;
- X YY_BREAK
- Xcase 8:
- X# line 62 "bibl.l"
- Xreturn BOOK;
- X YY_BREAK
- Xcase 9:
- X# line 63 "bibl.l"
- Xreturn BOOKLET;
- X YY_BREAK
- Xcase 10:
- X# line 64 "bibl.l"
- Xreturn BOOKLET;
- X YY_BREAK
- Xcase 11:
- X# line 65 "bibl.l"
- Xreturn BOOKLET;
- X YY_BREAK
- Xcase 12:
- X# line 66 "bibl.l"
- Xreturn CONFERENCE;
- X YY_BREAK
- Xcase 13:
- X# line 67 "bibl.l"
- Xreturn CONFERENCE;
- X YY_BREAK
- Xcase 14:
- X# line 68 "bibl.l"
- Xreturn CONFERENCE;
- X YY_BREAK
- Xcase 15:
- X# line 69 "bibl.l"
- Xreturn CONFERENCE;
- X YY_BREAK
- Xcase 16:
- X# line 70 "bibl.l"
- Xreturn CONFERENCE;
- X YY_BREAK
- Xcase 17:
- X# line 71 "bibl.l"
- Xreturn CONFERENCE;
- X YY_BREAK
- Xcase 18:
- X# line 72 "bibl.l"
- Xreturn CONFERENCE;
- X YY_BREAK
- Xcase 19:
- X# line 73 "bibl.l"
- Xreturn CONFERENCE;
- X YY_BREAK
- Xcase 20:
- X# line 74 "bibl.l"
- Xreturn CONFERENCE;
- X YY_BREAK
- Xcase 21:
- X# line 75 "bibl.l"
- Xreturn CONFERENCE;
- X YY_BREAK
- Xcase 22:
- X# line 76 "bibl.l"
- Xreturn INBOOK;
- X YY_BREAK
- Xcase 23:
- X# line 77 "bibl.l"
- Xreturn INBOOK;
- X YY_BREAK
- Xcase 24:
- X# line 78 "bibl.l"
- Xreturn INBOOK;
- X YY_BREAK
- Xcase 25:
- X# line 79 "bibl.l"
- Xreturn INBOOK;
- X YY_BREAK
- Xcase 26:
- X# line 80 "bibl.l"
- Xreturn INCOLLECTION;
- X YY_BREAK
- Xcase 27:
- X# line 81 "bibl.l"
- Xreturn INCOLLECTION;
- X YY_BREAK
- Xcase 28:
- X# line 82 "bibl.l"
- Xreturn INCOLLECTION;
- X YY_BREAK
- Xcase 29:
- X# line 83 "bibl.l"
- Xreturn INCOLLECTION;
- X YY_BREAK
- Xcase 30:
- X# line 84 "bibl.l"
- Xreturn INCOLLECTION;
- X YY_BREAK
- Xcase 31:
- X# line 85 "bibl.l"
- Xreturn INCOLLECTION;
- X YY_BREAK
- Xcase 32:
- X# line 86 "bibl.l"
- Xreturn INCOLLECTION;
- X YY_BREAK
- Xcase 33:
- X# line 87 "bibl.l"
- Xreturn INCOLLECTION;
- X YY_BREAK
- Xcase 34:
- X# line 88 "bibl.l"
- Xreturn INCOLLECTION;
- X YY_BREAK
- Xcase 35:
- X# line 89 "bibl.l"
- Xreturn INCOLLECTION;
- X YY_BREAK
- Xcase 36:
- X# line 90 "bibl.l"
- Xreturn INPROCEEDINGS;
- X YY_BREAK
- Xcase 37:
- X# line 91 "bibl.l"
- Xreturn INPROCEEDINGS;
- X YY_BREAK
- Xcase 38:
- X# line 92 "bibl.l"
- Xreturn INPROCEEDINGS;
- X YY_BREAK
- Xcase 39:
- X# line 93 "bibl.l"
- Xreturn INPROCEEDINGS;
- X YY_BREAK
- Xcase 40:
- X# line 94 "bibl.l"
- Xreturn INPROCEEDINGS;
- X YY_BREAK
- Xcase 41:
- X# line 95 "bibl.l"
- Xreturn INPROCEEDINGS;
- X YY_BREAK
- Xcase 42:
- X# line 96 "bibl.l"
- Xreturn INPROCEEDINGS;
- X YY_BREAK
- Xcase 43:
- X# line 97 "bibl.l"
- Xreturn INPROCEEDINGS;
- X YY_BREAK
- Xcase 44:
- X# line 98 "bibl.l"
- Xreturn INPROCEEDINGS;
- X YY_BREAK
- Xcase 45:
- X# line 99 "bibl.l"
- Xreturn INPROCEEDINGS;
- X YY_BREAK
- Xcase 46:
- X# line 100 "bibl.l"
- Xreturn INPROCEEDINGS;
- X YY_BREAK
- Xcase 47:
- X# line 101 "bibl.l"
- Xreturn MANUAL;
- X YY_BREAK
- Xcase 48:
- X# line 102 "bibl.l"
- Xreturn MANUAL;
- X YY_BREAK
- Xcase 49:
- X# line 103 "bibl.l"
- Xreturn MANUAL;
- X YY_BREAK
- Xcase 50:
- X# line 104 "bibl.l"
- Xreturn MANUAL;
- X YY_BREAK
- Xcase 51:
- X# line 105 "bibl.l"
- Xreturn MASTERSTHESIS;
- X YY_BREAK
- Xcase 52:
- X# line 106 "bibl.l"
- Xreturn MASTERSTHESIS;
- X YY_BREAK
- Xcase 53:
- X# line 107 "bibl.l"
- Xreturn MASTERSTHESIS;
- X YY_BREAK
- Xcase 54:
- X# line 108 "bibl.l"
- Xreturn MASTERSTHESIS;
- X YY_BREAK
- Xcase 55:
- X# line 109 "bibl.l"
- Xreturn MASTERSTHESIS;
- X YY_BREAK
- Xcase 56:
- X# line 110 "bibl.l"
- Xreturn MASTERSTHESIS;
- X YY_BREAK
- Xcase 57:
- X# line 111 "bibl.l"
- Xreturn MASTERSTHESIS;
- X YY_BREAK
- Xcase 58:
- X# line 112 "bibl.l"
- Xreturn MASTERSTHESIS;
- X YY_BREAK
- Xcase 59:
- X# line 113 "bibl.l"
- Xreturn MASTERSTHESIS;
- X YY_BREAK
- Xcase 60:
- X# line 114 "bibl.l"
- Xreturn MASTERSTHESIS;
- X YY_BREAK
- Xcase 61:
- X# line 115 "bibl.l"
- Xreturn MASTERSTHESIS;
- X YY_BREAK
- Xcase 62:
- X# line 116 "bibl.l"
- Xreturn MASTERSTHESIS;
- X YY_BREAK
- Xcase 63:
- X# line 117 "bibl.l"
- Xreturn MASTERSTHESIS;
- X YY_BREAK
- Xcase 64:
- X# line 118 "bibl.l"
- Xreturn MASTERSTHESIS;
- X YY_BREAK
- Xcase 65:
- X# line 119 "bibl.l"
- Xreturn MASTERSTHESIS;
- X YY_BREAK
- Xcase 66:
- X# line 120 "bibl.l"
- Xreturn MASTERSTHESIS;
- X YY_BREAK
- Xcase 67:
- X# line 121 "bibl.l"
- Xreturn MASTERSTHESIS;
- X YY_BREAK
- Xcase 68:
- X# line 122 "bibl.l"
- Xreturn MASTERSTHESIS;
- X YY_BREAK
- Xcase 69:
- X# line 123 "bibl.l"
- Xreturn MISC;
- X YY_BREAK
- Xcase 70:
- X# line 124 "bibl.l"
- Xreturn MISC;
- X YY_BREAK
- Xcase 71:
- X# line 125 "bibl.l"
- Xreturn MISC;
- X YY_BREAK
- Xcase 72:
- X# line 126 "bibl.l"
- Xreturn PHDTHESIS;
- X YY_BREAK
- Xcase 73:
- X# line 127 "bibl.l"
- Xreturn PHDTHESIS;
- X YY_BREAK
- Xcase 74:
- X# line 128 "bibl.l"
- Xreturn PHDTHESIS;
- X YY_BREAK
- Xcase 75:
- X# line 129 "bibl.l"
- Xreturn PHDTHESIS;
- X YY_BREAK
- Xcase 76:
- X# line 130 "bibl.l"
- Xreturn PHDTHESIS;
- X YY_BREAK
- Xcase 77:
- X# line 131 "bibl.l"
- Xreturn PHDTHESIS;
- X YY_BREAK
- Xcase 78:
- X# line 132 "bibl.l"
- Xreturn PHDTHESIS;
- X YY_BREAK
- Xcase 79:
- X# line 133 "bibl.l"
- Xreturn PHDTHESIS;
- X YY_BREAK
- Xcase 80:
- X# line 134 "bibl.l"
- Xreturn PROCEEDINGS;
- X YY_BREAK
- Xcase 81:
- X# line 135 "bibl.l"
- Xreturn PROCEEDINGS;
- X YY_BREAK
- Xcase 82:
- X# line 136 "bibl.l"
- Xreturn PROCEEDINGS;
- X YY_BREAK
- Xcase 83:
- X# line 137 "bibl.l"
- Xreturn PROCEEDINGS;
- X YY_BREAK
- Xcase 84:
- X# line 138 "bibl.l"
- Xreturn PROCEEDINGS;
- X YY_BREAK
- Xcase 85:
- X# line 139 "bibl.l"
- Xreturn PROCEEDINGS;
- X YY_BREAK
- Xcase 86:
- X# line 140 "bibl.l"
- Xreturn PROCEEDINGS;
- X YY_BREAK
- Xcase 87:
- X# line 141 "bibl.l"
- Xreturn PROCEEDINGS;
- X YY_BREAK
- Xcase 88:
- X# line 142 "bibl.l"
- Xreturn PROCEEDINGS;
- X YY_BREAK
- Xcase 89:
- X# line 143 "bibl.l"
- Xreturn PROCEEDINGS;
- X YY_BREAK
- Xcase 90:
- X# line 144 "bibl.l"
- Xreturn TECHREPORT;
- X YY_BREAK
- Xcase 91:
- X# line 145 "bibl.l"
- Xreturn TECHREPORT;
- X YY_BREAK
- Xcase 92:
- X# line 146 "bibl.l"
- Xreturn TECHREPORT;
- X YY_BREAK
- Xcase 93:
- X# line 147 "bibl.l"
- Xreturn TECHREPORT;
- X YY_BREAK
- Xcase 94:
- X# line 148 "bibl.l"
- Xreturn TECHREPORT;
- X YY_BREAK
- Xcase 95:
- X# line 149 "bibl.l"
- Xreturn TECHREPORT;
- X YY_BREAK
- Xcase 96:
- X# line 150 "bibl.l"
- Xreturn TECHREPORT;
- X YY_BREAK
- Xcase 97:
- X# line 151 "bibl.l"
- Xreturn TECHREPORT;
- X YY_BREAK
- Xcase 98:
- X# line 152 "bibl.l"
- Xreturn TECHREPORT;
- X YY_BREAK
- Xcase 99:
- X# line 153 "bibl.l"
- Xreturn TECHREPORT;
- X YY_BREAK
- Xcase 100:
- X# line 154 "bibl.l"
- Xreturn UNPUBLISHED;
- X YY_BREAK
- Xcase 101:
- X# line 155 "bibl.l"
- Xreturn UNPUBLISHED;
- X YY_BREAK
- Xcase 102:
- X# line 156 "bibl.l"
- Xreturn UNPUBLISHED;
- X YY_BREAK
- Xcase 103:
- X# line 157 "bibl.l"
- Xreturn UNPUBLISHED;
- X YY_BREAK
- Xcase 104:
- X# line 158 "bibl.l"
- Xreturn UNPUBLISHED;
- X YY_BREAK
- Xcase 105:
- X# line 159 "bibl.l"
- Xreturn UNPUBLISHED;
- X YY_BREAK
- Xcase 106:
- X# line 160 "bibl.l"
- Xreturn UNPUBLISHED;
- X YY_BREAK
- Xcase 107:
- X# line 161 "bibl.l"
- Xreturn UNPUBLISHED;
- X YY_BREAK
- Xcase 108:
- X# line 162 "bibl.l"
- Xreturn UNPUBLISHED;
- X YY_BREAK
- Xcase 109:
- X# line 163 "bibl.l"
- Xreturn UNPUBLISHED;
- X YY_BREAK
- Xcase 110:
- X# line 164 "bibl.l"
- Xreturn UNPUBLISHED;
- X YY_BREAK
- Xcase 111:
- X# line 165 "bibl.l"
- Xreturn FLD_NULL;
- X YY_BREAK
- Xcase 112:
- X# line 166 "bibl.l"
- Xreturn FLD_NULL;
- X YY_BREAK
- Xcase 113:
- X# line 167 "bibl.l"
- Xreturn FLD_EDITOR;
- X YY_BREAK
- Xcase 114:
- X# line 168 "bibl.l"
- Xreturn FLD_ERROR;
- X YY_BREAK
- Xcase 115:
- X# line 169 "bibl.l"
- XECHO;
- X YY_BREAK
- X
- X case YY_END_OF_BUFFER:
- X /* undo the effects of YY_DO_BEFORE_ACTION */
- X *yy_cp = yy_hold_char;
- X
- X yytext = yy_bp;
- X
- X switch ( yy_get_next_buffer() )
- X {
- X case EOB_ACT_END_OF_FILE:
- X {
- X if ( yywrap() )
- X {
- X /* note: because we've taken care in
- X * yy_get_next_buffer() to have set up yytext,
- X * we can now set up yy_c_buf_p so that if some
- X * total hoser (like flex itself) wants
- X * to call the scanner after we return the
- X * YY_NULL, it'll still work - another YY_NULL
- X * will get returned.
- X */
- X yy_c_buf_p = yytext;
- X return ( YY_NULL );
- X }
- X
- X else
- X goto new_file;
- X }
- X break;
- X
- X case EOB_ACT_RESTART_SCAN:
- X yy_c_buf_p = yytext;
- X yy_hold_char = *yy_c_buf_p;
- X break;
- X
- X case EOB_ACT_LAST_MATCH:
- X yy_c_buf_p = &yy_ch_buf[yy_n_chars];
- X
- X yy_current_state = yy_get_previous_state();
- X
- X yy_cp = yy_c_buf_p;
- X yy_bp = yytext;
- X continue; /* go to "YY_DO_BEFORE_ACTION" */
- X }
- X break;
- X
- X default:
- X printf( "action # %d\n", yy_act );
- X YY_FATAL_ERROR( "fatal flex scanner internal error" );
- X }
- X
- X break; /* exit bogus while loop */
- X }
- X }
- X }
- X
- X
- X/* yy_get_next_buffer - try to read in new buffer
- X *
- X * synopsis
- X * int yy_get_next_buffer();
- X *
- X * returns a code representing an action
- X * EOB_ACT_LAST_MATCH -
- X * EOB_ACT_RESTART_SCAN - restart the scanner
- X * EOB_ACT_END_OF_FILE - end of file
- X */
- X
- Xstatic int yy_get_next_buffer()
- X
- X {
- X if ( yy_c_buf_p != &yy_ch_buf[yy_n_chars + 1] )
- X {
- X YY_FATAL_ERROR( "NULL in input" );
- X /*NOTREACHED*/
- X }
- X
- X else
- X { /* try to read more data */
- X register char *dest = yy_ch_buf;
- X register char *source = yytext - 1; /* copy prev. char, too */
- X register int number_to_move, i;
- X int ret_val;
- X
- X /* first move last chars to start of buffer */
- X number_to_move = yy_c_buf_p - yytext;
- X
- X for ( i = 0; i < number_to_move; ++i )
- X *(dest++) = *(source++);
- X
- X if ( yy_eof_has_been_seen )
- X /* don't do the read, it's not guaranteed to return an EOF,
- X * just force an EOF
- X */
- X yy_n_chars = 0;
- X
- X else
- X /* read in more data */
- X YY_INPUT( (&yy_ch_buf[number_to_move]), yy_n_chars,
- X YY_BUF_SIZE - number_to_move - 1 );
- X
- X if ( yy_n_chars == 0 )
- X {
- X if ( number_to_move == 1 )
- X ret_val = EOB_ACT_END_OF_FILE;
- X else
- X ret_val = EOB_ACT_LAST_MATCH;
- X
- X yy_eof_has_been_seen = 1;
- X }
- X
- X else
- X ret_val = EOB_ACT_RESTART_SCAN;
- X
- X yy_n_chars += number_to_move;
- X yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
- X yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
- X
- X /* yytext begins at the second character in
- X * yy_ch_buf; the first character is the one which
- X * preceded it before reading in the latest buffer;
- X * it needs to be kept around in case it's a
- X * newline, so yy_get_previous_state() will have
- X * with '^' rules active
- X */
- X
- X yytext = &yy_ch_buf[1];
- X
- X return ( ret_val );
- X }
- X }
- X
- X
- X/* yy_get_previous_state - get the state just before the EOB char was reached
- X *
- X * synopsis
- X * yy_state_type yy_get_previous_state();
- X */
- X
- Xstatic yy_state_type yy_get_previous_state()
- X
- X {
- X register yy_state_type yy_current_state;
- X register char *yy_cp;
- X
- X yy_current_state = yy_start;
- X
- X for ( yy_cp = yytext; yy_cp < yy_c_buf_p; ++yy_cp )
- X {
- X register char yy_c = yy_ec[*yy_cp];
- X if ( yy_accept[yy_current_state] )
- X {
- X yy_last_accepting_state = yy_current_state;
- X yy_last_accepting_cpos = yy_cp;
- X }
- X while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
- X {
- X yy_current_state = yy_def[yy_current_state];
- X if ( yy_current_state >= 251 )
- X yy_c = yy_meta[yy_c];
- X }
- X yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
- X }
- X
- X return ( yy_current_state );
- X }
- X
- X
- Xstatic yyunput( c, yy_bp )
- Xint c;
- Xregister char *yy_bp;
- X
- X {
- X register char *yy_cp = yy_c_buf_p;
- X
- X *yy_cp = yy_hold_char; /* undo effects of setting up yytext */
- X
- X if ( yy_cp < yy_ch_buf + 2 )
- X { /* need to shift things up to make room */
- X register int number_to_move = yy_n_chars + 2; /* +2 for EOB chars */
- X register char *dest = &yy_ch_buf[YY_BUF_SIZE + 2];
- X register char *source = &yy_ch_buf[number_to_move];
- X
- X while ( source > yy_ch_buf )
- X *--dest = *--source;
- X
- X yy_cp += dest - source;
- X yy_bp += dest - source;
- X
- X if ( yy_cp < yy_ch_buf + 2 )
- X YY_FATAL_ERROR( "flex scanner push-back overflow" );
- X }
- X
- X if ( yy_cp > yy_bp && yy_cp[-1] == '\n' )
- X yy_cp[-2] = '\n';
- X
- X *--yy_cp = c;
- X
- X YY_DO_BEFORE_ACTION; /* set up yytext again */
- X }
- X
- X
- Xstatic int input()
- X
- X {
- X int c;
- X char *yy_cp = yy_c_buf_p;
- X
- X *yy_cp = yy_hold_char;
- X
- X if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
- X { /* need more input */
- X yytext = yy_c_buf_p;
- X ++yy_c_buf_p;
- X
- X switch ( yy_get_next_buffer() )
- X {
- X /* this code, unfortunately, is somewhat redundant with
- X * that above
- X */
- X case EOB_ACT_END_OF_FILE:
- X {
- X if ( yywrap() )
- X {
- X yy_c_buf_p = yytext;
- X return ( EOF );
- X }
- X
- X yy_ch_buf[0] = '\n';
- X yy_n_chars = 1;
- X yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
- X yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
- X yy_eof_has_been_seen = 0;
- X yytext = yy_c_buf_p = &yy_ch_buf[1];
- X yy_hold_char = *yy_c_buf_p;
- X
- X return ( input() );
- X }
- X break;
- X
- X case EOB_ACT_RESTART_SCAN:
- X yy_c_buf_p = yytext;
- X break;
- X
- X case EOB_ACT_LAST_MATCH:
- X YY_FATAL_ERROR( "unexpected last match in input()" );
- X }
- X }
- X
- X c = *yy_c_buf_p;
- X yy_hold_char = *++yy_c_buf_p;
- X
- X return ( c );
- X }
- X# line 169 "bibl.l"
- X
- X
- EOFile lex.yy.c
- chmod u=rw+,g=r++,o=r++ lex.yy.c
- echo '...done' 1>&2
- if [ ! -d . ] ; then
- echo -n Directory . not found. Creating....
- mkdir .
- if [ ! -d . ] ; then
- echo ...failed
- echo unable to create directory .. Please create the directory and try again
- exit
- fi
- echo ...done
- fi
- echo -n "lexstrings.lex..." 1>&2
- if test -f lexstrings.lex
- then
- case $# in
- 0)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- case $1 in
- -o) ;;
- *)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- fi
- sed 's/^X//' << 'EOFile lexstrings.lex' > lexstrings.lex
- XARTICLE a article
- XBOOK book book
- XBOOKLET bookl booklet
- XCONFERENCE c conference
- XINBOOK inb inbook
- XINCOLLECTION inc incollection
- XINPROCEEDINGS inp inproceedings
- XMANUAL man manual
- XMASTERSTHESIS mas mastersthesis
- XMASTERSTHESIS ms msthesis
- XMISC mi misc
- XPHDTHESIS ph phdthesis
- XPROCEEDINGS pr proceesings
- XTECHREPORT t techreport
- XUNPUBLISHED u unpublished
- EOFile lexstrings.lex
- chmod u=rw+,g=r++,o=r++ lexstrings.lex
- echo '...done' 1>&2
- if [ ! -d . ] ; then
- echo -n Directory . not found. Creating....
- mkdir .
- if [ ! -d . ] ; then
- echo ...failed
- echo unable to create directory .. Please create the directory and try again
- exit
- fi
- echo ...done
- fi
- echo -n "lib_bib.c..." 1>&2
- if test -f lib_bib.c
- then
- case $# in
- 0)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- case $1 in
- -o) ;;
- *)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- fi
- sed 's/^X//' << 'EOFile lib_bib.c' > lib_bib.c
- X/*
- X * This program has been written by Kannan Varadhan. You are welcome to
- X * use, copy, modify, or circulate as you please, provided you do not
- X * charge any fee for any of it, and you do not remove these header
- X * comments from any of these files.
- X *
- X * -- kva Mon Dec 4 11:26:37 EST 1989
- X */
- X
- X#include "includes.h"
- X
- Xchar *curfile;
- Xchar **bibflist;
- Xchar *get_atsign();
- X
- Xchar *
- Xmy_gets (buffer, size)
- X/*
- X * This is an emulation of gets() using fgets.3
- X * This routine reads everything upto a newline, using fgets.3
- X *
- X * OUTPUT: Returns buffer on exit, (char *) NULL on error
- X * The contents of buffer are the input string, a max of (size -1)
- X * characters are filled on exit,
- X * The buffer is zeroed and returned on EOF.
- X *
- X * This routine only deals with EOF as an error cleanly. On any other
- X * error returned by fgets.3, this routine will return will return
- X * (char *) NULL and a partially filled buffer....*sigh*
- X *
- X * if EMUL_GETS is turned on, (it probably should, neh? :-) then
- X * it converts any trailing NEWLINE character ('\n') to
- a NIL ('\0')
- X * character, else, it leaves them alone
- X */
- Xchar *buffer;
- Xint size;
- X
- X#ifdef BUFSIZE
- X#undef BUFSIZE
- X#endif
- X#define BUFSIZE 512
- X#define EMUL_GETS
- X
- X{
- Xint sizeleft, cursize;
- Xchar lbuf[BUFSIZE]; /* These figures are unimportant...leave well alone */
- Xchar *foo, *answer;
- Xint done;
- X
- X sizeleft = size - 1;
- X bzero (buffer, size);
- X answer = buffer;
- X done = 0;
- X
- X while (done != 1)
- X {
- X if (fgets (lbuf, BUFSIZE, stdin) == (char *) NULL)
- X {
- X done = 1 /* EOF or ERROR */ ;
- X answer = (char *) NULL;
- X }
- X else if ((foo = Index (lbuf, '\n')) != (char *) NULL)
- X { /* DONE */
- X if (sizeleft > 0)
- X Strncat (answer, lbuf, sizeleft);
- X done = 1;
- X }
- X else if (sizeleft > 0)
- X { /* COPY */
- X cursize = strlen (lbuf);
- X if (cursize <= sizeleft)
- X {
- X Strncat (answer, lbuf, cursize);
- X sizeleft -= cursize;
- X }
- X else
- X {
- X Strncat (answer, lbuf, sizeleft);
- X sizeleft = 0;
- X }
- X }
- X }
- X
- X#ifdef EMUL_GETS
- X if ((foo = Index (answer, '\n')) != (char *) NULL)
- X *foo = '\0';
- X#endif
- X return answer;
- X}
- X
- X
- Xanswer (string, resp)
- X/*
- X * Display string, query user....return TRUE if answer = resp
- X */
- Xchar *string;
- Xchar resp;
- X
- X{
- Xchar buff[5];
- X
- X Fprintf (stderr, "%s [%c|%c] ", string, YES, NO);
- X fflush (stderr);
- X (void) GETS (buff, 5);
- X return ((*buff == resp) ? TRUE : FALSE );
- X}
- X
- X
- Xprocess_bibfiles (files, process_recd, onerror)
- X/*
- X * For each file in files,
- X * delineate_next_record
- X * process_record (file, record);
- X * if process_record() indicates error,
- X * onerror (open_file_descriptor);
- X * lseek to EOF
- X * cause exit()
- X */
- Xchar **files;
- Xint (*process_recd)(), (*onerror)();
- X
- X{
- Xchar *delineate_recd();
- Xint rdfd1;
- Xchar buffer[BUFSIZE+2], excess[RECSIZE], wkbuf[BUFSIZE + RECSIZE];
- Xint done, cc;
- Xchar *start, *next;
- X
- X done = FALSE;
- X bibflist = files;
- X rdfd1 = -1;
- X
- X Strcpy (excess, "");
- X while (! done)
- X {
- X bzero (buffer, sizeof(buffer));
- X if ((cc = read (rdfd1, buffer, BUFSIZE)) <=0)
- X {
- X if ((rdfd1 = get_next_file (rdfd1)) <= 0)
- X done = TRUE;
- X DASSERT (*excess == '\0');
- X continue;
- X }
- X Strcpy (wkbuf, excess);
- X Strncat (wkbuf, buffer, cc);
- X start = wkbuf;
- X while ((next = delineate_recd (start)) != (char *) NULL)
- X {
- X if ((*process_recd) (curfile, start) < 0)
- X {
- X (void) lseek (rdfd1, (long) (-1 * Strlen(next)), L_INCR);
- X if (onerror)
- X (*onerror) (rdfd1);
- X (void) lseek (rdfd1, 0L, L_XTND);
- X next = (char *) NULL;
- X done = TRUE; /* Abort; go to final cleanup, if any */
- X }
- X start = next;
- X }
- X Strcpy (excess, (start ? start : ""));
- X }
- X return 0;
- X}
- X
- X
- Xget_next_file (curfd)
- X/*
- X * Close current file descriptor;
- X * get next bib file from bibflist
- X * open file, and return new file descriptor;
- X */
- Xint curfd;
- X
- X{
- Xint retfd;
- X
- X close (curfd);
- X curfile = *bibflist++;
- X if (! curfile)
- X retfd = -1;
- X else if (Strcmp (curfile, "-") == SAME)
- X retfd = 0 /* stdin */;
- X else
- X retfd = open (curfile, O_RDONLY);
- X
- X return retfd;
- X}
- X
- X
- Xchar *
- Xlcase (string)
- X/*
- X * Lower case the given string
- X */
- Xchar *string;
- X
- X{
- Xchar *str, c;
- X
- X for (str = string ; *str; str++)
- X if (isupper (*str))
- X {
- X c = tolower (*str); /* I dunno, just being paranoid, I guess */
- X *str = c;
- X }
- X return string;
- X}
- X
- X
- Xchar *
- Xreplstr (str)
- X/*
- X * replicate the given string. get storage, and return the new string.
- X */
- Xchar *str;
- X
- X{
- Xchar *temp, *malloc();
- X
- X temp = (char *) malloc ((unsigned) (Strlen (str) + 1));
- X Strcpy (temp, str);
- X return temp;
- X}
- X
- X
- Xchar *
- Xdelineate_recd (string)
- X/*
- X * Get next record, using '\n@' as a flag per record.
- X * Match all braces,
- X * If record found, delineate current record by placing '\0' at end of
- X * current record, and return address of next record.
- X * else return (char *) NULL;
- X */
- Xchar *string;
- X
- X{
- Xchar *atsign, *start, *end;
- Xchar acount;
- X
- X if ((! string) || (! *string))
- X return (char *) NULL;
- X
- X start = Index (string, '@') + 1;
- X end = (char *) NULL;
- X atsign = get_atsign (start);
- X if (atsign)
- X *atsign = '\0';
- X
- X acount = strcount (start, OPEN_BRACE);
- X if (acount && (acount == strcount (start, CLOSE_BRACE)))
- X {
- X end = Rindex (start, CLOSE_BRACE) + 1;
- X *end = '\0';
- X if (atsign)
- X {
- X *atsign = '@';
- X end = atsign;
- X }
- X }
- X else
- X {
- X DASSERT (atsign == (char *) NULL);
- X }
- X return end;
- X}
- X
- Xstrcount (str, c)
- X/*
- X * Count the number of occurences of character 'c' in string "str"
- X */
- Xchar *str;
- Xchar c;
- X
- X{
- Xchar *temp;
- Xint count;
- X
- X temp = str;
- X count = 0;
- X
- X while (temp = Index (temp +1, c))
- X count++;
- X
- X return count;
- X}
- X
- X
- Xchar *
- Xget_atsign (str)
- X/*
- X * Get an atsign, check if it is preceeded by a newline
- X * If yes, return value,
- X * else repeat search
- X */
- Xchar *str;
- X
- X{
- Xchar *answer;
- X
- X answer = str;
- X while (answer = Index (answer, '@'))
- X if (*(answer-1) == '\n')
- X return answer;
- X else
- X answer++;
- X return answer;
- X}
- X
- X
- X#ifdef NOCASE
- XREGEXP *
- Xmy_rcomp (re)
- X/*
- X * STRATEGY: lcase the string inplace, and feed to regcomp(), return the
- X * value returned as is...
- X */
- Xchar *re;
- X
- X{
- X return regcomp (lcase (re));
- X}
- X
- X
- Xmy_rexec (prog, str)
- Xregexp *prog;
- X/*
- X * my_rexec = TRUE, if lcase (copy of str) contains given re
- X * = FALSE otherwise.
- X */
- Xchar *str;
- X
- X{
- Xchar *temp;
- Xint retval;
- X
- X temp = (char *) replstr (str);
- X (void) lcase (temp);
- X retval = regexec (prog, temp);
- X free (temp);
- X return retval;
- X}
- X#endif NOCASE
- X
- EOFile lib_bib.c
- chmod u=rw+,g=r++,o=r++ lib_bib.c
- echo '...done' 1>&2
- if [ ! -d . ] ; then
- echo -n Directory . not found. Creating....
- mkdir .
- if [ ! -d . ] ; then
- echo ...failed
- echo unable to create directory .. Please create the directory and try again
- exit
- fi
- echo ...done
- fi
- echo -n "misc/..." 1>&2
- if test -f misc/
- then
- case $# in
- 0)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- case $1 in
- -o) ;;
- *)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- fi
- sed 's/^X//' << 'EOFile misc/' > misc/
- EOFile misc/
- chmod otal 36
- u=rw+,g=r++,o=r++
- u=rw+,g=r++,o=r++
- u=rwx,g=r+x,o=r+x
- u=rw+,g=r++,o=r++ misc/
- echo '...done' 1>&2
- if [ ! -d . ] ; then
- echo -n Directory . not found. Creating....
- mkdir .
- if [ ! -d . ] ; then
- echo ...failed
- echo unable to create directory .. Please create the directory and try again
- exit
- fi
- echo ...done
- fi
- echo -n "omega.lex..." 1>&2
- if test -f omega.lex
- then
- case $# in
- 0)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- case $1 in
- -o) ;;
- *)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- fi
- sed 's/^X//' << 'EOFile omega.lex' > omega.lex
- X"quit!" return FLD_NULL;
- X"EOF!" return FLD_NULL;
- X"EDIT!" return FLD_EDITOR;
- X[a-zA-Z0-9]*! return FLD_ERROR;
- X%%
- X
- EOFile omega.lex
- chmod u=rw+,g=r++,o=r++ omega.lex
- echo '...done' 1>&2
- if [ ! -d . ] ; then
- echo -n Directory . not found. Creating....
- mkdir .
- if [ ! -d . ] ; then
- echo ...failed
- echo unable to create directory .. Please create the directory and try again
- exit
- fi
- echo ...done
- fi
- echo -n "pyr.regexp.a..." 1>&2
- if test -f pyr.regexp.a
- then
- case $# in
- 0)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- case $1 in
- -o) ;;
- *)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- fi
- sed 's/^X//' << 'EOFile pyr.regexp.a' > pyr.regexp.a
- X!<arch>
- Xregexp.o 621975704 1112 198 100644 9213 `
- XP` $hpp@p$!0 @@@>P@!" 1@"$1"0A"(",!0@@~p1$1P0@@~h@0p$P@!F"0p,!0 P@@>P@A0"0$0`@@>#@cp$!0 `@@>P@!" 1@"$ApR\!",!0@@~
- X|$p 1@@~`p 0 1@@~0@@~\ @ p$w@pA" TS!@" 2 &)p!0 |@@>P@p @p$A" 2 TpA" 2 T&)p$!0!@@>P@p !0!@@>P@PP@P@a0@@~ l#"p p0$0D@@~L @ p$P@S#1QP@"p$R#1Qp 01@@~
- X"A" 2 Tp
- X#p01@@~<p l R&*p$01@@~p@@~`10@@~ 01@@~x0@@~410@@~Tp@@~10@@~8p J R&+p$
- X#pp1@@~p = R&+p$0@@~4#0q@@~Pp@@~1@@~80@@~|1p@@~p@@~`10@@~p R&?p$01@@~X0@@~ 10@@~@p@@~#0q@@~ 0q@@~A" R!" 2 T&*p
- XA" TS!@" 2 0@@~,p BA" 2 T&-p$3A" S!@" R2 &]pA" 2 p$!0-@@~Hp A" B ~`A" 2!ApR p!0!P@@>P@p 0@@~l``p{A" R!" p
- XA" TS!@" 2 0@@~$A" 2 TpA" 2 T&]p$60@@~pA" 2 T&]p!0!d@@>P@A" S!@" 1#Qp *p1$1Tp@@~v$@ $p$P@ S#1QPp !0!t@@>P@p !0!@@>P@p
- A" 2 p$!0!@@>P@0@@~$A" R!" 2 0@@~<0@@~01#Qp kA" S!@" p!1!$@@~ "@"p,!0!0@@>P@A" 1r$2 #bp R&*p R&+p R&?p$ b1#Qbp$1#QP0@@~p$p A" R!" 2 0@@~$ b@"p,u0@@~p &p %0p&0$p~[&0(pt&0)p&0*p&0+p&0.p~Q&0?p~&0[p~T&0\p&0^p~;&0|pkp P@P@A ",&P "(p$A"0R!"0P@!R@!aa!aa!a!@",P@P@!"(FP",p A",TS!@",R@p A"0S!@"0P@!"(FP",p$A"0R!"0P@A ",A",S!@",ap a `!P`p,|bR@"ba"ba"bP@&P"(p$P@!p@@~P @ p$p !p x2 RRp$b bp b b0#"@!#"@!P@@p&P"(p2 pP@Ap0q@@~HP@@p@Qp$!0!D@@>P@B\&p!0!T@@>P@A@Tp`p 0A1TA2X@@>@0p$p
- X`AT2 10@@>@ p$n@ p$P@!@"8B Qp0q@@~$P@`B Ppp
- X01@@~x@0pPP@`B 1P0@@>@ p$qp
- XA"42 SpP@
- X0@@>'gp
- X0A1"4 r@@>@0pP@ SD"4!@"4p 6A"42 p
- XA"42 1App@@>@0p$P@A"4R!"4p !A"42 Tp
- XA"42 qApp@@>@0pP@A"4S!@"4p p p
- 2 c#A%"40@@~~0@0pA"<1J4p$A"<Q
- X9RPP@p P@p t2 d$A&"40@@~}X@0pA"@1JDp$A"@Q
- XIPP@p P@p ^2 pAp`p A,"4App@@~}l@0pPP@!"4p@@~T!@ap2 RplP@p @"2 p$B "2 Rp$+p kA*"4App@@~d)p pA"42 p$0@@~|(@0pPP@ i1r!"4
- Xip(lP@p PP@p !0!h@@>P@p
- Xp 0pw&0'p,tA0 0!@ap$!0!|@@>P@P@"A "4Ap!2 pp .0@@>" p /p b`2 S2 p{p 'p b`2 p2 1p@@>@0p$wp p b`2 p2 1p@@>@0pwp !0"@@>"p p ppx0p,vA0 0!"4P@P@&P"(p$P@B # B #`@ p$P@2 Sp$@1q4P@p 1rP@P@"!p `p 2 S`2 Sp$P@2 p$wba2 Sp$qP@P@8TXd0,\\444444444 X888NULL argumentregexp too bigout of spacetoo many ()unmatched ()unmatched ()junk on end*+ operand could be emptynested *?+invalid [] rangeunmatched []internal urp?+* follows nothingtrailing \^$.[()|?+*\internal disasterNULL param
-
-
- etercorrupted programmemory corruptioncorrupted pointersinternal foulup
- X$,4<@
- X,<
- Xhpp`lt
- X@LDHXpx
- X$<D
- XX`
- X 8
- X$@Xpx
- X ( 0 < X p
- X
- X
- X0
- XH
- XT
- Xp
- X
- X(
- XD
- XL
- X
- Xx 4Dh
- X$
- X$,
- X@PX
- Xx<HTpx
- X
- X (
- X`(htX $<Xp|4LXt|,DP\l$@\l4D(8t$
- XPhp
- X(x(<D
- Xht $(,048<@DHLPTX\`dhlptx| $(,04" "$"(!",*"03"4="8E"<P"@YblLrLwlx$-$8lB KVx_`hqxdx
- X_regparse_regnpar_regdummy_regcode_regsize_reginput_regbol_regstartp_regendp_regcomp_regerror_regc_reg_malloc_regnext_strlen_regnode_regbranch_regtail_regoptail_regpiece_regatom_reginsert_strcspn_regexec_strncmp_index_regtry_regmatch_regrepeat
- Xregsub.o 621975707 1112 198 100644 667 `
- XP `$8@p@Qp@p$!0@@>P@B\&p!0@@>P@`"p H S&&p$$p S&\p$2 &0p2 &9p,`2 d$$Pp d@ $p( S&\p$2 &\p2 &&p$2 !`R@bbp 1JDpAp(1JDTpAp(1
- XDc1
- XD c01
- XD1r@@>b@cp B p$!04@@>P@2 !` Sp$6a"bP@NULL parm to regsubdamaged regexp fed to regsubdamaged match string$DLLlt_regsub_regerror_strncpy
- Xregerror.o 622057384 1112 198 100644 243 `
- XP@ 0 Ap0(!12@@>p@@>P@regexp(3): %s$#_regerror__iob_fprintf_exit
- EOFile pyr.regexp.a
- chmod u=rw+,g=r++,o=r++ pyr.regexp.a
- echo '...done' 1>&2
- if [ ! -d . ] ; then
- echo -n Directory . not found. Creating....
- mkdir .
- if [ ! -d . ] ; then
- echo ...failed
- echo unable to create directory .. Please create the directory and try again
- exit
- fi
- echo ...done
- fi
- echo -n "specl.bst..." 1>&2
- if test -f specl.bst
- then
- case $# in
- 0)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- case $1 in
- -o) ;;
- *)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- fi
- sed 's/^X//' << 'EOFile specl.bst' > specl.bst
- X% BibTeX `plain' family
- X% BibTeX style: spec(ia)l
- X% specl.bst is a special bst file, which is used for keeping a private
- X% hardcopy of your bib file. Every bibitem that is generated has the same
- X% identity as the original \cite-key that is in the bib
- X% file...ferinstance...
- X%
- X% If the bib file contained..
- X%
- X% @BOOK{kn:gnus,
- X% foo,
- X% bar,
- X% baz}
- X%
- X% The bibitem record would look as
- X%
- X% \bibitem[kn:gnus]{rest of the stuff here}
- X%
- X% Hacked/Concieved/Designed by Kannan Varadhan 22/JUN/89
- X% email: kannan@cis.ohio-state.edu or ...{backbone}!osu-cis!kannan
- X% voice: {Res.} (614) 297-8720 | {Off.} (614) 292-8234 or 4-9099 on campus
- X% snail: Kannan Varadhan 306, W. Lane Ave., # 15, Columbus, OH 43201
- X%
- X%
- 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
- X
- XENTRY
- X { address
- X author
- X booktitle
- X chapter
- X edition
- X editor
- X howpublished
- X institution
- X journal
- X key
- 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
- XINTEGERS { output.state before.all mid.sentence after.sentence after.block }
- X
- XFUNCTION {init.state.consts}
- X{ #0 'before.all :=
- X #1 'mid.sentence :=
- X #2 'after.sentence :=
- X #3 'after.block :=
- X}
- X
- X
- XSTRINGS { s t }
- X
- XFUNCTION {output.nonnull}
- X{ 's :=
- 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 s
- X}
- X
- XFUNCTION {output}
- X{ duplicate$ empty$
- X 'pop$
- X 'output.nonnull
- 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
- XFUNCTION {output.bibitem}
- X{ newline$
- X
- X "\bibitem[" write$
- X label write$
- X "]{" write$
- X
- X cite$ write$
- X "}" write$
- X newline$
- X ""
- X before.all 'output.state :=
- X}
- X
- X
- XFUNCTION {fin.entry}
- X{ add.period$
- 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
- 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
- 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
- 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
- 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
- X { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't :=
- X
- 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
- X
- XFUNCTION {format.title}
- X{ title empty$
- X { "" }
- X
- X { title "t" change.case$ }
- X
- X if$
- X}
- X
- 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
- 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
- X
- XFUNCTION {format.btitle}
- X{ title emphasize
- X}
- X
- X
- XFUNCTION {tie.or.space.connect}
- X{ duplicate$ text.length$ #3 <
- X { "~" }
- X { " " }
- X if$
- X swap$ * *
- X}
- X
- X
- XFUNCTION {either.or.check}
- X{ empty$
- X 'pop$
- X { "can't use both " swap$ * " fields in " * cite$ * warning$ }
- X if$
- X}
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- X key empty$ not and
- X
- X { "all relevant fields are empty in " cite$ * warning$ }
- X 'skip$
- X if$
- X}
- X
- X
- XFUNCTION {format.thesis.type}
- X{ type empty$
- X 'skip$
- X { pop$
- X type "t" change.case$
- X }
- X if$
- X}
- 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
- 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
- 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
- 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
- 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
- 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 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 fin.entry
- X}
- 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 fin.entry
- X}
- X
- 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 fin.entry
- X}
- 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 fin.entry
- X}
- 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 fin.entry
- X}
- X
- X
- XFUNCTION {conference} { inproceedings }
- X
- 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 fin.entry
- X}
- 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 fin.entry
- X}
- 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 fin.entry
- X empty.misc.check
- X}
- 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 fin.entry
- X}
- 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 fin.entry
- X}
- 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 fin.entry
- X}
- 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 fin.entry
- X}
- X
- X
- XFUNCTION {default.type} { misc }
- X
- X
- X
- 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
- X
- X
- X
- X
- 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
- X
- X
- X
- XREAD
- X
- X
- X
- 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
- X
- X
- X
- 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
- X { cite$ #1 #3 substring$ }
- X
- 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
- X { cite$ #1 #3 substring$ }
- X
- 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
- X { cite$ #1 #3 substring$ }
- X
- 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
- X { cite$ #1 #3 substring$ }
- X
- 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{
- X
- X cite$ cite$
- X
- X 'label :=
- X year field.or.null purify$ #-1 #4 substring$
- X *
- X sortify 'sort.label :=
- X}
- X
- X
- X
- X
- X
- X
- X
- 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
- X s nameptr "{vv{ } }{ll{ }}{ ff{ }}{ jj{ }}" format.name$ 't :=
- X
- 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
- 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
- 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
- X
- XFUNCTION {presort}
- X
- X{ calc.label
- X sort.label
- X " "
- X *
- X type$ "book" =
- X
- 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 " "
- X *
- X year field.or.null sortify
- X *
- X " "
- X *
- X title field.or.null
- X sort.format.title
- X *
- X #1 entry.max$ substring$
- X 'sort.key$ :=
- X}
- X
- XITERATE {presort}
- X
- X
- XSORT
- X
- X
- X
- X
- X
- X
- X
- 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
- X
- X
- X
- X
- X
- XFUNCTION {begin.bib}
- X
- X{ et.al.char.used
- X { "\newcommand{\etalchar}[1]{$^{#1}$}" write$ newline$ }
- X 'skip$
- X if$
- X preamble$ empty$
- X
- 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
- X
- XITERATE {call.type$}
- X
- X
- XFUNCTION {end.bib}
- X{ newline$
- X "\end{thebibliography}" write$ newline$
- X}
- X
- XEXECUTE {end.bib}
- EOFile specl.bst
- chmod u=rw+,g=r++,o=r++ specl.bst
- echo '...done' 1>&2
- if [ ! -d . ] ; then
- echo -n Directory . not found. Creating....
- mkdir .
- if [ ! -d . ] ; then
- echo ...failed
- echo unable to create directory .. Please create the directory and try again
- exit
- fi
- echo ...done
- fi
- echo -n "strings.h..." 1>&2
- if test -f strings.h
- then
- case $# in
- 0)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- case $1 in
- -o) ;;
- *)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- fi
- sed 's/^X//' << 'EOFile strings.h' > strings.h
- X/*
- X * This program has been written by Kannan Varadhan. You are welcome to
- X * use, copy, modify, or circulate as you please, provided you do not
- X * charge any fee for any of it, and you do not remove these header
- X * comments from any of these files.
- X *
- X * -- kva Mon Dec 4 11:26:37 EST 1989
- X */
- X
- X#include <strings.h>
- X
- X#define Index (char *) index
- X#define Rindex (char *) rindex
- X#define Strcpy (void *) strcpy
- X#define Strncpy (void *) strncpy
- X#define Strcat (void *) strcat
- X#define Strncat (void *) strncat
- X#define Strcmp (int) strcmp
- X#define Strlen (int) strlen
- X
- X#define Sprintf (void) sprintf
- X#define Fprintf (void) fprintf
- EOFile strings.h
- chmod u=rw+,g=r++,o=r++ strings.h
- echo '...done' 1>&2
- if [ ! -d . ] ; then
- echo -n Directory . not found. Creating....
- mkdir .
- if [ ! -d . ] ; then
- echo ...failed
- echo unable to create directory .. Please create the directory and try again
- exit
- fi
- echo ...done
- fi
- echo -n "sun.regexp.a..." 1>&2
- if test -f sun.regexp.a
- then
- case $# in
- 0)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- case $1 in
- -o) ;;
- *)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- fi
- sed 's/^X//' << 'EOFile sun.regexp.a' > sun.regexp.a
- X!<arch>
- X__.SYMDEF 628639319 1112 198 100644 76 `
- X J>$_regexec_regcomp_regsub_regerrorregexp.o 628639016 1112 198 100644 6781 `
- X0@$hpNVlHW8J.fHy0ajXOp`\#np~#GtB9#|x|HxN9 HXOHn|B'N9POJg9mHy>a
- XOp`| 9~\P/apXO*@J
- XfR-Q.gFK~`4f"Hla~:XO0mGlHla~&XO.HTN94XO(@JfH+KR+GV
- XtmHyZa~PXOp`F.9tR9t rP/N9 XO*@`MHn|N9
- XXO(@Jg J
- XXO(@Jfp`lHTHUN9 BPO.f nr~C n.r@ yp|g,J.g ~P`p/N9 XO&@HSHUN9 BPO(M`HSHTN9
- XPOHTN94XO(@JfdJ.g$ ypR9p)gHyfa}LXOp`BJ.f: ypJg0 yp)fHysa}XOp`Hya}XOp`
- XN9 t`B*fdHUHxN9 tPOHxN9 XO/HUN9
- XPOHUHUN9
- XPOHxN9 XO/HUN9 BPOHx N9 XO/HUN9 B`X+f.gHUHxN9 t`:+fbHxN9 XO(@HTHUN9 BPOHUHxN9 XO/N9 BPOHxN9 XO/HTN9 BPOHx N9 XO/HUN9 B`P?fLHUHxN9 tPOHxN9 XO/HUN9 BPOHx N9 XO(@HTHUN9 BPOHTHUN9
- XPOR9p yp*g yp+g yp?fHy&azFXOp`
- XOp` yp0xr>o*g+g?fS n|
- XBBSJnv .~[P/N9@XOJg n . n!y(p`pLn0tN^NuNVhHW0`*n`HUN94XO-@|I@~'0bj0;
- XN{,PdtR~26
- 2~~`````````:::::::::`vvvvvvvvv 909g
- X` yJgz` yJgR9``Im y0ffHTasnXO.|>o//9HTasTOoJf:_9` yJg$ yI@/HmasPOJf.` yJgx yI@/HmarrPOJfZR9`8`4`0I@~.(y/.|a~~XOJg( yJ0|f
- X y!|p`I@~.(y/.|a~BXOJgl yJ0|f
- X y!|p`R n|gAm-H|`"(yHma}zXOJfP#LHUN94XO*@J
- Xfp`p*(yHmN9~XO,<mLJg
- X y>f/.|a}XOJf\SAth#H`PHy:`*n|J
- XN{(FddHUaqBXO.[G`X0fRRR
- ZPf@"@*@0P>@D@R@d@z@@@B@`@n@~@@@"@.@4PF@P@\@bPn@tP@,@8@H@@
- @@<@P@@
- XP>@T@`@l@x@@@@(@F@Z@h@v@@@@$@0@D@P@\@h@v@@
- @@@(@4@:P`@j@,@>@P@f@v@@@@$@>@L@X@^@j@t@@@P*@8@@@F@R@Z@h@p@|@P@N@TPb@hPv@@P@"@(@4@>@R@X@^@d@p@vP@@@L@R@^@n@ @ @ &@ 8@ N@ R@ Z@ d@ l@ ~@ @
- @ @ @ @ L@ `@
- X*@
- Xh@
- XnP
- X@
- XP
- X.P
- XJ P
- X\@
- Xl@ P@.@X@`@n@@*@T@D@J@X@h@t@@P$@,P<@F@R@b Pr@~@
- @
- @>Pd P P@P$@B@L @(|1p;DI~T[ Bd Hj
- Xuxt
- XN| t%.7.APJT^fnv
- X4_regtry_regnode_regmatch_strncmp_regcode_regparse_regsize_reg_regrepeat_index_regtail_regc_regoptail_regdummy_regnpar_regexec_strcspn_reginsert_regcomp_regendp_regpiece_regatom_regerror_reginput_regbol_malloc_strlen_regbranch_regstartp_regnext
- Xregsub.o 628639027 1112 198 100644 439 `
- XdH$(NVlHW0`J.gJ.gJ.f
- XHyd` np(Zg
- XHyx`*n(n`\f\g&fGfnB``0m\9nVI@|0,mJ`| nJ0lgRJ0l(gL*0l(0l//0lHTaZOoYEJg,J,f&Hya>XOLn0`lN^Nu&g*\g
- `jNULL parm to regsubdamaged regexp fed to regsubdamaged match string@8@&P<@BP
- Xregerror.o 628639273 1112 198 100644 219 `
- X80 NV_|HW/.Hy8Hy(a`OoHxaRXON^Nuregexp(3): %s@P P.P
- X#_exit_fprintf_regerror__iob
- EOFile sun.regexp.a
- chmod u=rw+,g=r++,o=r++ sun.regexp.a
- echo '...done' 1>&2
- if [ ! -d . ] ; then
- echo -n Directory . not found. Creating....
- mkdir .
- if [ ! -d . ] ; then
- echo ...failed
- echo unable to create directory .. Please create the directory and try again
- exit
- fi
- echo ...done
- fi
- echo -n "templates.c..." 1>&2
- if test -f templates.c
- then
- case $# in
- 0)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- case $1 in
- -o) ;;
- *)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- fi
- sed 's/^X//' << 'EOFile templates.c' > templates.c
- X/*
- X * This program has been written by Kannan Varadhan. You are welcome to
- X * use, copy, modify, or circulate as you please, provided you do not
- X * charge any fee for any of it, and you do not remove these header
- X * comments from any of these files.
- X *
- X * -- kva Mon Dec 4 11:26:37 EST 1989
- X */
- X
- X#include "bibc.h"
- X
- Xint i;
- X#define GET_USR_DEFNS \
- X for (i = 0; i != usr_defns_ctr; i++) \
- X GET (&bibitem, usr_defns[i], OPTIONAL)
- X
- Xget_article ()
- X
- X{
- X SET (&bibitem, rectype, "ARTICLE");
- X GET (&bibitem, citekey, REQUIRED);
- X GET (&bibitem, author, REQUIRED);
- X GET (&bibitem, title, REQUIRED);
- X GET (&bibitem, journal, REQUIRED);
- X GET (&bibitem, year, REQUIRED);
- X GET (&bibitem, volume, OPTIONAL);
- X GET (&bibitem, number, OPTIONAL);
- X GET (&bibitem, pages, OPTIONAL);
- X GET (&bibitem, month, OPTIONAL);
- X GET (&bibitem, note, OPTIONAL);
- X GET (&bibitem, key, OPTIONAL);
- X GET (&bibitem, comment, OPTIONAL);
- X GET (&bibitem, cross_ref, OPTIONAL);
- X GET_USR_DEFNS;
- X return 0;
- X}
- X
- Xget_book ()
- X
- X{
- X SET (&bibitem, rectype, "BOOK");
- X GET (&bibitem, citekey, REQUIRED);
- X GET (&bibitem, author, REQUIRED);
- X GET (&bibitem, title, REQUIRED);
- X GET (&bibitem, publisher, REQUIRED);
- X GET (&bibitem, year, REQUIRED);
- X GET (&bibitem, volume, OPTIONAL);
- X GET (&bibitem, series, OPTIONAL);
- X GET (&bibitem, address, OPTIONAL);
- X GET (&bibitem, edition, OPTIONAL);
- X GET (&bibitem, month, OPTIONAL);
- X GET (&bibitem, note, OPTIONAL);
- X GET (&bibitem, key, OPTIONAL);
- X GET (&bibitem, comment, OPTIONAL);
- X GET (&bibitem, cross_ref, OPTIONAL);
- X GET_USR_DEFNS;
- X return 0;
- X}
- X
- Xget_booklet ()
- X
- X{
- X SET (&bibitem, rectype, "BOOKLET");
- X GET (&bibitem, citekey, REQUIRED);
- X GET (&bibitem, title, REQUIRED);
- X GET (&bibitem, author, OPTIONAL);
- X GET (&bibitem, howpublished, OPTIONAL);
- X GET (&bibitem, address, OPTIONAL);
- X GET (&bibitem, month, OPTIONAL);
- X GET (&bibitem, year, OPTIONAL);
- X GET (&bibitem, note, OPTIONAL);
- X GET (&bibitem, key, OPTIONAL);
- X GET (&bibitem, comment, OPTIONAL);
- X GET (&bibitem, cross_ref, OPTIONAL);
- X GET_USR_DEFNS;
- X return 0;
- X}
- X
- X
- Xget_inproceedings ()
- X
- X{
- X SET (&bibitem, rectype, "INPROCEEDINGS");
- X GET (&bibitem, citekey, REQUIRED);
- X GET (&bibitem, author, REQUIRED);
- X GET (&bibitem, title, REQUIRED);
- X GET (&bibitem, booktitle, REQUIRED);
- X GET (&bibitem, year, REQUIRED);
- X GET (&bibitem, editor, OPTIONAL);
- X GET (&bibitem, pages, OPTIONAL);
- X GET (&bibitem, organisation, OPTIONAL);
- X GET (&bibitem, publisher, OPTIONAL);
- X GET (&bibitem, address, OPTIONAL);
- X GET (&bibitem, month, OPTIONAL);
- X GET (&bibitem, note, OPTIONAL);
- X GET (&bibitem, key, OPTIONAL);
- X GET (&bibitem, comment, OPTIONAL);
- X GET (&bibitem, cross_ref, OPTIONAL);
- X GET_USR_DEFNS;
- X return 0;
- X}
- X
- X
- Xget_inbook ()
- X
- X{
- X SET (&bibitem, rectype, "INBOOK");
- X GET (&bibitem, citekey, REQUIRED);
- X GET (&bibitem, author, REQUIRED);
- X GET (&bibitem, title, REQUIRED);
- X GET (&bibitem, chapter, REQUIRED);
- X GET (&bibitem, pages, OPTIONAL);
- X GET (&bibitem, publisher, REQUIRED);
- X GET (&bibitem, year, REQUIRED);
- X GET (&bibitem, volume, OPTIONAL);
- X GET (&bibitem, series, OPTIONAL);
- X GET (&bibitem, address, OPTIONAL);
- X GET (&bibitem, edition, OPTIONAL);
- X GET (&bibitem, month, OPTIONAL);
- X GET (&bibitem, note, OPTIONAL);
- X GET (&bibitem, key, OPTIONAL);
- X GET (&bibitem, comment, OPTIONAL);
- X GET (&bibitem, cross_ref, OPTIONAL);
- X GET_USR_DEFNS;
- X return 0;
- X}
- X
- X
- Xget_incollection ()
- X
- X{
- X SET (&bibitem, rectype, "INCOLLECTION");
- X GET (&bibitem, citekey, REQUIRED);
- X GET (&bibitem, author, REQUIRED);
- X GET (&bibitem, title, REQUIRED);
- X GET (&bibitem, booktitle, REQUIRED);
- X GET (&bibitem, publisher, REQUIRED);
- X GET (&bibitem, year, REQUIRED);
- X GET (&bibitem, editor, OPTIONAL);
- X GET (&bibitem, chapter, OPTIONAL);
- X GET (&bibitem, pages, OPTIONAL);
- X GET (&bibitem, address, OPTIONAL);
- X GET (&bibitem, month, OPTIONAL);
- X GET (&bibitem, note, OPTIONAL);
- X GET (&bibitem, key, OPTIONAL);
- X GET (&bibitem, comment, OPTIONAL);
- X GET (&bibitem, cross_ref, OPTIONAL);
- X GET_USR_DEFNS;
- X return 0;
- X}
- X
- X
- Xget_manual ()
- X
- X{
- X SET (&bibitem, rectype, "MANUAL");
- X GET (&bibitem, citekey, REQUIRED);
- X GET (&bibitem, title, REQUIRED);
- X GET (&bibitem, author, OPTIONAL);
- X GET (&bibitem, organisation, OPTIONAL);
- X GET (&bibitem, address, OPTIONAL);
- X GET (&bibitem, edition, OPTIONAL);
- X GET (&bibitem, month, OPTIONAL);
- X GET (&bibitem, note, OPTIONAL);
- X GET (&bibitem, key, OPTIONAL);
- X GET (&bibitem, comment, OPTIONAL);
- X GET (&bibitem, cross_ref, OPTIONAL);
- X GET_USR_DEFNS;
- X return 0;
- X}
- X
- X
- Xget_mastersthesis ()
- X
- X{
- X SET (&bibitem, rectype, "MASTERSTHESIS");
- X GET (&bibitem, citekey, REQUIRED);
- X GET (&bibitem, author, REQUIRED);
- X GET (&bibitem, title, REQUIRED);
- X GET (&bibitem, school, REQUIRED);
- X GET (&bibitem, year, REQUIRED);
- X GET (&bibitem, address, OPTIONAL);
- X GET (&bibitem, month, OPTIONAL);
- X GET (&bibitem, note, OPTIONAL);
- X GET (&bibitem, key, OPTIONAL);
- X GET (&bibitem, comment, OPTIONAL);
- X GET (&bibitem, cross_ref, OPTIONAL);
- X GET_USR_DEFNS;
- X return 0;
- X}
- X
- X
- Xget_misc ()
- X
- X{
- X SET (&bibitem, rectype, "MISC");
- X GET (&bibitem, citekey, REQUIRED);
- X GET (&bibitem, author, OPTIONAL);
- X GET (&bibitem, title, OPTIONAL);
- X GET (&bibitem, howpublished, OPTIONAL);
- X GET (&bibitem, month, OPTIONAL);
- X GET (&bibitem, year, OPTIONAL);
- X GET (&bibitem, note, OPTIONAL);
- X GET (&bibitem, key, OPTIONAL);
- X GET (&bibitem, comment, OPTIONAL);
- X GET (&bibitem, cross_ref, OPTIONAL);
- X GET_USR_DEFNS;
- X return 0;
- X}
- X
- X
- Xget_phdthesis ()
- X
- X{
- X SET (&bibitem, rectype, "PHDTHESIS");
- X GET (&bibitem, citekey, REQUIRED);
- X GET (&bibitem, author, REQUIRED);
- X GET (&bibitem, title, REQUIRED);
- X GET (&bibitem, school, REQUIRED);
- X GET (&bibitem, year, REQUIRED);
- X GET (&bibitem, address, OPTIONAL);
- X GET (&bibitem, month, OPTIONAL);
- X GET (&bibitem, note, OPTIONAL);
- X GET (&bibitem, key, OPTIONAL);
- X GET (&bibitem, comment, OPTIONAL);
- X GET (&bibitem, cross_ref, OPTIONAL);
- X GET_USR_DEFNS;
- X return 0;
- X}
- X
- X
- Xget_proceedings ()
- X
- X{
- X SET (&bibitem, rectype, "PROCEEDINGS");
- X GET (&bibitem, citekey, REQUIRED);
- X GET (&bibitem, title, REQUIRED);
- X GET (&bibitem, year, REQUIRED);
- X GET (&bibitem, editor, OPTIONAL);
- X GET (&bibitem, publisher, OPTIONAL);
- X GET (&bibitem, organisation, OPTIONAL);
- X GET (&bibitem, address, OPTIONAL);
- X GET (&bibitem, month, OPTIONAL);
- X GET (&bibitem, note, OPTIONAL);
- X GET (&bibitem, key, OPTIONAL);
- X GET (&bibitem, comment, OPTIONAL);
- X GET (&bibitem, cross_ref, OPTIONAL);
- X GET_USR_DEFNS;
- X return 0;
- X}
- X
- X
- Xget_techreport ()
- X
- X{
- X SET (&bibitem, rectype, "TECHREPORT");
- X GET (&bibitem, citekey, REQUIRED);
- X GET (&bibitem, author, REQUIRED);
- X GET (&bibitem, title, REQUIRED);
- X GET (&bibitem, institution, REQUIRED);
- X GET (&bibitem, year, REQUIRED);
- X GET (&bibitem, type, OPTIONAL);
- X GET (&bibitem, number, OPTIONAL);
- X GET (&bibitem, address, OPTIONAL);
- X GET (&bibitem, month, OPTIONAL);
- X GET (&bibitem, note, OPTIONAL);
- X GET (&bibitem, key, OPTIONAL);
- X GET (&bibitem, comment, OPTIONAL);
- X GET (&bibitem, cross_ref, OPTIONAL);
- X GET_USR_DEFNS;
- X return 0;
- X}
- X
- X
- Xget_unpublished ()
- X
- X{
- X SET (&bibitem, rectype, "UNPUBLISHED");
- X GET (&bibitem, citekey, REQUIRED);
- X GET (&bibitem, author, REQUIRED);
- X GET (&bibitem, title, REQUIRED);
- X GET (&bibitem, note, REQUIRED);
- X GET (&bibitem, month, OPTIONAL);
- X GET (&bibitem, year, OPTIONAL);
- X GET (&bibitem, key, OPTIONAL);
- X GET (&bibitem, comment, OPTIONAL);
- X GET (&bibitem, cross_ref, OPTIONAL);
- X GET_USR_DEFNS;
- X return 0;
- X}
- EOFile templates.c
- chmod u=rw+,g=rw+,o=r++ templates.c
- echo '...done' 1>&2
- if [ ! -d . ] ; then
- echo -n Directory . not found. Creating....
- mkdir .
- if [ ! -d . ] ; then
- echo ...failed
- echo unable to create directory .. Please create the directory and try again
- exit
- fi
- echo ...done
- fi
- echo -n "typescript..." 1>&2
- if test -f typescript
- then
- case $# in
- 0)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- case $1 in
- -o) ;;
- *)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- fi
- sed 's/^X//' << 'EOFile typescript' > typescript
- XScript started on Sun Dec 3 00:47:28 1989
- Xcheops Bibcreate. bibc -help
- XUsage: bibc [-i|-verify] [+|-verbose] [+|-pester] [-file <filename>] [-help]
- X -i Inquire whether to commit a record
- X -verify Same as above, a duplicate form
- X -verbose Turn off verbose flag
- X +verbose Turn on verbose flag
- X -pester Do not insist, even for required fields
- X +pester Insist once for required fields
- X -file <filename> Output bib entries to <filename>
- X -help Print this help output
- Xcheops Bibcreate. bibc -file foo.bib
- XWhat kind of record would you like to enter (one of the following)?
- X article book booklet conference
- X inbook incollection inproceedings manual
- X mastersthesis msthesis misc phdthesis
- X proceedings techreport unpublished
- Xor EDIT quit
- Xinb
- XCITEKEY? NAR88
- XAUTHOR? Narayan, R. K.
- XTITLE? A Writer's Nightmare
- XCHAPTER?
- XERROR: CHAPTER is a REQUIRED FIELD for INBOOK. Let's try that again...sigh...
- XCHAPTER?
- XERROR: Frankly my dear, I don't give a damn...
- XPAGES (optional)? 164--166
- XPUBLISHER? Penguin Books
- XYEAR? 1988
- XVOLUME (optional)? 1
- XSERIES (optional)?
- XADDRESS (optional)?
- XEDITION (optional)?
- XMONTH (optional)?
- XNOTE (optional)?
- XKEY (optional)? ?
- XUsed for alphabetising and creating a label when the author and
- X editor fields are missing.
- XKEY (optional)?
- XCOMMENT (optional)?
- XCROSS-REFERENCE (optional)?
- X@INBOOK { NAR88 ,
- X AUTHOR = "Narayan, R. K." ,
- X PAGES = "164--166" ,
- X PUBLISHER = "Penguin Books" ,
- X TITLE = "A Writer's Nightmare" ,
- X VOLUME = "1" ,
- X YEAR = "1988"
- X }
- X
- XWhat kind of record would you like to enter (one of the following)?
- X article book booklet conference
- X inbook incollection inproceedings manual
- X mastersthesis msthesis misc phdthesis
- X proceedings techreport unpublished
- Xor EDIT quit
- Xin
- XUh oh! no no no
- XWhat kind of record would you like to enter (one of the following)?
- X article book booklet conference
- X inbook incollection inproceedings manual
- X mastersthesis msthesis misc phdthesis
- X proceedings techreport unpublished
- Xor EDIT quit
- Xmi
- XCITEKEY? xx
- XAbort? [y|n] y
- XWhat kind of record would you like to enter (one of the following)?
- X article book booklet conference
- X inbook incollection inproceedings manual
- X mastersthesis msthesis misc phdthesis
- X proceedings techreport unpublished
- Xor EDIT quit
- X^D
- Xcheops Bibcreate. BIBCINIT="USR_FIELD1:USR_FIELD2?Bah Humbug" export BIBCINIT
- Xcheops Bibcreate. bibc -file foo.bib
- XWhat kind of record would you like to enter (one of the following)?
- X article book booklet conference
- X inbook incollection inproceedings manual
- X mastersthesis msthesis misc phdthesis
- X proceedings techreport unpublished
- Xor EDIT quit
- Xa
- XCITEKEY? LAM78
- XAUTHOR? Lamport, Leslie
- XTITLE? Time, Clocks, and the Ordering of Events in a Distributed System
- XJOURNAL? \jacm
- XYEAR? 1978
- XVOLUME (optional)? 21
- XNUMBER (optional)? 7
- XPAGES (optional)? 558--565
- XMONTH (optional)? \jul
- XNOTE (optional)?
- XKEY (optional)?
- XCOMMENT (optional)?
- XCROSS-REFERENCE (optional)?
- XUSR_FIELD1 (optional)? ?
- XYou asked for it, buster, so you figure it out...
- XUSR_FIELD1 (optional)? This wasn't in the jacm, sigh
- XUSR_FIELD2 (optional)? ?
- XBah Humbug
- XUSR_FIELD2 (optional)? There we go, it was in the cacm, so we can EDIT and change the entry
- X@ARTICLE { LAM78 ,
- X AUTHOR = "Lamport, Leslie" ,
- X JOURNAL = jacm ,
- X MONTH = jul ,
- X NUMBER = "7" ,
- X PAGES = "558--565" ,
- X TITLE = "Time, Clocks, and the Ordering of Events in a Distributed System" ,
- X VOLUME = "21" ,
- X YEAR = "1978" ,
- X USR_FIELD1 = "This wasn't in the jacm, sigh" ,
- X USR_FIELD2 = "There we go, it was in the cacm, so we can EDIT and change the entry"
- X }
- X
- XWhat kind of record would you like to enter (one of the following)?
- X article book booklet conference
- X inbook incollection inproceedings manual
- X mastersthesis msthesis misc phdthesis
- X proceedings techreport unpublished
- Xor EDIT quit
- X^D
- Xcheops Bibcreate. shbib lam78 foo.bib
- X@ARTICLE { LAM78 ,
- X AUTHOR = "Lamport, Leslie" ,
- X JOURNAL = jacm ,
- X MONTH = jul ,
- X NUMBER = "7" ,
- X PAGES = "558--565" ,
- X TITLE = "Time, Clocks, and the Ordering of Events in a Distributed System" ,
- X VOLUME = "21" ,
- X YEAR = "1978" ,
- X USR_FIELD1 = "This wasn't in the jacm, sigh" ,
- X USR_FIELD2 = "There we go, it was in the cacm, so we can EDIT and change the entry"
- X }
- Xcheops Bibcreate.
- X
- Xscript done on Sun Dec 3 00:57:11 1989
- EOFile typescript
- chmod u=rw+,g=r++,o=r++ typescript
- echo '...done' 1>&2
- if [ ! -d misc ] ; then
- echo -n Directory misc not found. Creating....
- mkdir misc
- if [ ! -d misc ] ; then
- echo ...failed
- echo unable to create directory misc. Please create the directory and try again
- exit
- fi
- echo ...done
- fi
- echo -n "misc/Changes..." 1>&2
- if test -f misc/Changes
- then
- case $# in
- 0)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- case $1 in
- -o) ;;
- *)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- fi
- sed 's/^X//' << 'EOFile misc/Changes' > misc/Changes
- XWed Jul 19 11:32:35 EDT 1989
- X
- Xbibc now deals with prefixed blanks correct;y...sigh! What a stupid
- Xmiskate...
- X
- Xbibc now understands that some fields should not be quoted, as these
- Xare macros. This it figures, when the field is preceeded by a
- XBACKSLASH, as ferinstance....
- X
- XJournal? \jacm
- X
- Xgets written out as
- X
- X JOURNAL = jacm
- X
- Xinstead of
- X
- X JOURNAL = "jacm" or JOURNAL = "\jacm"
- X
- Xearlier.
- X
- XThu Jul 20 08:26:44 EDT 1989
- X
- XIntroduced a -pester flag, to quieten bibc's insistence about required
- Xfields, and toggle appropriately from the command line.
- X
- XFri Jul 21 11:28:47 EDT 1989
- X
- Xbibv changed considerably, because it also accepts fields like...
- X
- X From: Armin Liebl <liebla%lan.informatik.tu-muenchen.dbp.de@RELAY.CS.NET>
- X Date: 20 Jul 89 14:09:00 B
- X
- X > 4.) Your bibv-tool creates entries like
- X > \nocite{osr=ACMOperatingSystemsReview}
- X > if I have an entry
- X > @STRING{osr="ACM Operating Systems Review"}
- X ack! You are right! :-) I didn't realise this earlier. Maybe, I'll just
- X chuck the sed expression in bibv, and put in a "\nocite{*}" there.
- X hmmmmmmmm......yeah, why not? Thanks, I'll do this rightaway...
- X
- XSat Jul 22 15:05:11 EDT 1989
- X
- Xbibc now allows users to define their own fileds in addition to standard
- Xpredefined ones. The format of this is similiar to the MAILPATH
- Xvariable used by the korn shell...
- X/*
- X * Now that the standard fields are defined, see if the user would like
- X * to define specific fields for themselves. Such fields are specified
- X * by the user in tthe BIBCINIT environment variables. The format of
- X * his variable shall be similiar to the MAILPATH variable used by the
- X * korn shell, as....
- X * <fieldname>?<optional help string>
- X * multiple fields shall be separated by <COLON>s, ':'
- X * A maximum of USR_DEFNS_MAX is taken....
- X */
- X From: Armin Liebl <liebla%lan.informatik.tu-muenchen.dbp.de@RELAY.CS.NET>
- X Date: 20 Jul 89 14:09:00 B
- X
- X > 3.) A good feature that I miss (or that I didn't discover)
- X > would be to allow the user to specify additional
- X > fields (I for example use the additional field "key"
- X > in my records).
- X I put in one such abitrary field, and called it "COMMENT". I have to
- X work out how to put in such fields. It isn't too difficult, just that I
- X haven't bothered. I'll look into it.
- X
- XSat Jul 22 16:51:49 EDT 1989
- X
- XThe lex file, bibc.l is now generated automatically by gen_lex_file
- Xusing prologue.lex, lexstrings.lex and postscript.lex! This just made
- Xmy life a wee bit easier...;-).
- X
- XWith this, all valid prefixes are accepted by lex, ie,
- Xa, ar, art, .. etc.. are valid keys for article.....
- X
- XAlso, msthesis is now a valid input for mastersthesis, which too is
- Xaccepted...
- X
- XSat Sep 16 23:15:59 EDT 1989
- X
- XGuess what, a replacement for gets.3 calls. All gets() calls are now
- Xreplaced by my_gets() in gets.c, which uses fgets() to get whole lines,
- Xpiecemeal, and return nil terminated strings chopped to size available.
- EOFile misc/Changes
- chmod u=rw+,g=r++,o=r++ misc/Changes
- echo '...done' 1>&2
- if [ ! -d misc ] ; then
- echo -n Directory misc not found. Creating....
- mkdir misc
- if [ ! -d misc ] ; then
- echo ...failed
- echo unable to create directory misc. Please create the directory and try again
- exit
- fi
- echo ...done
- fi
- echo -n "misc/README..." 1>&2
- if test -f misc/README
- then
- case $# in
- 0)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- case $1 in
- -o) ;;
- *)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- fi
- sed 's/^X//' << 'EOFile misc/README' > misc/README
- XThis directorycontains various earlier attempts.
- X
- Xbibv.sh was a shell script attempt to do bibv
- XChanges shows some evolutions that these tools underwent.
- Xgets.c is the source to doing a gets() simulation with fgets() only
- EOFile misc/README
- chmod u=rw+,g=r++,o=r++ misc/README
- echo '...done' 1>&2
- if [ ! -d misc ] ; then
- echo -n Directory misc not found. Creating....
- mkdir misc
- if [ ! -d misc ] ; then
- echo ...failed
- echo unable to create directory misc. Please create the directory and try again
- exit
- fi
- echo ...done
- fi
- echo -n "misc/bibv.sh..." 1>&2
- if test -f misc/bibv.sh
- then
- case $# in
- 0)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- case $1 in
- -o) ;;
- *)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- fi
- sed 's/^X//' << 'EOFile misc/bibv.sh' > misc/bibv.sh
- X#! /bin/sh
- X
- XFN=`basename $0`
- X
- Xcase $# in
- X0) echo "$FN: Usage: bibv [-style style-to-use] [ <filename> ... ]"
- X exit
- X ;;
- Xesac
- X
- XSTYLE=specl
- Xcase $1 in
- X"-style") STYLE=$2; shift ; shift ;;
- Xesac
- X
- Xcase $# in
- X0) echo "$FN: Usage: bibv [-style style-to-use] [ <filename> ... ]"
- X exit
- X ;;
- Xesac
- X
- X
- XFILE=bibtex
- XBIBFILE=${FILE}.bib
- XTEXFILE=${FILE}.tex
- XTMPFIL1=sysut1.$$
- X
- Xtrap 'rm -f ${FILE}.bbl ${FILE}.aux ${FILE}.log ${FILE}.blg $TMPFIL1 ; exit' \
- X 1 2 3 15
- X
- XKEYS="@ARTI|@BOOK|@CONF|@INBO|@INCO|@INPR|@MANU|@MAST|@MISC|@PHDT|@PROC|@TECH|@UNPU"
- X
- X> $TEXFILE
- X> ${FILE}.bbl
- X> ${FILE}.aux
- X> ${FILE}.log
- X> ${FILE}.blg
- X> $TMPFIL1
- X
- Xecho "\documentstyle{article}" >> $TEXFILE
- Xecho "\begin{document}" >> $TEXFILE
- Xecho "\bibliographystyle{$STYLE}" >> $TEXFILE
- Xecho "\title{Verifying Biblio files}" >> $TEXFILE
- Xecho "\author{$USER}" >> $TEXFILE
- Xecho "\date{\today}" >> $TEXFILE
- Xecho "\maketitle" >> $TEXFILE
- Xecho "" >> $TEXFILE
- Xecho "" >> $TEXFILE
- X
- XBIBRECD=""
- Xfor i
- Xdo
- X file="`echo $i | sed 's/\.bib//'`"
- X bibfile=${file}.bib
- X echo "\section{FILE $bibfile}" >> $TEXFILE
- X BIBRECD="${BIBRECD},${file}"
- X RECS=`tr [a-z] [A-Z] < $bibfile | egrep $KEYS | wc -l`
- X echo FILE $bibfile has $RECS records
- X sed -n '/^@s/d ; /^@S/d ; /^@.*{[ ]*\(.*\)[, ]*/\\cite {\1}/p' $bibfile >> $TMPFIL1
- X# echo "%" >> $TMPFIL1
- X# echo "% $bibfile" >> $TMPFIL1
- X# echo "%" >> $TMPFIL1
- X# This is not the exact sed expression to be used, but works in
- X# most cases...it is left as commented LaTeX output for convenience...
- X# sed -n 's/^@.*{[ ]*\(.*\)/%\\nocite {\1}/p' $bibfile |
- X# sed 's/[, ]//g' >> $TMPFIL1
- X
- Xdone
- XBIBRECD="`echo $BIBRECD | sed 's/,//'`"
- X
- Xecho "\bibliography{$BIBRECD}" >> $TEXFILE
- Xcat $TMPFIL1 >> $TEXFILE
- Xecho "" >> $TEXFILE
- Xecho "\nocite{*}" >> $TEXFILE
- Xecho "" >> $TEXFILE
- Xecho "\end{document}" >> $TEXFILE
- Xexit
- X
- X# Do this run silently....
- Xlatex $FILE 2>&- 1>&- </dev/null || {
- X echo "$FN: cannot run latex, see yah"
- X rm -f ${FILE}.bbl ${FILE}.aux ${FILE}.log ${FILE}.blg $TMPFIL1
- X exit
- X }
- X
- Xbibtex $FILE
- Xlatex $FILE < /dev/null
- X
- X# Cleanup...
- Xrm -f ${FILE}.bbl ${FILE}.aux ${FILE}.log ${FILE}.blg $TMPFIL1
- X
- Xecho "Now print out ${FILE}.dvi to see a hardcopy..."
- X
- Xexit
- EOFile misc/bibv.sh
- chmod u=rwx,g=r+x,o=r+x misc/bibv.sh
- echo '...done' 1>&2
- if [ ! -d misc ] ; then
- echo -n Directory misc not found. Creating....
- mkdir misc
- if [ ! -d misc ] ; then
- echo ...failed
- echo unable to create directory misc. Please create the directory and try again
- exit
- fi
- echo ...done
- fi
- echo -n "misc/gets.c..." 1>&2
- if test -f misc/gets.c
- then
- case $# in
- 0)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- case $1 in
- -o) ;;
- *)
- echo 'exists, `sh filename -o'\'' to overwrite'
- exit 0;;
- esac
- fi
- sed 's/^X//' << 'EOFile misc/gets.c' > misc/gets.c
- X/* ugh...I know of no better way..*sigh* */
- X#ifndef FILE
- X#include <stdio.h>
- X#endif
- X#include "strings.h"
- X
- Xchar *
- Xmy_gets (buffer, size)
- Xchar *buffer;
- Xint size;
- X
- X/*
- X * This is an emulation of gets() using fgets.3
- X * This routine reads everything upto a newline, using fgets.3
- X *
- X * OUTPUT: Returns buffer on exit, (char *) NULL on error
- X * The contents of buffer are the input string, a max of (size -1)
- X * characters are filled on exit,
- X * The buffer is zeroed and returned on EOF.
- X *
- X * This routine only deals with EOF as an error cleanly. On any other
- X * error returned by fgets.3, this routine will return will return
- X * (char *) NULL and a partially filled buffer....*sigh*
- X *
- X * if EMUL_GETS is turned on, (it probably should, neh? :-) then
- X * it converts any trailing NEWLINE character ('\n') to a NIL ('\0')
- X * character, else, it leaves them alone
- X */
- X
- X#ifdef BUFSIZE
- X#undef BUFSIZE
- X#endif
- X#define BUFSIZE 512
- X#define EMUL_GETS
- X
- X{
- Xint sizeleft, cursize;
- Xchar lbuf[BUFSIZE]; /* These figures are unimportant...leave well alone */
- Xchar *foo, *answer;
- Xint done;
- X
- X sizeleft = size - 1;
- X bzero (buffer, size);
- X answer = buffer;
- X done = 0;
- X
- X while (done != 1)
- X {
- X if (fgets (lbuf, BUFSIZE, stdin) == (char *) NULL)
- X {
- X done = 1 /* EOF or ERROR */ ;
- X answer = (char *) NULL;
- X }
- X else if ((foo = Index (lbuf, '\n')) != (char *) NULL)
- X { /* DONE */
- X if (sizeleft > 0)
- X strncat (buffer, lbuf, sizeleft);
- X done = 1;
- X }
- X else if (sizeleft > 0)
- X { /* COPY */
- X cursize = strlen (lbuf);
- X if (cursize <= sizeleft)
- X {
- X strncat (buffer, lbuf, cursize);
- X sizeleft -= cursize;
- X }
- X else
- X {
- X strncat (buffer, lbuf, sizeleft);
- X sizeleft = 0;
- X }
- X }
- X }
- X
- X#ifdef EMUL_GETS
- X if ((foo = Index (buffer, '\n')) != (char *) NULL)
- X *foo = '\0';
- X#endif
- X return answer;
- X}
- EOFile misc/gets.c
- chmod u=rw+,g=r++,o=r++ misc/gets.c
- echo '...done' 1>&2
- echo Now gitouttaere
- exit
-
-
- -=-
- Kannan Varadhan, Ohio Supercomputer Center, Columbus, OH 43212 [(614) 292-4137]
- email: kannan@osc.edu | osu-cis!oscsunb!kannan
-
-
-