io.c (779fc935796a940997d18b31d64a9fec9c6b40f6) io.c (23a1ccea6aac035f084a7a4cdc968687d1b02daf)
1/*
1/*
2 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
3 * Use is subject to license terms.
2 * Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved.
4 */
5
6/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
7/* All Rights Reserved */
8
9/*
10 * Copyright (c) 1980 Regents of the University of California.
11 * All rights reserved. The Berkeley software License Agreement
12 * specifies the terms and conditions for redistribution.
13 */
14
3 */
4
5/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
6/* All Rights Reserved */
7
8/*
9 * Copyright (c) 1980 Regents of the University of California.
10 * All rights reserved. The Berkeley software License Agreement
11 * specifies the terms and conditions for redistribution.
12 */
13
15#pragma ident "%Z%%M% %I% %E% SMI"
16
17#include "e.h"
18#include <stdlib.h>
19#include <locale.h>
20
21#define MAXLINE 8192 /* maximum input line */
22
23char in[MAXLINE+1]; /* input buffer */
24int noeqn;
25
26void error(int, char *, char *);
27
28static void do_inline(void);
29int eqn(int, char *[]);
14#include "e.h"
15#include <stdlib.h>
16#include <locale.h>
17
18#define MAXLINE 8192 /* maximum input line */
19
20char in[MAXLINE+1]; /* input buffer */
21int noeqn;
22
23void error(int, char *, char *);
24
25static void do_inline(void);
26int eqn(int, char *[]);
30static int getline(char *);
27static int getaline(char *);
31static void init(void);
32void nrwid(int, int, int);
33int oalloc(void);
34void ofree(int);
35static void setfile(int, char *[]);
36void setps(int);
37
38int

--- 9 unchanged lines hidden (view full) ---

48
49int
50eqn(int argc, char *argv[])
51{
52 int i, type;
53
54 setfile(argc, argv);
55 init_tbl(); /* install keywords in tables */
28static void init(void);
29void nrwid(int, int, int);
30int oalloc(void);
31void ofree(int);
32static void setfile(int, char *[]);
33void setps(int);
34
35int

--- 9 unchanged lines hidden (view full) ---

45
46int
47eqn(int argc, char *argv[])
48{
49 int i, type;
50
51 setfile(argc, argv);
52 init_tbl(); /* install keywords in tables */
56 while ((type = getline(in)) != EOF) {
53 while ((type = getaline(in)) != EOF) {
57 eqline = linect;
58 if (in[0] == '.' && in[1] == 'E' && in[2] == 'Q') {
59 for (i = 11; i < 100; used[i++] = 0)
60 ;
61 printf("%s", in);
62 printf(".nr 99 \\n(.s\n.nr 98 \\n(.f\n");
63 markline = 0;
64 init();

--- 26 unchanged lines hidden (view full) ---

91 do_inline();
92 else
93 printf("%s", in);
94 }
95 return (0);
96}
97
98static int
54 eqline = linect;
55 if (in[0] == '.' && in[1] == 'E' && in[2] == 'Q') {
56 for (i = 11; i < 100; used[i++] = 0)
57 ;
58 printf("%s", in);
59 printf(".nr 99 \\n(.s\n.nr 98 \\n(.f\n");
60 markline = 0;
61 init();

--- 26 unchanged lines hidden (view full) ---

88 do_inline();
89 else
90 printf("%s", in);
91 }
92 return (0);
93}
94
95static int
99getline(char *s)
96getaline(char *s)
100{
101 int c;
102 while ((*s++ = c = gtc()) != '\n' && c != EOF && c != lefteq)
103 if (s >= in+MAXLINE) {
104 error(!FATAL, gettext(
105 "input line too long: %.20s\n"), in);
106 in[MAXLINE] = '\0';
107 break;

--- 17 unchanged lines hidden (view full) ---

125 printf(".as %d \"%s\n", ds, in);
126 init();
127 yyparse();
128 if (eqnreg > 0) {
129 printf(".as %d \\*(%d\n", ds, eqnreg);
130 ofree(eqnreg);
131 }
132 printf(".ps \\n(99\n.ft \\n(98\n");
97{
98 int c;
99 while ((*s++ = c = gtc()) != '\n' && c != EOF && c != lefteq)
100 if (s >= in+MAXLINE) {
101 error(!FATAL, gettext(
102 "input line too long: %.20s\n"), in);
103 in[MAXLINE] = '\0';
104 break;

--- 17 unchanged lines hidden (view full) ---

122 printf(".as %d \"%s\n", ds, in);
123 init();
124 yyparse();
125 if (eqnreg > 0) {
126 printf(".as %d \\*(%d\n", ds, eqnreg);
127 ofree(eqnreg);
128 }
129 printf(".ps \\n(99\n.ft \\n(98\n");
133 } while (getline(in) == lefteq);
130 } while (getaline(in) == lefteq);
134 if (*in)
135 printf(".as %d \"%s", ds, in);
136 printf(".ps \\n(99\n.ft \\n(98\n");
137 printf("\\*(%d\n", ds);
138 ofree(ds);
139}
140
141void

--- 138 unchanged lines hidden ---
131 if (*in)
132 printf(".as %d \"%s", ds, in);
133 printf(".ps \\n(99\n.ft \\n(98\n");
134 printf("\\*(%d\n", ds);
135 ofree(ds);
136}
137
138void

--- 138 unchanged lines hidden ---