9 |
|
* cc mtext.c mfio.o syscalls.o misc.o |
10 |
|
*/ |
11 |
|
|
12 |
– |
#include <malloc.h> |
12 |
|
#include <string.h> |
13 |
|
|
14 |
|
#include "meta.h" |
15 |
+ |
#include "plot.h" |
16 |
|
|
17 |
|
#define MAXLINE 1024 |
18 |
|
|
34 |
|
|
35 |
|
char *progname; |
36 |
|
|
37 |
+ |
static void execute(FILE *fp); |
38 |
+ |
static void sectout(char **sect, int nlines, int maxlen); |
39 |
+ |
static void plotstr(int lino, char *s); |
40 |
|
|
41 |
|
|
39 |
– |
main(argc, argv) |
42 |
|
|
43 |
< |
int argc; |
44 |
< |
char **argv; |
45 |
< |
|
43 |
> |
int |
44 |
> |
main( |
45 |
> |
int argc, |
46 |
> |
char **argv |
47 |
> |
) |
48 |
|
{ |
49 |
|
FILE *fp; |
50 |
|
|
47 |
– |
#ifdef CPM |
48 |
– |
fixargs("mtext", &argc, &argv); |
49 |
– |
#endif |
50 |
– |
|
51 |
|
progname = *argv++; |
52 |
|
argc--; |
53 |
|
|
114 |
|
} |
115 |
|
|
116 |
|
|
117 |
< |
|
118 |
< |
|
119 |
< |
execute(fp) /* execute a file */ |
120 |
< |
|
121 |
< |
FILE *fp; |
122 |
< |
|
117 |
> |
void |
118 |
> |
execute( /* execute a file */ |
119 |
> |
FILE *fp |
120 |
> |
) |
121 |
|
{ |
122 |
|
static char linbuf[MAXLINE]; |
123 |
|
int nlines; |
124 |
|
char **section; |
125 |
|
int maxlen; |
126 |
|
int done; |
127 |
< |
int i, j, k; |
127 |
> |
int j, k; |
128 |
|
|
129 |
|
nlines = XYSIZE/cheight; |
130 |
|
done = FALSE; |
135 |
|
while (!done) { |
136 |
|
maxlen = 0; |
137 |
|
for (j = 0; j < nlines; j++) { |
138 |
< |
if (done = fgets(linbuf, MAXLINE, fp) == NULL) |
138 |
> |
if ((done = fgets(linbuf, MAXLINE, fp) == NULL)) |
139 |
|
break; |
140 |
|
k = strlen(linbuf); |
141 |
|
if (linbuf[k-1] == '\n') |
159 |
|
} |
160 |
|
|
161 |
|
|
162 |
< |
|
163 |
< |
|
164 |
< |
sectout(sect, nlines, maxlen) /* write out a section */ |
165 |
< |
|
166 |
< |
char **sect; |
167 |
< |
int nlines; |
170 |
< |
int maxlen; |
171 |
< |
|
162 |
> |
void |
163 |
> |
sectout( /* write out a section */ |
164 |
> |
char **sect, |
165 |
> |
int nlines, |
166 |
> |
int maxlen |
167 |
> |
) |
168 |
|
{ |
169 |
|
int linwidt; |
174 |
– |
char *strncpy(); |
170 |
|
char *slin; |
171 |
|
int i, j; |
172 |
|
|
195 |
|
} |
196 |
|
|
197 |
|
|
198 |
< |
|
199 |
< |
plotstr(lino, s) /* plot string on line lino */ |
200 |
< |
|
201 |
< |
int lino; |
202 |
< |
char *s; |
208 |
< |
|
198 |
> |
void |
199 |
> |
plotstr( /* plot string on line lino */ |
200 |
> |
int lino, |
201 |
> |
char *s |
202 |
> |
) |
203 |
|
{ |
204 |
|
int a0; |
205 |
|
register int bottom, right; |