File source-detex.dif of Package texlive

--- texk/detex/COPYRIGHT
+++ texk/detex/COPYRIGHT	2008-02-01 20:55:51.000000000 +0100
@@ -0,0 +1,35 @@
+
+Copyright (c) 1986-2007 Purdue University
+All rights reserved.
+
+Developed by:  Daniel Trinkle
+               Department of Computer Science, Purdue University
+               http://www.cs.purdue.edu/
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal with the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+o Redistributions of source code must retain the above copyright
+  notice, this list of conditions and the following disclaimers.
+
+o Redistributions in binary form must reproduce the above copyright
+  notice, this list of conditions and the following disclaimers in the
+  documentation and/or other materials provided with the distribution.
+
+o Neither the names of Daniel Trinkle, Purdue University, nor the
+  names of its contributors may be used to endorse or promote products
+  derived from this Software without specific prior written
+  permission.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
--- texk/detex/README
+++ texk/detex/README	2008-02-01 20:55:51.000000000 +0100
@@ -1,4 +1,4 @@
-Detex - Version 2.7
+Detex - Version 2.8
 
 Detex is a program to remove TeX constructs from a text file.  It recognizes
 the \input command.
@@ -11,6 +11,8 @@ This directory contains the following fi
 
 README -	you're looking at it.
 
+COPYRIGHT -	NCSA/University of Illinois Open Source License
+
 Makefile -	makefile for generating detex on a 4.2BSD Unix system.
 
 detex.1l -	troff source for the detex manual page.
@@ -34,9 +36,9 @@ os2 -		subdirectory containing support f
 		OS/2 and DOS systems
 
 
-Feel free to redistribute this program, but distribute the complete contents
-of this directory.  The latest version is available at
-http://www.cs.purdue.edu/homes/trinkle/detex/  Send comments and fixes
+This software package is distributed under the NCSA/University of
+Illinois Open Source License.  The latest version is available at
+http://www.cs.purdue.edu/homes/trinkle/detex/ Send comments and fixes
 to me via email.
 
 Daniel Trinkle <trinkle@cs.purdue.edu>
@@ -187,3 +189,7 @@ way to rewrite detex to get around this 
 May 25, 1995
 According to alain@ia1.u-strasbg.fr (Alain Ketterlin), using flex
 allows 8-bit characters to be handled correctly.
+
+Modified (Version 2.8) -- January 1, 2008
+Added NCSA/University of Illinois Open Source License to facilitate
+free redistribution.
--- texk/detex/detex.h
+++ texk/detex/detex.h	2008-03-05 15:21:08.540433567 +0100
@@ -1,3 +1,40 @@
+/*
+ * Copyright (c) 1986-2007 Purdue University
+ * All rights reserved.
+ * 
+ * Developed by:  Daniel Trinkle
+ *                Department of Computer Science, Purdue University
+ *                http://www.cs.purdue.edu/
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal with the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ * 
+ * o Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimers.
+ * 
+ * o Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimers in the
+ *   documentation and/or other materials provided with the distribution.
+ * 
+ * o Neither the names of Daniel Trinkle, Purdue University, nor the
+ *   names of its contributors may be used to endorse or promote products
+ *   derived from this Software without specific prior written
+ *   permission.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
+ */
+
 /******
 ** The following parameters should be modified as necessary
 **	MAXINCLIST - maximum number of files allowed in an \includeonly list
@@ -18,10 +55,10 @@
 #define	DEFAULTINPUTS	".;/emtex/texinput"
 #define	CHPATHSEP	';'
 #else
-#define	DEFAULTINPUTS	".:/usr/local/tex/inputs"
+#define	DEFAULTINPUTS	".:/usr/share/texmf/tex"
 #define	CHPATHSEP	':'
 #endif
-#define	MAXINPUTPATHS	10
+#define	MAXINPUTPATHS	30
 
 #define	DEFAULTENV	"array,eqnarray,equation,figure,mathmatica,picture,table,verbatim"
 #define	CHENVSEP	','
@@ -42,3 +79,17 @@
 #define	CHWORDOPT	'w'
 
 #define	ERROR		-1
+
+extern void SetEnvIgnore(char *sbEnvList);
+extern int BeginEnv(char *sbEnv);
+extern int EndEnv(char *sbEnv);
+extern void InputFile(char *sbFile);
+extern void IncludeFile(char *sbFile);
+extern void AddInclude(char *sbFile);
+extern int InList(char *sbFile);
+extern void SetInputPaths();
+extern int SeparateList(char *sbList,char **rgsbList ,char chSep,int csbMax);
+extern FILE * TexOpen(char *sbFile);
+extern char * SafeMalloc(int cch,char *sbMessage);
+extern void Warning(char *sb1,char *sb2);
+extern void ErrorExit(char *sb1);
--- texk/detex/detex.l
+++ texk/detex/detex.l	2008-03-05 15:41:23.431911712 +0100
@@ -1,19 +1,51 @@
 %{
 #ifndef lint
-static char	rcsid[] = "$Header: /p/src/local/bin/detex/RCS/detex.l,v 2.19 1997/09/10 18:12:37 trinkle Exp $";
+static char	rcsid[] = "$Header: /p/src/local/bin/detex/RCS/detex.l,v 2.22 2007/03/01 20:22:01 trinkle Exp trinkle $";
 #endif
 
 /*
+ * Copyright (c) 1986-2007 Purdue University
+ * All rights reserved.
+ * 
+ * Developed by:  Daniel Trinkle
+ *                Department of Computer Science, Purdue University
+ *                http://www.cs.purdue.edu/
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal with the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ * 
+ * o Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimers.
+ * 
+ * o Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimers in the
+ *   documentation and/or other materials provided with the distribution.
+ * 
+ * o Neither the names of Daniel Trinkle, Purdue University, nor the
+ *   names of its contributors may be used to endorse or promote products
+ *   derived from this Software without specific prior written
+ *   permission.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
+ */
+
+
+/*
  * detex [-e environment-list] [-c] [-l] [-n] [-s] [-t] [-w] [file[.tex] ]
  *
  *	This program is used to remove TeX or LaTeX constructs from a text
  *	file.
- *
- * Written by:
- *	Daniel Trinkle
- *	Department of Computer Science
- *	Purdue University
- *
  */
 
 #ifdef FPTEX
@@ -59,25 +91,14 @@ char	*malloc();
 
 #endif
 
-extern void SetEnvIgnore(char *sbEnvList);
-extern int BeginEnv(char *sbEnv);
-extern int EndEnv(char *sbEnv);
-extern void InputFile(char *sbFile);
-extern void IncludeFile(char *sbFile);
-extern void AddInclude(char *sbFile);
-extern int InList(char *sbFile);
-extern void SetInputPaths();
-extern int SeparateList(char *sbList,char **rgsbList ,char chSep,int csbMax);
-extern FILE * TexOpen(char *sbFile);
-extern char * SafeMalloc(int cch,char *sbMessage);
-extern void Warning(char *sb1,char *sb2);
-extern int ErrorExit(char *sb1);
-
 #define	LaBEGIN		if (fLatex) BEGIN
-#define	CITEBEGIN	if (fLatex && !fCite) BEGIN
 #define	IGNORE		if (fSpace && !fWord) putchar(' ')
 #define	SPACE		if (!fWord) putchar(' ')
 #define	NEWLINE		if (!fWord) putchar('\n')
+#define	LATEX		fLatex=!fForcetex
+#define KILLARGS(x)	cArgs=x; LaBEGIN LaMacro
+#define STRIPARGS(x)	cArgs=x; LaBEGIN LaMacro2
+#define	CITE(x)		if (fLatex && !fCite) KILLARGS(x)
 
 char	*SafeMalloc();
 #ifdef OS2
@@ -91,7 +112,8 @@ char	sbCurrentEnv[CCHMAXENV];	/* current
 char	*sbProgName;			/* name we were invoked with */
 FILE	*rgfp[NOFILE+1];		/* stack of input/include files */
 int	cfp = 0;			/* count of files in stack */
-int	cOpenBrace = 0;			/* count of `{' in <LaMacro2> */
+int	cOpenBrace = 0;			/* count of `{' in <LaMacro> and <LaMacro2> */
+int	cArgs = 0;			/* argument connt in <LaArgs> */
 int	csbEnvIgnore;			/* count of environments ignored */
 int	csbIncList = 0;			/* count of includeonly files */
 int	csbInputPaths;			/* count of input paths */
@@ -101,19 +123,34 @@ int	fFollow = 1;			/* flag to follow inp
 int	fCite = 0;			/* flag to echo \cite and \ref args */
 int	fSpace = 0;			/* flag to replace \cs with space */
 int	fForcetex = 0;			/* flag to inhibit latex mode */
+
+#ifdef FLEX_SCANNER
+/* flex has contexts for buffers that need to be switched when file changes
+ * otherwise output contains imported files in reverse order.  Weird, but
+ * true.
+ */
+YY_BUFFER_STATE rgsb[NOFILE + 1]; /* flex context stack */
+int             csb = 0;		 /* depth of flex context stack */
+#endif /* FLEX_SCANNER */
+
 %}
 
 S	[ \t\n]*
 W	[a-zA-Z]+
+N	[+-]?(([0-9]+(\.[0-9]+)?)|(\.[0-9]+))
+U	pt|pc|in|bp|cm|mm|dd|cc|sp
+D	{S}(({N}{S}{U})|(\\{W})){S}
+Z	\*?
 
 %Start Define Display IncludeOnly Input Math Normal Control
 %Start LaBegin LaDisplay LaEnd LaEnv LaFormula LaInclude
-%Start LaMacro LaMacro2 LaVerbatim
+%Start LaMacro LaOptArg LaMacro2 LaOptArg2 LaVerbatim 
+%start LaBreak LaPicture
 
 %%
 <Normal>"%".*		/* ignore comments */	;
 
-<Normal>"\\begin"{S}"{"{S}"document"{S}"}"	{fLatex = !fForcetex; IGNORE;}
+<Normal>"\\begin"{S}"{"{S}"document"{S}"}"	{LATEX; IGNORE;}
 
 <Normal>"\\begin"     /* environment start */	{LaBEGIN LaBegin; IGNORE;}
 
@@ -125,12 +162,21 @@ W	[a-zA-Z]+
 						}
 
 <LaVerbatim>"\\end"{S}"{"{S}"verbatim"{S}"}" /* verbatim mode */	{BEGIN Normal; IGNORE;}
+<LaVerbatim>[^\\]+				ECHO;
 <LaVerbatim>.					ECHO;
 
+<LaBegin>{S}"{"{S}"minipage"{S}"}"		{ KILLARGS(1);
+						  if (BeginEnv("minpage"))
+							BEGIN LaEnv;
+						  else
+							BEGIN Normal;
+						  IGNORE;
+						}
+
 <LaBegin>{W}					{   if (BeginEnv(yytext))
 							BEGIN LaEnv;
 						    else
-							BEGIN LaMacro;
+							BEGIN Normal;
 						    IGNORE;
 						}
 <LaBegin>"\n"					NEWLINE;
@@ -148,19 +194,64 @@ W	[a-zA-Z]+
 <LaEnd>"\n"					NEWLINE;
 <LaEnd>.					;
 
-<Normal>"\\bibitem"	    /* ignore args  */	{LaBEGIN LaMacro2; IGNORE;}
-<Normal>"\\bibliography"    /* of these \cs */	{LaBEGIN LaMacro; IGNORE;}
-<Normal>"\\bibstyle"				{LaBEGIN LaMacro; IGNORE;}
-<Normal>"\\cite"				{CITEBEGIN LaMacro2; IGNORE;}
-<Normal>"\\documentstyle"			{LaBEGIN LaMacro; IGNORE;}
-<Normal>"\\end"					{LaBEGIN LaMacro; IGNORE;}
-<Normal>"\\footnote"				{SPACE;}
-<Normal>"\\index"				{LaBEGIN LaMacro2; SPACE;}
-<Normal>"\\label"				{LaBEGIN LaMacro; IGNORE;}
-<Normal>"\\pageref"				{CITEBEGIN LaMacro; IGNORE;}
-<Normal>"\\pagestyle"				{LaBEGIN LaMacro; IGNORE;}
-<Normal>"\\ref"					{CITEBEGIN LaMacro; IGNORE;}
-<Normal>"\\setcounter"				{LaBEGIN LaMacro; IGNORE;}
+<Normal>"\\vskip"{D}				;
+<Normal>"\\vspace"{Z}{S}"{"{D}"}"		;
+<Normal>"\\hskip"{D}				;
+<Normal>"\\hspace"{Z}{S}"{"{D}"}"		;
+<Normal>"\\addvspace"{S}"{"{D}"}"		;
+
+<Normal>"\\newlength"				{ KILLARGS(1); }
+<Normal>"\\setlength"				{ KILLARGS(2); }
+<Normal>"\\addtolength"				{ KILLARGS(2); }
+<Normal>"\\settowidth"				{ KILLARGS(2); }
+<Normal>"\\settoheight"				{ KILLARGS(2); }
+<Normal>"\\settodepth"				{ KILLARGS(2); }
+<Normal>"\\newsavebox"				{ KILLARGS(1); }
+<Normal>"\\sbox"				{ KILLARGS(1); }
+<Normal>"\\savebox"				{ KILLARGS(2); }
+<Normal>"\\usebox"				{ KILLARGS(1); }
+<Normal>"\\raisebox"				{ STRIPARGS(2); }
+<Normal>"\\parbox"				{ KILLARGS(1); }
+<Normal>"\\scalebox"				{ STRIPARGS(2); }
+<Normal>"\\resizebox"{Z}			{ KILLARGS(2); }
+<Normal>"\\reflectbox"				;
+<Normal>"\\rotatebox"				{ KILLARGS(1); }
+<Normal>"\\includegraphics"[^{]*		{ LaBEGIN LaPicture; }
+
+<LaPicture>"{"					;
+<LaPicture>[^{}]+				{ printf("<Picture %s>", yytext); }
+<LaPicture>"\}"					BEGIN Normal;
+
+<Normal>"\\definecolor"				{ KILLARGS(3); }
+<Normal>"\\color"				{ KILLARGS(1); }
+<Normal>"\\textcolor"				{ KILLARGS(2); }
+<Normal>"\\colorbox"				{ KILLARGS(2); }
+<Normal>"\\fcolorbox"				{ KILLARGS(3); }
+<Normal>"\\pagecolor"				{ KILLARGS(1); }
+<Normal>"\\foilhead"				{ STRIPARGS(1); }
+
+<Normal>"\\part"{Z}				;
+<Normal>"\\section"{Z}				;
+<Normal>"\\subsection"{Z}			;
+<Normal>"\\subsubsection"{Z}			;
+<Normal>"\\paragraph"{Z}			;
+<Normal>"\\sunparagraph"{Z}			;
+
+<Normal>"\\bibitem"	    /* ignore args  */	{KILLARGS(1); IGNORE;}
+<Normal>"\\bibliography"    /* of these \cs */	{KILLARGS(1); IGNORE;}
+<Normal>"\\bibstyle"				{KILLARGS(1); IGNORE;}
+<Normal>"\\cite"				{CITE(1); IGNORE;}
+<Normal>"\\documentstyle"			{LATEX; KILLARGS(1); IGNORE;}
+<Normal>"\\documentclass"			{LATEX; KILLARGS(1); IGNORE;}
+<Normal>"\\usepackage"				{KILLARGS(1); IGNORE;}
+<Normal>"\\end"					{KILLARGS(1); IGNORE;}
+<Normal>"\\index"				{KILLARGS(1); SPACE;}
+<Normal>"\\footnote"				{KILLARGS(1); SPACE;}
+<Normal>"\\label"				{KILLARGS(1); IGNORE;}
+<Normal>"\\pageref"				{CITE(1); IGNORE;}
+<Normal>"\\pagestyle"				{KILLARGS(1); IGNORE;}
+<Normal>"\\ref"					{CITE(1); IGNORE;}
+<Normal>"\\setcounter"				{KILLARGS(1); IGNORE;}
 <Normal>"\\verb" /* ignore \verb<ch>...<ch> */	{   if (fLatex) {
 						 	char verbchar, c;
 						 	verbchar = input();
@@ -170,16 +261,10 @@ W	[a-zA-Z]+
 						    }
 						    IGNORE;
 						}
-<LaMacro>"}"					BEGIN Normal;
-<LaMacro>"\n"					NEWLINE;
-<LaMacro>.					;
-<LaMacro2>"{"					{   cOpenBrace++; }
-<LaMacro2>"}"					{   cOpenBrace--;
-						    if (cOpenBrace == 0)
-							BEGIN Normal;
-						}
-<LaMacro2>"\n"					NEWLINE;
-<LaMacro2>.					;
+
+<Normal>"\\newcommand"				{ LATEX; KILLARGS(2); }
+<Normal>"\\renewcommand"			{ LATEX; KILLARGS(2); }
+<Normal>"\\newenvironment"			{ LATEX; KILLARGS(3); }
 
 <Normal>"\\def"		/* ignore def begin */	{BEGIN Define; IGNORE;}
 <Define>"{"					BEGIN Normal;
@@ -232,10 +317,18 @@ W	[a-zA-Z]+
 
 <Normal>\\(aa|AA|ae|AE|oe|OE|ss)[ \t]*[ \t\n}] /* handle ligatures */	{(void)printf("%.2s", yytext+1);}
 <Normal>\\[OoijLl][ \t]*[ \t\n}]		{(void)printf("%.1s", yytext+1);}
+<Normal>"\\linebreak"				BEGIN LaBreak;
 
 <Normal>\\[a-zA-Z@]+	/* ignore other \cs */	{BEGIN Control; IGNORE;}
 <Normal>"\\ "					SPACE;
+<Normal>"\\\\"{Z}(\[[^\]]*\])?			NEWLINE;
 <Normal>\\.					IGNORE;
+<LaBreak>[0-4]?					{  if (yytext==NULL || strlen(yytext)==0
+							|| atoi(yytext)==4)
+							NEWLINE;
+						BEGIN Normal;
+						}
+
 <Control>\\[a-zA-Z@]+				IGNORE;
 <Control>[a-zA-Z@0-9]*[-'=`][^ \t\n{]*		IGNORE;
 <Control>"\n"					{BEGIN Normal; NEWLINE;}
@@ -253,6 +346,35 @@ W	[a-zA-Z]+
 						}
 <Normal>[0-9]+					if (!fWord) ECHO;
 <Normal>(.|\n)					if (!fWord) ECHO;
+
+<LaMacro>"\["					{ BEGIN LaOptArg; }
+<LaMacro>"{"					{ cOpenBrace++; }
+<LaMacro>"}"					{   cOpenBrace--;
+						    if (cOpenBrace == 0)
+						    {
+							if (--cArgs==0)
+							BEGIN Normal;
+						    }
+						}
+<LaMacro>.					;
+<LaOptArg>"\]"					BEGIN LaMacro;	
+<LaOptArg>[^\]]*				;
+
+<LaMacro2>"\["					{ BEGIN LaOptArg2; }
+<LaMacro2>"{"				        { if (cOpenBrace == 0)
+						    {
+							if (--cArgs==0)
+							{
+							    BEGIN Normal;
+							    cOpenBrace--;
+							}
+						    }
+						  cOpenBrace++;
+						}
+<LaMacro2>"}"					{   cOpenBrace--; }
+<LaMacro2>.					;
+<LaOptArg2>"\]"					BEGIN LaMacro2;	
+<LaOptArg2>.					;
 %%
 /******
 ** main --
@@ -271,7 +393,7 @@ W	[a-zA-Z]+
 **	If no input files are specified on the command line, process stdin.
 ******/
 
-main(cArgs,rgsbArgs)
+int main(cArgs,rgsbArgs)
 int	cArgs;
 char	*rgsbArgs[];
 {
@@ -314,7 +436,10 @@ char	*rgsbArgs[];
 			fCite = 1;
 			break;
 		    case CHENVOPT:
-			sbEnvList = rgsbArgs[++iArgs];
+			if (++iArgs >= cArgs) {
+				ErrorExit("-e option requires and argument");
+			}
+			sbEnvList = rgsbArgs[iArgs];
 			break;
 		    case CHLATEXOPT:
 			fLatex = 1;
@@ -382,9 +507,16 @@ char	*rgsbArgs[];
 **	return the termination signal for lex.
 ******/
 
-yywrap()
+int yywrap()
 {
 	(void)fclose(yyin);
+#ifdef FLEX_SCANNER
+        /* Pop context state */
+	if (csb > 0) {
+		yy_delete_buffer( YY_CURRENT_BUFFER );
+		yy_switch_to_buffer( rgsb[--csb] );
+	}
+#endif /* FLEX_SCANNER */
 	if (cfp > 0) {
 	    yyin = rgfp[--cfp];
 	    return(0);
@@ -432,7 +564,7 @@ char	*sbEnvList;
 **	is, sbCurrentEnv is set to sbEnv.
 ******/
 
-BeginEnv(sbEnv)
+int BeginEnv(sbEnv)
 char	*sbEnv;
 {
 	int	i;
@@ -450,7 +582,7 @@ char	*sbEnv;
 ** EndEnv -- checks to see if sbEnv is the current environment being ignored.
 ******/
 
-EndEnv(sbEnv)
+int EndEnv(sbEnv)
 char	*sbEnv;
 {
 	if (!fLatex) return(0);
@@ -476,7 +608,12 @@ char	*sbFile;
 	if ((yyin = TexOpen(sbFile)) == NULL) {
 	    Warning("can't open \\input file", sbFile);
 	    yyin = rgfp[--cfp];
-	}
+            return;
+	} 
+#ifdef FLEX_SCANNER
+        rgsb[csb++] = YY_CURRENT_BUFFER;
+        yy_switch_to_buffer(yy_create_buffer( yyin, YY_BUF_SIZE ) );
+#endif /* FLEX_SCANNER */
 }
 
 /******
@@ -498,7 +635,12 @@ char	*sbFile;
 	if ((yyin = TexOpen(sbFile)) == NULL) {
 	    Warning("can't open \\include file", sbFile);
 	    yyin = rgfp[--cfp];
+            return;
 	}
+#ifdef FLEX_SCANNER
+        rgsb[csb++] = YY_CURRENT_BUFFER;
+        yy_switch_to_buffer(yy_create_buffer( yyin, YY_BUF_SIZE ) );
+#endif /* FLEX_SCANNER */
 }
 
 /******
@@ -523,7 +665,7 @@ char	*sbFile;
 **	no list, all files are assumed to be "in the list".
 ******/
 
-InList(sbFile)
+int InList(sbFile)
 char	*sbFile;
 {
 	char	*pch, sbBase[PATH_MAX];
@@ -555,7 +697,7 @@ SetInputPaths()
 {
 	char *sb, *sbPaths;
 #ifndef WIN32
-	char *getenv();
+	extern char *getenv(const char *name);
 #endif
 	int cchDefaults, cchPaths;
 
@@ -594,7 +736,7 @@ SetInputPaths()
 **	ERROR is returned if there are more than csbMax words.
 ******/
 
-SeparateList(sbList, rgsbList, chSep, csbMax)
+int SeparateList(sbList, rgsbList, chSep, csbMax)
 char	*sbList, *rgsbList[], chSep;
 int	csbMax;
 {
@@ -717,6 +859,7 @@ char	*sb1, *sb2;
 **	Stdout is flushed and detex exits.
 ******/
 
+void 
 ErrorExit(sb1)
 char	*sb1;
 {
--- texk/detex/states.sed
+++ texk/detex/states.sed	2008-02-01 20:55:51.000000000 +0100
@@ -1,3 +1,39 @@
+# Copyright (c) 1986-2007 Purdue University
+# All rights reserved.
+# 
+# Developed by:  Daniel Trinkle
+#                Department of Computer Science, Purdue University
+#                http://www.cs.purdue.edu/
+# 
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal with the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+# 
+# o Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimers.
+# 
+# o Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimers in the
+#   documentation and/or other materials provided with the distribution.
+# 
+# o Neither the names of Daniel Trinkle, Purdue University, nor the
+#   names of its contributors may be used to endorse or promote products
+#   derived from this Software without specific prior written
+#   permission.
+# 
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+# IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+# ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+# CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
+#
+#
 # convert long labels to a shorter form so lex(1) won't overflow
 s/LaBegin/SA/g
 s/LaDisplay/SB/g
@@ -15,3 +51,7 @@ s/\([ <]\)Input\([ >;]\)/\1SM\2/g
 s/Math/SN/g
 s/Normal/SO/g
 s/Control/SP/g
+s/LaPicture/SQ/g
+s/LaBreak/SR/g
+s/LaOptArg2/SS/g
+s/LaOptArg/ST/g
openSUSE Build Service is sponsored by