1 /* soin: inline troff .so requests */
8 static int soin(char *path
);
10 static int soin_cmd(char *s
)
14 if (s
[0] != '.' || s
[1] != 's' || s
[2] != 'o' || s
[3] != ' ')
17 while (isspace((unsigned char) *s
))
21 while (*s
&& *s
!= '\n' && *s
!= '"')
24 while (*s
&& *s
!= ' ' && *s
!= '\n')
31 static int soin(char *path
)
33 FILE *fp
= path
? fopen(path
, "r") : stdin
;
37 fprintf(stderr
, "soin: cannot open <%s>\n", path
);
40 printf(".lf %d %s\n", lineno
, path
? path
: "stdin");
41 while (fgets(ln
, sizeof(ln
), fp
)) {
44 printf(".lf %d %s\n", lineno
, path
? path
: "stdin");
47 if (ln
[0] == '.' && ln
[1] == 'l' && ln
[2] == 'f')
48 sscanf(ln
, ".lf %d", &lineno
);