summaryrefslogtreecommitdiff
path: root/support/s2latex/s2latex.patch
blob: e9111bfb7f6e09e711bc2b7780d4f1b6dca9ed35 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
The following are patches against the standard s2latex distribution (at
least as of April 1996, but it doesn't look like it's going to be changing
any time in the near future).  They port s2latex to ANSI C (allowing it to
compile and link correctly under all modern C compilers), as well as clean
up the Makefile, fix make clean, and add a make distclean target.

To apply these patches, use:

	patch < s2latex.patch

If you don't have patch on your system, you can obtain it from
prep.ai.mit.edu (or any mirror) in /pub/gnu; I highly recommend you
install it.  Alternately, you can just make the below changes by hand
(there aren't very many).

Feel free to send me any corrections or additions to these patches, but be
aware that I only compile s2latex; I don't actually use it.  I therefore
am not a good person to send general s2latex questions to.

					Russ Allbery
					rra@cs.stanford.edu

--------------------------------------------------------------------------

--- Makefile.orig	Sun Aug  5 17:00:00 1990
+++ Makefile	Sat Apr  6 17:29:11 1996
@@ -1,12 +1,12 @@
-CFLAGS=-O
+CFLAGS=-O2
 
 all:	s2latex s2latex.1
 
 s2latex: y.tab.c lex.yy.c symtab.o symtab.h
-	cc ${CFLAGS} -o s2latex y.tab.c symtab.o -ll
+	$(CC) ${CFLAGS} -o s2latex y.tab.c symtab.o -ll
 
 y.tab.c: s2l.y
-	yacc s2l.y
+	$(YACC) s2l.y
 
 lex.yy.c: s2l.l
 	lex s2l.l
@@ -15,7 +15,10 @@
 	tbl s2latex.tbl >s2latex.1
 
 clean:	
-	rm -f y.tab.c lex.yy.c core y.tab.h *.o s2latex.1
+	rm -f y.tab.c lex.yy.c core y.tab.h *.o s2latex
+
+distclean: clean
+	rm -f s2latex.1
 
 mktar:
 	tar cvf s2latex.tar Makefile s2l.y s2l.l symtab.c symtab.h s2latex.tbl
--- s2l.y.orig	Sun Oct  7 17:00:00 1990
+++ s2l.y	Sat Apr  6 17:28:08 1996
@@ -38,7 +38,7 @@
 
 #include <stdio.h>
 #include <ctype.h>
-#include <strings.h>
+#include <string.h>
 #include "symtab.h"
 
 #define	DELBUFLEN 1024	/* "delayed" text buffer length (see comments
@@ -317,7 +317,7 @@
 	|	'<'		{ dprintf("{\\tt\\char`\\<}"); }
 	|	'>'		{ dprintf("{\\tt\\char`\\>}"); }
 	|	'|'		{ dprintf("{\\tt\\char`\\|}"); }
-	|	'"'		{ if( dirquote ) {
+	|	'\"'		{ if( dirquote ) {
 					dprintf( dquote? "'":"`");
 					dquote=!dquote;
 				  } else
@@ -353,9 +353,9 @@
 			argc--;
 			read_st( *argv );
 		} else {
-			if( index( *argv, 'k' ) )
+			if( strchr( *argv, 'k' ) )
 				kflag++;
-			if( index( *argv, 'q' ) )
+			if( strchr( *argv, 'q' ) )
 				dirquote = 0;
 		}
 		argv++;
@@ -534,7 +534,7 @@
 	char *nlpos;
 
 	if( delayout ) {
-		if( nlpos = rindex( delbuf, '\n' ) ) {
+		if( nlpos = strrchr( delbuf, '\n' ) ) {
 			*nlpos = '\0';
 			printf( "%s", delbuf );
 			nlpos++;