wb: handle \( and \C characters when hyphenating
[neatroff.git] / roff.c
blob63e0de0f3bbbfffb34b7da9fc0cf33b97aa2299b
1 /*
2 * neatroff troff clone
4 * Copyright (C) 2012-2013 Ali Gholami Rudi <ali at rudi dot ir>
6 * This program is released under the modified BSD license.
7 */
8 #include <stdarg.h>
9 #include <stdio.h>
10 #include <string.h>
11 #include "roff.h"
13 static void g_init(void)
15 n_o = SC_IN;
16 n_p = SC_IN * 11;
17 n_lg = 1;
20 static void compile(void)
22 out("s%d\n", n_s);
23 out("f%d\n", n_f);
24 render();
25 out("V%d\n", n_p);
28 void errmsg(char *fmt, ...)
30 va_list ap;
31 va_start(ap, fmt);
32 vfprintf(stderr, fmt, ap);
33 va_end(ap);
36 int main(int argc, char **argv)
38 int i;
39 char path[PATHLEN];
40 dev_open(TROFFROOT "/font/devutf");
41 env_init();
42 tr_init();
43 g_init();
44 for (i = 1; i < argc; i++) {
45 if (argv[i][0] != '-' || !argv[i][0])
46 break;
47 if (argv[i][1] == 'm') {
48 sprintf(path, TROFFROOT "/tmac/tmac.%s", argv[i] + 2);
49 in_queue(path);
52 if (i == argc)
53 in_queue(NULL); /* reading from standard input */
54 for (; i < argc; i++)
55 in_queue(!strcmp("-", argv[i]) ? NULL : argv[i]);
56 str_set(REG('.', 'P'), TROFFROOT);
57 compile();
58 env_free();
59 dev_close();
60 return 0;