4 * Copyright (C) 2012-2013 Ali Gholami Rudi <ali at rudi dot ir>
6 * This program is released under the modified BSD license.
14 static void g_init(void)
22 void errmsg(char *fmt
, ...)
26 vfprintf(stderr
, fmt
, ap
);
30 void errdie(char *msg
)
37 "Usage: neatcc [options] input\n"
39 " -mx \tinclude macro x\n"
40 " -C \tenable compatibility mode\n"
41 " -Tdev \tset output device\n"
42 " -Fdir \tset font directory (" TROFFFDIR
")\n"
43 " -Mdir \tset macro directory (" TROFFMDIR
")\n";
45 int main(int argc
, char **argv
)
47 char fontdir
[PATHLEN
] = TROFFFDIR
;
48 char macrodir
[PATHLEN
] = TROFFMDIR
;
49 char dev
[PATHLEN
] = "utf";
53 for (i
= 1; i
< argc
; i
++) {
54 if (argv
[i
][0] != '-' || !argv
[i
][1])
61 sprintf(path
, "%s/tmac.%s", macrodir
, argv
[i
] + 2);
65 strcpy(fontdir
, argv
[i
][2] ? argv
[i
] + 2 : argv
[++i
]);
68 strcpy(macrodir
, argv
[i
][2] ? argv
[i
] + 2 : argv
[++i
]);
71 strcpy(dev
, argv
[i
][2] ? argv
[i
] + 2 : argv
[++i
]);
78 if (dev_open(fontdir
, dev
)) {
79 fprintf(stderr
, "neatroff: cannot open device %s\n", dev
);
86 in_queue(NULL
); /* reading from standard input */
88 in_queue(!strcmp("-", argv
[i
]) ? NULL
: argv
[i
]);
89 str_set(map(".P"), macrodir
);